Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require node: prefixes for Node.js builtins #1080

Merged
merged 2 commits into from Mar 12, 2024

Commits on Mar 12, 2024

  1. chore(eslint): require prefixed node builtins

    This adds a rule which requires all `require()`s or `import`s use the `node:` prefix when requesting builtins.
    
    `node:`-prefixed builtins better illustrate intent and reduce the risk of erroneously pulling in 3rd-party packges.
    boneskull committed Mar 12, 2024
    Copy the full SHA
    483e4f3 View commit details
    Browse the repository at this point in the history
  2. chore: use prefixed node builtins where appropriate

    This change adds the `node:` prefix to (almost) all `require()` calls of Node.js builtins.
    
    Two places were special cases:
    
    1. In `viz`, old Webpack does not understand the `node:` prefix; this had to be exempted from the rule.
    2. In `tofu`, I added another test to assert both prefixed and non-prefixed builtin references work as expected.
    
    Note that test fixture projects are ignored by ESLint; they have not been changed.
    boneskull committed Mar 12, 2024
    Copy the full SHA
    5da2c26 View commit details
    Browse the repository at this point in the history