Skip to content

Commit

Permalink
Reorganize ESLint warning thresholds
Browse files Browse the repository at this point in the history
Some lint rules are disabled because they generate many violations
across the monorepo (mostly thanks to the recent ESLint upgrade). To
be able to identify them and remove them, we have set these rules to
generate warnings instead, and we have also implemented a quality gate
to ensure that no new instances of these warnings occur in the codebase.

However, currently there are so many warnings and the output from ESLint
is so large, that if changes are made in a branch that do end up
producing new violations, it is basically impossible to know where those
violations occurred. The format of the warning thresholds file, which is
used to track changes to warnings, does not help things, either, because
it only records the rules for which violations occurred and not the
files that have those violations.

To address this, this commit reorganizes the warning thresholds file so
that warning counts are filed first by file path and then by rule. A
regression or improvement in lint violations is still determined by
calculating a total and comparing it to the file, but then the script is
able to show where new violations occurred. (As a plus, this commit also
hides improvements if there are regressions.)

For instance, instead of saying something like:

```
🛑 New ESLint warnings have been introduced and need to be resolved for linting to pass:

- @typescript-eslint/consistent-type-exports: 19 -> 21 (+2)
- typescript-eslint/no-base-to-string: 3 -> 1 (-2)
- typescript-eslint/no-duplicate-enum-values: 2 -> 3 (+1)
```

it might now say:

```
🛑 New ESLint warnings have been introduced and need to be resolved for linting to pass:

- packages/controller-utils/src/types.ts
  - typescript-eslint/no-duplicate-enum-values: 2 -> 3 (+1)
- packages/logging-controller/src/logTypes/index.ts
  - @typescript-eslint/consistent-type-exports: 0 -> 1 (+1)
- packages/message-manager/src/index.ts
  - @typescript-eslint/consistent-type-exports: 0 -> 1 (+1)
- packages/notification-services-controller/src/NotificationServicesController/index.ts
  - @typescript-eslint/consistent-type-exports: 0 -> 1 (+1)
```
  • Loading branch information
mcmire committed Jan 15, 2025
1 parent f418952 commit 83b44c2
Show file tree
Hide file tree
Showing 2 changed files with 1,324 additions and 90 deletions.
Loading

0 comments on commit 83b44c2

Please sign in to comment.