eslint-plugin-node

Additional ESLint's rules for Node.js

💿 Install & Usage

$ npm install --save-dev eslint eslint-plugin-node

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"
    }
}

📖 Rules

Possible Errors

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

Best Practices

Rule ID Description
⭐️ no-deprecated-api disallow deprecated APIs

Stylistic Issues

Rule ID Description
exports-style enforce either module.exports or exports

🔧 Configs

This plugin provides plugin:node/recommended preset config. This preset config:

👫 FAQ

🚥 Semantic Versioning Policy

eslint-plugin-node follows semantic versioning and ESLint's Semantic Versioning Policy.

📰 Changelog

💎 Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools