eslint-plugin-no-top
v0.2.0
Published
Disallow side effects at the top level of files
Maintainers
Readme
eslint-plugin-no-top
Disallow side effects at the top level of files.
Based on @ericcornelissen/eslint-plugin-top.
Installation
First, install ESLint:
npm install eslint --save-devThen install this plugin:
npm install eslint-plugin-no-top --save-devUsage
Flat config (ESLint v9+)
import noTop from "eslint-plugin-no-top";
export default [
{
plugins: { "no-top": noTop },
rules: {
"no-top/no-top-level-side-effects": "error",
"no-top/no-top-level-state": "error",
"no-top/no-top-level-variables": "error",
},
},
];The plugin key (no-top in the example) must match the prefix used in rule names.
Rules
no-top-level-side-effects— disallow top-level side effectsno-top-level-state— disallow stateful values (e.g. regexes withg/yflags) at the top levelno-top-level-variables— disallow top-level variables
Development
vp install
vp test
vp pack
vp check