Page MenuHomePhabricator

[monorepo] eslint all the js with a single version-pinned flat config
Needs ReviewPublic

Authored by bytesofman on Wed, Mar 5, 18:32.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

All of the js sub-repos in the monorepo have their own lint settings. For eslint before 9, this was best practice. It is difficult to find a "one size fits all" lint approach for JS, since nodejs has different rules from vanilla js, react has its own special rules, the browser has different globals vs node, different test engines also have different globals, different standards have different syntax, some repos have a good reason to use multiple standards, etc.

We want all js to be linted. And we want there to be a maintainable and as-standardized-as-possible approach.

With eslint 9, the "flat config" is introduced which allows a single config file to handle various rulesets across a monorepo. We implement this approach here, deleting all legacy lint settings (many of which were never implemented in arc lint).

We correct all lint issues discovered by this implementation now that arc lint is picking everything up.

Test Plan

CI for all lint changes, arc lint --everything

Event Timeline

Tail of the build log:

5 vulnerabilities (4 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@2.0.0 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1403 packages, and audited 3180 packages in 23s

274 packages are looking for funding
  run `npm fund` for details

9 vulnerabilities (8 moderate, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> cashtab@3.17.4 build
> node scripts/build.js

node:internal/modules/cjs/loader:1228
  throw err;
  ^

Error: Cannot find module 'eslint-webpack-plugin'
Require stack:
- /work/cashtab/config/webpack.config.js
- /work/cashtab/scripts/build.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/work/cashtab/config/webpack.config.js:21:22)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/work/cashtab/config/webpack.config.js',
    '/work/cashtab/scripts/build.js'
  ]
}

Node.js v20.18.3
Build cashtab-tests failed with exit code 1

dep back in, improve exclusions in arclint

Tail of the build log:

5 vulnerabilities (4 moderate, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

> ecash-agora@2.0.0 build
> tsc && tsc -p ./tsconfig.build.json

/work/cashtab /work/abc-ci-builds/cashtab-tests
npm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema instead
npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array instead
npm warn deprecated eslint@8.56.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.

added 1406 packages, and audited 2846 packages in 24s

274 packages are looking for funding
  run `npm fund` for details

9 vulnerabilities (8 moderate, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

> cashtab@3.17.4 build
> node scripts/build.js

node:internal/modules/cjs/loader:1228
  throw err;
  ^

Error: Cannot find module 'eslint-config-react-app/base'
Require stack:
- /work/cashtab/config/webpack.config.js
- /work/cashtab/scripts/build.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Function.resolve (node:internal/modules/helpers:190:19)
    at module.exports (/work/cashtab/config/webpack.config.js:787:37)
    at Object.<anonymous> (/work/cashtab/scripts/build.js:54:16)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/work/cashtab/config/webpack.config.js',
    '/work/cashtab/scripts/build.js'
  ]
}

Node.js v20.18.3
Build cashtab-tests failed with exit code 1

disable eslint plugin for webpack build