Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint-community/eslint-plugin-n
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v17.10.2
Choose a base ref
...
head repository: eslint-community/eslint-plugin-n
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v17.10.3
Choose a head ref
  • 3 commits
  • 6 files changed
  • 3 contributors

Commits on Aug 5, 2024

  1. docs(process-exit-as-throw): update wording (#323)

    G-Rath authored Aug 5, 2024
    Copy the full SHA
    e5e758e View commit details

Commits on Sep 18, 2024

  1. fix: Use our data set to work out if a module is a node module (#338)

    * test: Add failing test for #337
    
    * fix: Use our data set to work out if a module is a node module
    scagood authored Sep 18, 2024
    Copy the full SHA
    6a1b2c5 View commit details
  2. chore(master): release 17.10.3 (#329)

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    github-actions[bot] authored Sep 18, 2024
    Copy the full SHA
    85b7945 View commit details
Showing with 29 additions and 5 deletions.
  1. +1 −1 .github/release-please/manifest.json
  2. +12 −0 CHANGELOG.md
  3. +2 −2 docs/rules/process-exit-as-throw.md
  4. +11 −1 lib/rules/prefer-node-protocol.js
  5. +1 −1 package.json
  6. +2 −0 tests/lib/rules/prefer-node-protocol.js
2 changes: 1 addition & 1 deletion .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{".":"17.10.2"}
{".":"17.10.3"}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [17.10.3](https://github.com/eslint-community/eslint-plugin-n/compare/v17.10.2...v17.10.3) (2024-09-18)


### 🩹 Fixes

* Use our data set to work out if a module is a node module ([#338](https://github.com/eslint-community/eslint-plugin-n/issues/338)) ([6a1b2c5](https://github.com/eslint-community/eslint-plugin-n/commit/6a1b2c5606f0c6a37b38b60d780df8698db22a87))


### 📚 Documentation

* **process-exit-as-throw:** update wording ([#323](https://github.com/eslint-community/eslint-plugin-n/issues/323)) ([e5e758e](https://github.com/eslint-community/eslint-plugin-n/commit/e5e758ea0cd238220127ae7bcbd967f1d8920f28))

## [17.10.2](https://github.com/eslint-community/eslint-plugin-n/compare/v17.10.1...v17.10.2) (2024-08-05)


4 changes: 2 additions & 2 deletions docs/rules/process-exit-as-throw.md
Original file line number Diff line number Diff line change
@@ -16,9 +16,9 @@ function foo(a) {
}
```

ESLint does not address `process.exit()` as stop in code path analysis, then [consistent-return] rule will warn the above code.
ESLint does not mark code after `process.exit()` calls as unreachable like it does with `throw` and `return` expressions, meaning rules like [consistent-return] will still warn.

If you turn this rule on, ESLint comes to address `process.exit()` as throw in code path analysis. So, above code will get expected code path.
This rule overrides the default code path analyzer so that code after `process.exit()` calls are marked as unreachable, meaning code like the above will not trigger warnings.

This rule itself never warn code.

12 changes: 11 additions & 1 deletion lib/rules/prefer-node-protocol.js
Original file line number Diff line number Diff line change
@@ -4,12 +4,22 @@
*/
"use strict"

const { isBuiltin } = require("node:module")
const getConfiguredNodeVersion = require("../util/get-configured-node-version")
const getSemverRange = require("../util/get-semver-range")
const visitImport = require("../util/visit-import")
const visitRequire = require("../util/visit-require")
const mergeVisitorsInPlace = require("../util/merge-visitors-in-place")
const {
NodeBuiltinModules,
} = require("../unsupported-features/node-builtins.js")

/**
* @param {string} name The name of the node module
* @returns {boolean}
*/
function isBuiltin(name) {
return Object.hasOwn(NodeBuiltinModules, name)
}

const messageId = "preferNodeProtocol"

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-n",
"version": "17.10.2",
"version": "17.10.3",
"description": "Additional ESLint's rules for Node.js",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
2 changes: 2 additions & 0 deletions tests/lib/rules/prefer-node-protocol.js
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@ new RuleTester({
const fs = await import(\`fs\`);
}
`,
// punycode has no `node:` equivelent
'import "punycode";',
'import "punycode/";',
// https://bun.sh/docs/runtime/bun-apis
'import "bun";',