Skip to content

build: replace eslint-plugin-node with eslint-plugin-n (gh54 part II)#10952

Open
Planeshifter wants to merge 3 commits intodevelopfrom
philipp/gh54-eslint-plugin-n
Open

build: replace eslint-plugin-node with eslint-plugin-n (gh54 part II)#10952
Planeshifter wants to merge 3 commits intodevelopfrom
philipp/gh54-eslint-plugin-n

Conversation

@Planeshifter
Copy link
Copy Markdown
Member

Progresses stdlib-js/metr-issue-tracker#54.

Description

What is the purpose of this pull request?

This pull request:

  • Replaces the unmaintained eslint-plugin-node (v11) with its actively maintained fork eslint-plugin-n (v17) (PR 3 of the migration plan).
  • Renames plugin registration from node to n in etc/eslint/plugins/index.js.
  • Renames all rule references from node/* to n/* in etc/eslint/rules/nodejs.js.
  • Updates ~530 eslint-disable comments across the codebase from node/ to n/.
  • Drops the tryExtensions option from n/file-extension-in-import (no longer supported by eslint-plugin-n).
  • Adds ignores for features newly detected by eslint-plugin-n: bigint and hashbang in n/no-unsupported-features/es-syntax, http2 and process.release in n/no-unsupported-features/node-builtins.
  • Updates JSDoc @name tags and documentation URLs to point to the eslint-community/eslint-plugin-n repository.
  • Moves nested log/logError functions to outer scope in remark-run-javascript-examples and fixes pre-existing lint violations in touched files.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

Stacked on #10950. eslint-plugin-n is the community-maintained fork of the unmaintained eslint-plugin-node and is required for ESLint v9 compatibility.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code. The bulk rename was done via scripted sed, with manual review of config changes and rule compatibility.


@stdlib-js/reviewers

@Planeshifter Planeshifter changed the base branch from develop to philipp/gh54-modernize-custom-rule-apis March 15, 2026 06:33
@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 15, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedzeros@​1.0.0721008275100
Addedndarray@​1.0.1910010010075100
Addedndarray-gemm@​1.0.0781008575100
Addedndarray-ops@​1.2.210010010075100
Addedjstat@​1.9.69910010080100
Addedeslint-plugin-n@​17.24.09610010089100

View full report

@Planeshifter Planeshifter changed the title bench: replace eslint-plugin-node with eslint-plugin-n build: replace eslint-plugin-node with eslint-plugin-n Mar 15, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch 2 times, most recently from ac2468f to ff1e4ba Compare March 15, 2026 16:25
@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 15, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
Critical CVE: npm form-data uses unsafe random function in form-data for choosing boundary

CVE: GHSA-fjxv-7rqg-78g4 form-data uses unsafe random function in form-data for choosing boundary (CRITICAL)

Affected versions: < 2.5.4; >= 3.0.0 < 3.0.4; >= 4.0.0 < 4.0.4

Patched version: 2.5.4

From: ?npm/form-data@2.3.3

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/form-data@2.3.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Critical
Critical CVE: Prototype Pollution in npm minimist

CVE: GHSA-xvch-5gv4-984h Prototype Pollution in minimist (CRITICAL)

Affected versions: >= 1.0.0 < 1.2.6; < 0.2.4

Patched version: 0.2.4

From: ?npm/factor-bundle@2.5.0npm/minimist@0.0.5

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/minimist@0.0.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@Planeshifter Planeshifter changed the title build: replace eslint-plugin-node with eslint-plugin-n build: replace eslint-plugin-node with eslint-plugin-n (gh54 part II) Mar 15, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch 2 times, most recently from 4fbfcbf to 7f06a75 Compare March 15, 2026 17:38
@Planeshifter Planeshifter added the METR Pull request associated with the METR project. label Mar 18, 2026
Base automatically changed from philipp/gh54-modernize-custom-rule-apis to develop March 22, 2026 06:59
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Mar 22, 2026

@Planeshifter Heads-up: looks like stacking went sideways. Would you mind resolving the merge conflicts?

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Mar 22, 2026

Actually, I think I know what happened. It went sideways because I had deleted the base branch on the GitHub UI. And it is not clear to me how to move this PR back against the restored base branch. :(

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Mar 22, 2026

Maybe you can force push to move it back on the original base branch? 😬

@github-actions github-actions bot mentioned this pull request Mar 22, 2026
@Planeshifter Planeshifter force-pushed the philipp/gh54-eslint-plugin-n branch from 7f06a75 to dd197bb Compare March 23, 2026 04:20
@Planeshifter Planeshifter marked this pull request as ready for review March 23, 2026 04:21
@Planeshifter Planeshifter requested a review from kgryte March 23, 2026 04:21
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Mar 23, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

No coverage information available.

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Mar 26, 2026

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Mar 26, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

/stdlib merge

@kgryte, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Mar 26, 2026
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
@Planeshifter Planeshifter requested a review from kgryte March 27, 2026 04:32
// MODULES //

var shell = require( 'child_process' ).execSync; // eslint-disable-line node/no-sync
var shell = require( 'child_process' ).execSync;
Copy link
Copy Markdown
Member

@kgryte kgryte Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Removing this comment re-enables the warning. Is that intended?


total = pkgs.length;
out = new Array( total );
out = new Array( total ); // eslint-disable-line stdlib/no-new-array
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter We should go ahead and use #.push here. This isn't a scenario where we explicitly want a sparse array.

rules[ 'n/no-unsupported-features/es-syntax' ] = [ 'error', {
'version': '>=0.12.18',
'ignores': []
'ignores': [ 'bigint', 'hashbang', 'object-assign', 'object-getownpropertydescriptors', 'proxy', 'string-fromcodepoint', 'string-prototype-repeat' ]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Why are we adding these to the ignored list and not just ignoring them on a per file basis? Given that most of these are localized to specific packages, I am not sure why it makes sense to globally ignore these.

* @memberof rules
* @type {Array}
* @see [node/shebang]{@link https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/shebang.md}
* @see [node/shebang]{@link https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/shebang.md}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter This link is incorrect.

* limitations under the License.
*/

