Skip to content

Commit

Permalink
Update ESLint warning thresholds, and produce them consistently
Browse files Browse the repository at this point in the history
The ESLint warning thresholds file records warnings that were produced
the last time that `eslint` was run, categorizing them by rule. This
file should be kept up to date at all times so we can know whether new
code changes introduce a regression in the number of warnings or an
improvement. Specifically, the lint step will now fail if more warnings
are introduced to the codebase.

However, in the past we have observed inconsistencies in the behavior of
ESLint across different people's machines as well as in CI. With the
addition of the quality gate this means that some people are unable to
merge PRs because warnings are produced that are not seen in
development, and the warnings may not be reproducible by other
developers.

With that said, we recently learned that if `dist` directories are
present from a previous run of `yarn build`, it could affect the behavior
of the TypeScript-specific lint rules and cause the observed
inconsistencies. To mitigate this problem, this commit ensures that all
`dist` directories are removed before running `eslint`. This indeed does
change the number of warnings produced, and the thresholds file has been
updated to reflect this.
  • Loading branch information
mcmire committed Jan 15, 2025
1 parent af90e67 commit ea7cfe3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions eslint-warning-thresholds.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
"@typescript-eslint/consistent-type-exports": 19,
"@typescript-eslint/no-base-to-string": 3,
"@typescript-eslint/no-duplicate-enum-values": 2,
"@typescript-eslint/no-misused-promises": 3,
"@typescript-eslint/no-unsafe-enum-comparison": 59,
"@typescript-eslint/no-unsafe-enum-comparison": 34,
"@typescript-eslint/no-unused-vars": 36,
"@typescript-eslint/prefer-promise-reject-errors": 13,
"@typescript-eslint/prefer-readonly": 145,
"@typescript-eslint/switch-exhaustiveness-check": 10,
"@typescript-eslint/switch-exhaustiveness-check": 8,
"import-x/namespace": 189,
"import-x/no-named-as-default": 1,
"import-x/no-named-as-default-member": 8,
"import-x/order": 209,
"import-x/order": 205,
"jest/no-conditional-in-test": 129,
"jest/prefer-lowercase-title": 2,
"jest/prefer-strict-equal": 2,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
],
"scripts": {
"build": "yarn ts-bridge --project tsconfig.build.json --verbose",
"build:clean": "rimraf dist '**/*.tsbuildinfo' && yarn build",
"build:clean": "yarn build:only-clean && yarn build",
"build:only-clean": "rimraf -g 'packages/*/dist'",
"build:docs": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run build:docs",
"build:types": "tsc --build tsconfig.build.json --verbose",
"changelog:update": "yarn workspaces foreach --all --no-private --parallel --interlaced --verbose run changelog:update",
Expand Down

0 comments on commit ea7cfe3

Please sign in to comment.