Based on eslint-plugin-toplevel.
Lets you disallow top level variables.
Examples of incorrect code for this rule:
var foo = 42;
const bar = 1337;
let baz = 0;
// Rest of your code
Examples of correct code for this rule:
export default function () {
var foo = 42;
const bar = 1337;
let baz = 0;
// Rest of your code
}
{
"rules": {
"nosideeffect-top/no-top-level-variables": [
"error",
{
"kind": ["const", "let", "var"]
}
]
}
}
Allows to only forbid specific kinds of variables.
Default is ["const", "let", "var"]
If you want to allow top level variables