Skip to content
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

Allow eslint.rules.customizations to target all fixable rules #1705

Closed
wants to merge 2 commits into from

Conversation

Dimava
Copy link

@Dimava Dimava commented Aug 27, 2023

Closes #1634
Related: #267 , #680

image

@Dimava
Copy link
Author

Dimava commented Aug 27, 2023

@microsoft-github-policy-service agree

- Prefix the name with a `"!"` to target all rules that _don't_ match the name: `{ "rule": "!no-*", "severity": "info" }`
- Prefix the name with a `"!"` to target all rules that _don't_ match the name: `{ "rule": "!no-*", "severity": "error" }`
- Suffix the name with `"@hasFix"` to target the errors which that have autofix available `{ "rule": "no-*@hasFix", "severity": "info" }`
- Suffix the name with `"!@hasFix"` to target the errors which that _don't_ have autofix available `{ "rule": "no-*@!hasFix", "severity": "error" }`
Copy link
Author

@Dimava Dimava Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed a "!@hasFix" typo here

- Prefix the name with a `"!"` to target all rules that _don't_ match the name: `{ "rule": "!no-*", "severity": "info" }`
- Prefix the name with a `"!"` to target all rules that _don't_ match the name: `{ "rule": "!no-*", "severity": "error" }`
- Suffix the name with `"@hasFix"` to target the errors which that have autofix available `{ "rule": "no-*@hasFix", "severity": "info" }`
- Suffix the name with `"!@hasFix"` to target the errors which that _don't_ have autofix available `{ "rule": "no-*@!hasFix", "severity": "error" }`
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a suffix on the existing rule property, how about a new property like "fixable"? The suffix is confusing me and won't scale well if more features like it are asked for, such as filtering on whether it provides suggestions or what it's meta.type is.

Proposal:

  "eslint.rules.customizations": [
    { "rule": "*", "severity": "warn", "fixable": true },
  ]

(caveat: I'm not a VS Code or vscode-eslint maintainer, just the external contributor from #1164 & stumbled onto this)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoshuaKGoldberg I actually like this a lot. I am not really happy with the !@hasFix suffix either.

sapegin added a commit to sapegin/vscode-eslint that referenced this pull request Apr 29, 2024
With the config like this:

```
"eslint.rules.customizations": [
    { "rule": "*", "fixable": true, "severity": "info" }
  ]
```

It'll downgrade all autofixable problems to the info severity.

Fixes microsoft#1634
Rel microsoft#267, microsoft#680, microsoft#655, microsoft#1705
dbaeumer pushed a commit that referenced this pull request May 6, 2024
…1841)

With the config like this:

```
"eslint.rules.customizations": [
    { "rule": "*", "fixable": true, "severity": "info" }
  ]
```

It'll downgrade all autofixable problems to the info severity.

Fixes #1634
Rel #267, #680, #655, #1705
@Dimava
Copy link
Author

Dimava commented Jul 10, 2024

Implemented in #1841

@Dimava Dimava closed this Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow eslint.rules.customizations to target all fixable rules
3 participants