A minimal ESLint plugin that requires `node:` imports
Disallow imports of built-in Node.js modules without the node: prefix
You’ll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-node-import:
npm install eslint-plugin-node-import --save-dev
Add node-import to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["node-import"]
}
Then configure the (only) rule under the rules section.
{
"rules": {
"node-import/prefer-node-protocol": 2
}
}
🔧 Automatically fixable by the --fix CLI option.
| Name | Description | 🔧 |
|---|---|---|
| prefer-node-protocol | Prefer using the node: protocol when importing Node.js builtin modules. |
🔧 |
This plugin is a composite of two different custom ESLint rules:
eslint-import-require-node-prefix from this GitHub Gistprefer-node-protocol from eslint-plugin-unicorn© 2023 Nikita Karamov
Licensed under the ISC License
This project is hosted on GitHub:
https://github.com/kytta/eslint-plugin-node-import.git