eslint-plugin-node icon indicating copy to clipboard operation
eslint-plugin-node copied to clipboard

Rule suggestion: prefer node: prefixed imports when possible

Open JoshuaKGoldberg opened this issue 3 years ago • 0 comments

Older built-in Node modules such as fs now can be imported via either their name or node: + their name:

import fs from "fs";
import fs from "node:fs";

The prefixed versions are nice because they can't be overridden by user modules and are similarly formatted to to prefix-only modules such as node:test.

Suggestion: let's add a linter rule to enforce using them, with an auto-fixer?

JoshuaKGoldberg avatar Oct 02 '22 04:10 JoshuaKGoldberg