-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Introduce a way to suppress violations #119
base: main
Are you sure you want to change the base?
Changes from 2 commits
a99c456
f9b3976
c9a718c
4d73750
9e035f1
ed01be1
d5411af
98779dc
b343ddb
ad5343d
485f684
70a7c56
4462ce6
1a1cbba
71ee661
2d4dc84
dc2d940
b8a1cf7
0c3d9a4
4fea00e
42d8b95
bff622d
48e9d0a
46cf6ae
a94a50d
861f1a4
566e3b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -59,10 +59,10 @@ eslint --suppress-all ./src | |||||
|
||||||
### Suppressing violations of a specific rule | ||||||
|
||||||
A new option `--suppress-rule [RULE1]` will be introduced to ESLint CLI. When provided, the existing suppressions file will be updated to include any existing violation of the provided rule. The suppressions file will be created if not already exists. Note that this is a string flag option (value is required). | ||||||
A new option `--suppress-rule [RULE1]` will be introduced to ESLint CLI. When provided, the existing suppressions file will be updated to include any existing violation of the provided rule. The suppressions file will be created if not already exists. Note that this is option can accept an array of string values. | ||||||
|
||||||
``` bash | ||||||
eslint --suppress-rule '@typescript-eslint/no-explicit-any' ./src | ||||||
eslint --suppress-rule '@typescript-eslint/no-explicit-any' --suppress-rul '@typescript-eslint/member-ordering' ./src | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
### Changing the location of the suppressions file | ||||||
|
@@ -84,7 +84,7 @@ Consider the following scenario: | |||||
* After fixing a violation, the suppressions file still contains the now-resolved violation. | ||||||
* Running `eslint ./src` again reports no violations but exits with a non-zero status code, indicating the suppressions file needs updating. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, will there be an error message, and what would it look like? Technically, will it be a lint message passed to the formatter along with other lint messages for the file, or a separate output? |
||||||
|
||||||
To address this, a new option `--prune-suggestions` will be introduced to ESLint. This boolean flag removes resolved violations from the suppressions file without adding new ones, unlike `--suppress-all`. | ||||||
To address this, a new option `--prune-suppressions` will be introduced to ESLint. This boolean flag removes resolved violations from the suppressions file without adding new ones, unlike `--suppress-all`. | ||||||
|
||||||
``` bash | ||||||
eslint --prune-suppressions ./src | ||||||
|
@@ -158,10 +158,10 @@ class SuppressedViolationsManager { | |||||
* Updates the suppressions file based on the current violations and the provided rule. | ||||||
* | ||||||
* @param {LintResult[]} results The lint results. | ||||||
* @param {string} rule The rule to suppress. | ||||||
* @param {string[]} rules The rules to suppress. | ||||||
* @returns {void} | ||||||
*/ | ||||||
suppressByRule(results, rule) | ||||||
suppressByRule(results, rules) | ||||||
softius marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
/** | ||||||
* Removes old suppressions that do not occur anymore. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.