Disallow side effects at the top level of files
You'll first need to install ESLint:
npm i eslint --save-devNext, install eslint-plugin-top:
npm install eslint-plugin-top --save-devAdd top to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["top"]
}Then configure the rules you want to use under the rules section.
{
"rules": {
"top/no-top-level-variables": 2,
"top/no-top-level-side-effect": 2
}
}