Skip to content

A ESlint plugin to fix imports like ```js import fs from 'fs'``` to ```js import fs from 'node:fs'```

Notifications You must be signed in to change notification settings

GoldStrikeArch/eslint-plugin-prefer-node-builtin-import

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-prefer-node-builtin-imports

ESlint plugin to change imports of builtin node modules to 'node:MODULE_NAME' This is a minimalistic (without additional dependencies) implemenation of eslint-plugin-unicorn-prefer-node-protocol-rule. It uses the same test cases as the unicorn version.

Shoutout to @alex-kinokon and @sindresorhus for inspiration.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-prefer-node-builtin-imports:

npm install eslint-plugin-prefer-node-builtin-imports --save-dev

Usage

Add prefer-node-builtin-imports to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["prefer-node-builtin-imports"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "prefer-node-builtin-imports/prefer-node-builtin-imports": 1
  }
}

Rules

TODO: Run eslint-doc-generator to generate the rules list.

About

A ESlint plugin to fix imports like ```js import fs from 'fs'``` to ```js import fs from 'node:fs'```

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published