Page MenuHomePhabricator

[monorepo] Upgrade eslint to 9 and use pinned version instead of global
Needs RevisionPublic

Authored by bytesofman on Tue, Mar 4, 00:30.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

Use eslint 9 to lint js and ts repos with arc lint. Specify a config file that supports current ruleset.

Note that some js/ts repos are not currently covered by .arclint. Will add these in subsequent diffs (ecash-lib, ecash-agora)

Test Plan

arc lint --everything

Diff Detail

Repository
rABC Bitcoin ABC
Branch
eslint-to-9
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32576
Build 64640: Build Diffecash-herald-tests
Build 64639: arc lint + arc unit

Event Timeline

bytesofman published this revision for review.Tue, Mar 4, 00:36
bytesofman added inline comments.
.arclint
314

arguably the removal of alias-server is unrelated to this diff, but we are doing some other generalized improvements in line with the eslint upgrade (including js files now that we can globally configure eslint to lint them properly)

apps/ecash-herald/tsconfig.json
11

this is definitely unrelated but once this was fixed with arc lint I was not able to back it out. I think it's ok to let this change stay in this diff given that it was a lint autofix

arcanist/linter/ESLinter.php
39

this caused issues

users would have to have eslint globally installed, and it would have to be the correct version

now the version is pinned top level of the monorepo and this is the binary used for linting the js files.

Fabien requested changes to this revision.Tue, Mar 4, 08:31
Fabien added a subscriber: Fabien.
Fabien added inline comments.
apps/ecash-herald/tsconfig.json
11

The linter is correct here, the previous comma was a bug. Trailing comma are not allowed in json format unfortunately.

arcanist/linter/ESLinter.php
27
eslint.config.mjs
1

What is a .mjs file ? And also it should be added to the list of supported extensions for the linter (in the .arclint file) otherwise it won't be linted.

49

We already define this in the .arclint file, can we avoid duplicating it ? it's guaranteed to go out of sync, in fact it's already the case.
Ideally we should only keep the .arclint which will prevent the linter from running on files it's not targeted at (so it's faster).

This revision now requires changes to proceed.Tue, Mar 4, 08:31