Skip to content

Rule suggestion: prefer node: prefixed imports when possible #344

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions