Add --report-unused-disable-directives
to lint:eslint
#1608
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🌟 What is the purpose of this PR?
This PR makes sure that
yarn lint:eslint
does not exits with 0 if there are unused ESLint disable comments left in the codebase. These comments should be automatically removed on save because we havereportUnusedDisableDirectives: true
in our base ESLint config. However, when we do bulk-edits, unused directives may remain as warnings and not fail the CI.🔗 Related links
--report-unused-disable-directives
tolint:eslint
blockprotocol/blockprotocol#812--report-unused-disable-directives
frompackages/graph/clients/typescript/package.json
. This package contains auto-generated files likeindex.ts
because of which we need to make an exception. Local.eslintrc.cjs
is already aware of this edge case, but unfortunately this config property is not yet synced with the CLI arg. Hope this can be fixed upstream via an RFC + PR.🐾 Next steps
If there is support for
reportUnusedDisableDirectives: "error"
upstream, we can remove the CLI option.🛡 What tests cover this?
I tested the option manually by adding
// eslint-disable-next-line
in a random place.yarn fix:eslint
worked equally with and without the CLI option so I only added it forlint:eslint
.