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

build: don't store eslint locally #54231

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

RedYetiDev
Copy link
Member

@RedYetiDev RedYetiDev commented Aug 6, 2024

This PR removes eslint as a local dependency and switches to downloading it from npm. It will still be updated regularly via @dependabot.

Why?

  1. eslint is the only linter stored locally (besides cpplint, which has patches, unlike ESLint).
  2. There are multiple issues related to file paths being too long and tarballs failing to lint properly (see: Missing ./tools/node_modules/eslint/eslint.js on make test? #39709, make -s test-doc fails with Error: Cannot find module '/node-v14.4.0/tools/doc/../node_modules/eslint/node_modules/js-yaml' #34005, Erbium: test regression in tarball #32765, and others).

Why was eslint set up like this initially?

When eslint was first added to the repository in #1539 around 10 years, it replaced a (not as large, but still large) library, closure-lint. Since then, the library has almost 4x its size. At the time, there was no discussion (AFAICT) about keeping or removing the directory—it was simply included as it was.

Size-wise, this'll save ~40MB, which is a decent amount.


(I'll add more fixes as I find more issues)
Fixes #39709
Fixes #54231

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions
  • @nodejs/security-wg
  • @nodejs/tsc

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. labels Aug 6, 2024
@RedYetiDev
Copy link
Member Author

RedYetiDev commented Aug 6, 2024

CC @nodejs/build @nodejs/linting

@RedYetiDev RedYetiDev requested review from anonrig and targos August 6, 2024 18:09
@RedYetiDev RedYetiDev changed the title build: don't sure eslint locally build: don't store eslint locally Aug 6, 2024
@RedYetiDev RedYetiDev added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Aug 6, 2024
@RedYetiDev
Copy link
Member Author

Reviewers, please review the commit '(review changes)'. The first commit removes the node_modules directory and may be hard to review in the github UI.

@RedYetiDev
Copy link
Member Author

Everything is passing! The failure is because of #54229. The original PR didn't see any objections, is this good to land in the coming days?

Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.33%. Comparing base (1bcdba2) to head (6b95bab).
Report is 289 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #54231      +/-   ##
==========================================
+ Coverage   87.10%   87.33%   +0.23%     
==========================================
  Files         647      648       +1     
  Lines      181693   182321     +628     
  Branches    34869    34972     +103     
==========================================
+ Hits       158256   159225     +969     
+ Misses      16733    16371     -362     
- Partials     6704     6725      +21     

see 90 files with indirect coverage changes

@bnb
Copy link
Contributor

bnb commented Aug 7, 2024

I'm +1 to this approach, but feel like there's probably folks who have more domain knowledge about this who should actually be the ones to approve it.

@silverwind
Copy link
Contributor

I don't think there was any specific reason why those linters were checked into the repo besides maybe offline functionality, but I think that's likely no longer needed.

@RedYetiDev
Copy link
Member Author

Great! I'm glad y'all are on board! Seeing as the linting is passing (except for the unrelated issue), all looks good in terms of land-ability.

Although, I assume this needs a CI to land.

@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2024
@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev
Copy link
Member Author

RedYetiDev commented Aug 7, 2024

CI is passing. 🎉
Linting is passing except for an unrelated failured that was patched in 7327e44.

@nodejs-github-bot
Copy link
Collaborator

Makefile Outdated Show resolved Hide resolved
@aduh95 aduh95 added dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. labels Aug 9, 2024
aduh95
aduh95 previously requested changes Aug 9, 2024
Copy link
Contributor

@aduh95 aduh95 left a comment

Choose a reason for hiding this comment

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

Everytime I run e.g. make lint-js on this branch, it runs npm. Can you make it sure npm is run only when there were changes in the package-lock.json?

@silverwind
Copy link
Contributor

silverwind commented Aug 9, 2024

Everytime I run e.g. make lint-js on this branch, it runs npm. Can you make it sure npm is run only when there were changes in the package-lock.json?

FWIW, it's possible to achieve on-demand node_modules installation with Make by tracking the folder timestamp, but it's not a 100% thing as Make timestamp tracking works best with files. Here is how I do it in my projects:

node_modules: package-lock.json
	npm install --no-save
	@touch node_modules

@RedYetiDev RedYetiDev force-pushed the eslint-not-local branch 2 times, most recently from b003520 to d9eb162 Compare August 12, 2024 15:54
@RedYetiDev RedYetiDev requested a review from targos August 12, 2024 22:07
@RedYetiDev
Copy link
Member Author

Any more changes needed?

@RedYetiDev
Copy link
Member Author

RedYetiDev commented Aug 23, 2024

Thanks for approving! Does anyone else have any more feedback? It's been a while since any reviews.

@RedYetiDev
Copy link
Member Author

No objections in a week, is this author ready?

@aduh95
Copy link
Contributor

aduh95 commented Sep 1, 2024

* `author-ready` - A pull request is _author ready_ when:
* There is a CI run in progress or completed.
* There is at least one collaborator approval (or two TSC approvals for
semver-major pull requests).
* There are no outstanding review comments.
Please always add the `author ready` label to pull requests that qualify.
Please always remove it again as soon as the conditions are not met anymore,
such as if the CI run fails or a new outstanding review comment is posted.

so this is not author ready because there are no recent Jenkins CI run. If you start one, it would be.

@RedYetiDev RedYetiDev added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2024
@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev RedYetiDev added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 1, 2024
@RedYetiDev
Copy link
Member Author

RedYetiDev commented Sep 1, 2024

Per @aduh95's comment:

  • There is a CI run in progress or completed. 🟢
  • There is at least one collaborator approval.
  • There are no outstanding review comments.

@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev
Copy link
Member Author

The MacOS CI appears to have failed to start, could someone restart it?

As for the linked linux OpenSSL one, see #54737

@nodejs-github-bot
Copy link
Collaborator

@RedYetiDev
Copy link
Member Author

FWIW CI is 🟢 (Yay!)

@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 6, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 6, 2024
@nodejs-github-bot nodejs-github-bot merged commit 437e168 into nodejs:main Sep 6, 2024
58 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 437e168

aduh95 pushed a commit that referenced this pull request Sep 12, 2024
PR-URL: #54231
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@RafaelGSS RafaelGSS mentioned this pull request Sep 16, 2024
louwers pushed a commit to louwers/node that referenced this pull request Nov 2, 2024
PR-URL: nodejs#54231
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
tpoisseau pushed a commit to tpoisseau/node that referenced this pull request Nov 21, 2024
PR-URL: nodejs#54231
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. dont-land-on-v18.x PRs that should not land on the v18.x-staging branch and should not be released in v18.x. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. meta Issues and PRs related to the general management of the project. needs-ci PRs that need a full CI run. review wanted PRs that need reviews. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing ./tools/node_modules/eslint/eslint.js on make test?
9 participants