quick-lint / quick-lint-js

quick-lint-js finds bugs in JavaScript programs
https://quick-lint-js.com
GNU General Public License v3.0
1.55k stars 192 forks source link

config: ignore specific rules #1174

Closed KraXen72 closed 10 months ago

KraXen72 commented 10 months ago

i couldn't find a way to supress specific error codes in https://quick-lint-js.com/config/. Due to https://github.com/quick-lint/quick-lint-js/issues/1172, i want to supress https://quick-lint-js.com/errors/E0214/

vegerot commented 10 months ago

I think you would rather have a config file like

// quick-lint-js.config
{
  "globals": {
    "VtourInfoDB": {"writable": false}
  }
}

. imo telling me about undeclared types is one of quick-lint's key features since this often means a typo in a type name

KraXen72 commented 10 months ago

typescript already tells you about undeclared types, no? also, as it currently is, quick-lint doesen't resolve some global types (see other issue), so there are a bunch of false positives

strager commented 10 months ago

typescript already tells you about undeclared types, no?

Yes, this is correct.

You can use quick-lint-js on TypeScript code without using TypeScript's compiler.

i couldn't find a way to supress specific error codes in https://quick-lint-js.com/config/. Due to https://github.com/quick-lint/quick-lint-js/issues/1172, i want to supress https://quick-lint-js.com/errors/E0214/

To suppress this warning, use the literally-anything global group in your quick-lint-js.config file:

{
  "global-groups": ["literally-anything"]
}

The documentation mentions that literally-anything suppresses some diagnostics, but it doesn't mention E0214. It does suppress E0214. I'll fix the documentation.

Let me know if setting "global-groups": ["literally-anything"] works for you.

strager commented 10 months ago

I improved the documentation a bit in commit 5bd592ecafb6e367626045bb9a27085d141cde10.

KraXen72 commented 10 months ago

i'll test it, thanks. but i'm not a huge fan of suppressing some bigger group of warnings that i might not need to supress. this is a good workaround until one of the solutions in the other issue gets implemented.

vegerot commented 10 months ago

Can't .d.ts files declare global variables too? In that case, how is literally-anything different from what you want?

strager commented 10 months ago

i'm not a huge fan of suppressing some bigger group of warnings that i might not need to supress.

I understand. quick-lint-js takes a different approach to suppression than ESLint.

Using globals and global-groups is how you suppress this kind of warning.

KraXen72 commented 10 months ago

okay, thanks. i'll check out the improved docs.