Skip to content

tools: revert to use @stylistic/eslint-plugin-js v3#57314

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
joyeecheung:fix-lint-config
Mar 4, 2025
Merged

tools: revert to use @stylistic/eslint-plugin-js v3#57314
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
joyeecheung:fix-lint-config

Conversation

@joyeecheung
Copy link
Copy Markdown
Member

@joyeecheung joyeecheung commented Mar 4, 2025

@stylistic/eslint-plugin-js v4 has been updated to ship ESM-only, which needs require(esm) support due to the monkey-patching we do in our eslint.config.mjs. The node-test-linter job in Jenkins still runs Node.js v20 which has not yet released unflagging of require(esm). Revert to use v3 for now until we upgrade the Node.js version used in the CI.

Refs: #57261
For an example of broken CI, see https://ci.nodejs.org/job/node-test-linter/59234/console

@stylistic/eslint-plugin-js v4 has been updated to ship ESM-only,
which needs require(esm) support due to the monkey-patching
we do in our eslint.config.mjs. The node-test-linter job in Jenkins
still runs Node.js v20 which has not yet released unflagging
of require(esm). Revert to use v3 for now until we upgrade the
Node.js version used in the CI.
@joyeecheung joyeecheung added the fast-track PRs that do not need to wait for 72 hours to land. label Mar 4, 2025
@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Mar 4, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 2025

Fast-track has been requested by @joyeecheung. Please 👍 to approve.

@joyeecheung
Copy link
Copy Markdown
Member Author

Arguably a better fix would be to make this less hacky

node/eslint.config.mjs

Lines 33 to 38 in a7f648c

Module._resolveFilename = (request, parent, isMain, options) => {
if (hacks.includes(request) && parent.id.endsWith('__placeholder__.js')) {
return resolveEslintTool(request);
}
return ModuleResolveFilename(request, parent, isMain, options);
};

Or to upgrade the CI to use Node.js v22. But the issue is now breaking the CI and this seems like the most no-brainer fix.

@aduh95
Copy link
Copy Markdown
Contributor

aduh95 commented Mar 4, 2025

You need to update the package-lock.json

@richardlau
Copy link
Copy Markdown
Member

Ideally PR's such as #57261 would have a Jenkins CI run.

@targos
Copy link
Copy Markdown
Member

targos commented Mar 4, 2025

What do you think about changing the workflow so it also runs with Node.js 20.x so we are more confident about the fix and less likely to have this kind of issues in the future?

@joyeecheung
Copy link
Copy Markdown
Member Author

What do you think about changing the workflow so it also runs with Node.js 20.x so we are more confident about the fix and less likely to have this kind of issues in the future?

I am not sure how the Jenkins gets the Node.js versions, but if it's an easy fix, happy that someone else get it done ASAP instead.

@richardlau
Copy link
Copy Markdown
Member

What do you think about changing the workflow so it also runs with Node.js 20.x so we are more confident about the fix and less likely to have this kind of issues in the future?

I am not sure how the Jenkins gets the Node.js versions, but if it's an easy fix, happy that someone else get it done ASAP instead.

On Jenkins the jenkins-workspace machines (which run the linter job among others) are setup via Ansible: nodejs/build#4032 (comment)

targos added a commit to targos/node that referenced this pull request Mar 4, 2025
@targos
Copy link
Copy Markdown
Member

targos commented Mar 4, 2025

Alternative that removes the use of require: #57315

@joyeecheung
Copy link
Copy Markdown
Member Author

node-test-linter CI: https://ci.nodejs.org/job/node-test-linter/59242/

targos added a commit to targos/node that referenced this pull request Mar 4, 2025
@jasnell
Copy link
Copy Markdown
Member

jasnell commented Mar 4, 2025

I'm good with either approach. thanks for taking a look

@joyeecheung joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Mar 4, 2025
@joyeecheung
Copy link
Copy Markdown
Member Author

Landing it now to unbreak CI. We can revert it when the Node.js version gets updated or when #57315 lands

@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 4, 2025
@nodejs-github-bot nodejs-github-bot merged commit e05756f into nodejs:main Mar 4, 2025
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in e05756f

nodejs-github-bot pushed a commit that referenced this pull request Mar 7, 2025
Refs: #57314
PR-URL: #57315
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
aduh95 pushed a commit that referenced this pull request Mar 9, 2025
@stylistic/eslint-plugin-js v4 has been updated to ship ESM-only,
which needs require(esm) support due to the monkey-patching
we do in our eslint.config.mjs. The node-test-linter job in Jenkins
still runs Node.js v20 which has not yet released unflagging
of require(esm). Revert to use v3 for now until we upgrade the
Node.js version used in the CI.

PR-URL: #57314
Refs: #57261
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
aduh95 pushed a commit that referenced this pull request Mar 9, 2025
Refs: #57314
PR-URL: #57315
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
aduh95 pushed a commit that referenced this pull request Mar 9, 2025