Skip to content

Commit

Permalink
docs: mention Node version support of prefer-node-protocol rule
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Nov 23, 2022
1 parent 20e959f commit 815ac33
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docs/rules/prefer-node-protocol.md
@@ -1,15 +1,19 @@
# Prefer using the `node:` protocol when importing Node.js builtin modules

<!-- Do not manually modify RULE_NOTICE part. Run: `npm run generate-rule-notices` -->
<!-- RULE_NOTICE -->
*This rule is part of the [recommended](https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config) config.*
💼 This rule is enabled in the ✅ `recommended` [config](https://github.com/sindresorhus/eslint-plugin-unicorn#preset-configs).

🔧 *This rule is [auto-fixable](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).*
<!-- /RULE_NOTICE -->
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).

<!-- end auto-generated rule header -->
<!-- Do not manually modify this header. Run: `npm run fix:eslint-docs` -->

When importing builtin modules, it's better to use the [`node:` protocol](https://nodejs.org/api/esm.html#node-imports) as it makes it perfectly clear that the package is a Node.js builtin module.

And don't forget to [upvote this issue](https://github.com/nodejs/node/issues/38343) if you agree.
Note that Node.js support for this feature began in:

> v16.0.0, v14.18.0 (`require()`)
>
> v14.13.1, v12.20.0 (`import`)
## Fail

Expand Down

0 comments on commit 815ac33

Please sign in to comment.