Skip to content

build: don't store eslint locally - #54231

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
avivkeller:eslint-not-local
Sep 6, 2024
Merged

build: don't store eslint locally#54231
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
avivkeller:eslint-not-local

Conversation

@avivkeller

@avivkelleravivkeller commented Aug 6, 2024

Copy link
Copy Markdown
Member

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
Copy Markdown
Collaborator

Review requested:

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

@nodejs-github-botnodejs-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
@avivkeller

avivkeller commented Aug 6, 2024

Copy link
Copy Markdown
MemberAuthor

CC @nodejs/build @nodejs/linting

@avivkelleravivkeller changed the title build: don't sure eslint locallybuild: don't store eslint locallyAug 6, 2024
@avivkelleravivkeller 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
@avivkeller

Copy link
Copy Markdown
MemberAuthor

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.

@avivkeller

Copy link
Copy Markdown
MemberAuthor

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?

@codecov

codecovBot commented Aug 6, 2024

Copy link
Copy Markdown

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

bnb commented Aug 7, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

@avivkeller

Copy link
Copy Markdown
MemberAuthor

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.

@benjamingrbenjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2024
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 7, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@avivkeller

avivkeller commented Aug 7, 2024

Copy link
Copy Markdown
MemberAuthor

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

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadMakefile Outdated
aduh95
aduh95 previously requested changes Aug 9, 2024

@aduh95aduh95 left a comment

Copy link
Copy Markdown
Contributor

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

silverwind commented Aug 9, 2024

Copy link
Copy Markdown
Contributor

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

@avivkeller

Copy link
Copy Markdown
MemberAuthor

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

I have it setup like:

tools/.jslintstamp:
cd tools/eslint &&$(call available-node,$(run-npm-ci))
@touch $@

If the user wants to re-build the lint, they have to run make lint-clean.

@avivkeller
avivkeller requested a review from aduh95August 9, 2024 16:32
@avivkeller
avivkeller requested a review from aduh95August 9, 2024 17:42
@avivkelleravivkeller added the review wanted PRs that need reviews. label Aug 11, 2024
@avivkeller

avivkeller commented Aug 11, 2024

Copy link
Copy Markdown
MemberAuthor

Hey, I'd love to get some reviews if there aren't any more objections. I don't want to pressure anyone tho.

Comment thread.github/dependabot.yml Outdated
@avivkeller
avivkeller requested a review from targosAugust 12, 2024 22:07
@avivkeller

Copy link
Copy Markdown
MemberAuthor

Any more changes needed?

@avivkeller

avivkeller commented Aug 23, 2024

Copy link
Copy Markdown
MemberAuthor

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

@avivkeller

Copy link
Copy Markdown
MemberAuthor

No objections in a week, is this author ready?

@aduh95

Copy link
Copy Markdown
Contributor

*`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.

@avivkelleravivkeller added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2024
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 1, 2024
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@avivkelleravivkeller added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 1, 2024
@avivkeller

avivkeller commented Sep 1, 2024

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
Collaborator

@avivkeller

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
Collaborator

@avivkeller

Copy link
Copy Markdown
MemberAuthor

FWIW CI is 🟢 (Yay!)

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 6, 2024
@nodejs-github-botnodejs-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:mainSep 6, 2024
@nodejs-github-bot

Copy link
Copy Markdown
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>
@RafaelGSSRafaelGSS mentioned this pull request Sep 16, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.buildIssues and PRs related to build files or the CI.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.metaIssues and PRs related to the general management of the project.needs-ciPRs that need a full CI run.review wantedPRs that need reviews.toolsIssues 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

@avivkeller@nodejs-github-bot@bnb@silverwind@aduh95@nschonni@targos@richardlau@benjamingr