Additional ESLint's rules for Node.js
$ npm install --save-dev eslint eslint-plugin-node
^4.0.0 || >=6.0.0
>=3.1.0
Note: It recommends a use of the “engines” field of package.json. The “engines” field is used by no-unsupported-features rule.
.eslintrc.json (An example)
{ "plugins": ["node"], "extends": ["eslint:recommended", "plugin:node/recommended"], "rules": { "node/exports-style": ["error", "module.exports"], } }
package.json (An example)
{ "name": "your-module", "version": "1.0.0", "engines": { "node": ">=4.0.0" } }
Rule ID | Description | |
---|---|---|
no-extraneous-import | disallow import declarations of extraneous packages | |
⭐️ | no-extraneous-require | disallow require() expressions of extraneous packages |
no-missing-import | disallow import declarations of missing files | |
⭐️ | no-missing-require | disallow require() expressions of missing files |
⭐️ | no-unpublished-bin | disallow ‘bin’ files which are ignored by npm |
no-unpublished-import | disallow import declarations of private things | |
⭐️ | no-unpublished-require | disallow require() expressions of private things |
⭐️ | no-unsupported-features | disallow unsupported ECMAScript features on the specified version |
⭐️ | process-exit-as-throw | make process.exit() expressions the same code path as throw |
⭐️✒️ | shebang | enforce the correct usage of shebang |
Rule ID | Description | |
---|---|---|
⭐️ | no-deprecated-api | disallow deprecated APIs |
Rule ID | Description | |
---|---|---|
exports-style | enforce either module.exports or exports |
This plugin provides plugin:node/recommended
preset config. This preset config:
process.exit()
.{ecmaVersion: 8}
into parserOptions
.no-missing-import
/ no-missing-require
rules don't work with nested folders in SublimeLinter-eslinteslint-plugin-node
follows semantic versioning and ESLint's Semantic Versioning Policy.
Welcome contributing!
Please use GitHub's Issues/PRs.
npm test
runs tests and measures coverage.npm run coverage
shows the coverage result of npm test
command.npm run clean
removes the coverage result of npm test
command.