antfu / eslint-config

Anthony's ESLint config preset
https://eslint-config.antfu.me/
MIT License
3.81k stars 426 forks source link

CLI Option to create `/* eslint-disable */` VSCode snippets based on ruleset. #495

Closed pauliesnug closed 3 months ago

pauliesnug commented 3 months ago

Clear and concise description of the problem

There already exists a VSCode plugin similar to this, eslint-disable-snippets, however this only supports builtin rules and is out of date. The VSCode plugin simply generates a snippets.json file and adds it to the global VSCode configuration.

I want to be able to have autocomplete snippets like this based on the rules enabled in @antfu/eslint-config.

I think I can submit a preliminary PR at some point but am not sure.

Suggested solution

In the CLI module we could take the already autocompletable and auto generated RuleOptions type and simply map it to a VSCode snippets file, preferrably with a choice to add it to the .gitignore file.

We could also go one step further and generate a new RuleOptions type on runtime based on the rules that the user has actually enabled/added, as to not create unnecessary autocomplete options.

Alternative

No response

Additional context

No response

Validations

antfu commented 3 months ago

I don't understand what you are proposing. It sounds like pretty out-of-scope, as in the end, this is just a shared config but not an entire integration

pauliesnug commented 3 months ago

I don't understand what you are proposing. It sounds like pretty out-of-scope, as in the end, this is just a shared config but not an entire integration

Basically, the CLI would generate VSCode snippet autocompletion for the renamed rules/all added rules by the config. You can see the VSCode plugin that does this already, it's pretty simple, just a list of rule names which are autocompleted as part as the /* eslint-disable <rule-name> */ snippet.

Dimava commented 3 months ago

Why would you ever use it over Quick Fix? image

pauliesnug commented 3 months ago

Oh I didn't consider that... Apologies