/* eslint-disable node/shebang */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Why is this no longer applicable? It seems like n/hashbang is the same rule as node/shebang, so I am curious how this rule no longer applies.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This obviously applies to the other files.

// Check for a `node` property:
isString( proc.versions.node ) &&

/* eslint-disable node/no-unsupported-features/es-builtins */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter This seems to be likely the only package where we use proc.release, so I am not understanding why you chose to globally ignore proc.release.

* limitations under the License.
*/

/* eslint-disable node/no-unsupported-features/node-builtins */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment.

@@ -20,7 +20,7 @@

// MODULES //

var appendFile = require( 'fs' ).appendFileSync; // eslint-disable-line node/no-sync
var appendFile = require( 'fs' ).appendFileSync;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Not understanding why this comment was removed instead of changed to n/no-sync. Applies throughout this PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the default value for allowRootLevel is false (ref: https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-sync.md#allowatrootlevel), I would expect this to trigger a warning given *Sync.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Especially in this case, we shouldn't be emitting a warning, as using the sync API is intentional.

@@ -43,7 +43,7 @@ tape( 'main export is a function', function test( t ) {
});

tape( 'the function reads the entire contents of a file', opts, function test( t ) {
var expected = fs.readFileSync( __filename ); // eslint-disable-line node/no-sync
var expected = fs.readFileSync( __filename ); // eslint-disable-line n/no-sync
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter And then, here, we do what I would expect. So it is very unclear to me why you removed the comment in some files but then here you simply update the rule name.

@@ -18,8 +18,6 @@
* limitations under the License.
*/

/* eslint-disable node/shebang */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Based on my reading of https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/hashbang.md, this script is not in the bin field of the package.json. In which case, we need to disable the lint rule, as the rule should claim that this file needs no hashbang. What am I missing?

@@ -18,8 +18,10 @@

'use strict';

/* eslint-disable n/no-unsupported-features/node-builtins */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Do we really need to disable this rule for the entire file?

@@ -18,9 +18,11 @@

'use strict';

/* eslint-disable n/no-unsupported-features/node-builtins */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Do we really need to disable this rule for the entire file?

@@ -18,10 +18,12 @@

'use strict';

/* eslint-disable n/no-unsupported-features/node-builtins */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Do we really need to disable this rule for the entire file?

@@ -18,10 +18,12 @@

'use strict';

/* eslint-disable n/no-unsupported-features/node-builtins */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Do we really need to disable this rule for the entire file?

@@ -105,7 +105,7 @@ function factory( fcns, clbk, thisArg ) {
}
// Copy the remaining arguments...
len = arguments.length;
args = new Array( len );
args = new Array( len ); // eslint-disable-line stdlib/no-new-array
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter We should explicitly use #.push here.

@@ -38,7 +38,7 @@ bench( pkg, function benchmark( b ) {
return v * i;
}

arr = new Array( 100 );
arr = new Array( 100 ); // eslint-disable-line stdlib/no-new-array
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter In all the loop generation here and below, we should go ahead and explicit use #.push.

@@ -38,7 +38,7 @@ bench( pkg, function benchmark( b ) {
return v * i;
}

arr = new Array( 100 );
arr = new Array( 100 ); // eslint-disable-line stdlib/no-new-array
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter We should go ahead and explicitly use #.push here and below.

@@ -16,7 +16,7 @@
* limitations under the License.
*/

/* eslint-disable node/no-sync, stdlib/no-dynamic-require, stdlib/no-unassigned-require, stdlib/require-last-path-relative */
/* eslint-disable n/no-sync, stdlib/no-dynamic-require, stdlib/no-unassigned-require */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter Why is stdlib/require-last-path-relative no longer applicable here?

@@ -25,7 +25,7 @@ var Object = require( '@stdlib/object/ctor' );

// VARIABLES //

var propertyDescriptors = Object.getOwnPropertyDescriptors; // eslint-disable-line node/no-unsupported-features/es-builtins
var propertyDescriptors = Object.getOwnPropertyDescriptors;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter We shouldn't be globally ignoring getOwnPropertyDescriptors because of this one package.

Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a series of comments. Reviewed all 542 files. There are 107 files which, IMO, have issues, as alluded to in my comments.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Mar 27, 2026
@kgryte
Copy link
Copy Markdown
Member

kgryte commented Mar 27, 2026

For METR,

review_time: 38 mins

@kgryte
Copy link
Copy Markdown
Member

kgryte commented Apr 8, 2026

/stdlib merge

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Apr 8, 2026
var tape = require( 'tape' );
var remark = require( 'remark' );
var readSync = require( 'to-vfile' ).readSync; // eslint-disable-line node/no-sync
var readSync = require( 'to-vfile' ).readSync;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Planeshifter If only call expressions, why would it work here?

@stdlib-bot
Copy link
Copy Markdown
Contributor

/stdlib merge

@kgryte, the slash command failed to complete. Please check the workflow logs for details.

View workflow run

@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

METR Pull request associated with the METR project. Needs Changes Pull request which needs changes before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants