-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
[eslint-config-react-app] Can't disable rule "@typescript-eslint/no-unused-vars" in config, outside of CRA #6958
Comments
cc @mrmckeb we will need to figure out the cleanest way to extend our typescript lint rules if we decide to support custom ESLint config file. |
@estaub Having same issue. Which config object are you talking about? CRA is ignoring config files and only reading from package.json from what I understand |
@delaaxe That's correct about CRA; it's causing a lot of grief among new Typescript adopters of CRA who don't read the invisible fine print about "Typescript support". As noted in the title, I was writing about using the react-app rules outside of CRA. Both problems show an unfortunately solipsistic line of thinking about lint in this project, that has origins I can only guess at. |
solipsistic[ˌsäləpˈsistik] solipsism[ˈsäləpˌsizəm] |
For me, warnings about unused variables in a "development" environment are not useful, and actually make it more difficult to see actual issues such as missing React hook dependencies. On that note, maybe missing hook dependencies should be promoted to errors? |
I'm also facing this issue, super annoying. +1 |
This is really annoying, please get it sought out.. |
Actually this can be solved easily via putting this at the start of the file.(although we'd need to do it for all files) |
Idk why you guys have disliked my suggestion, thought i know its not a fix, but actual thing by which can be dealt easily. This works good for me though.!!! |
Because it's not a fix. It's a crappy workaround. |
There's difference between workaround and crappy workaround, that seems difficult to digest for some people. |
This comment has been minimized.
This comment has been minimized.
Am I to understand from this ticket that we can't configure typescript linting at this time? |
@hojberg , with cra4 , its 100% configurabe to use your own rules..., check it here .. https://gist.github.com/sahilrajput03/bdd1f1d686da2e919eac647c89d87310 |
@estaub , you can close this issue i guess coz with cra 4 you can definitely configure these warnings just with the specifying rules inside pakcage.json file as i mentioned in above message. |
if you are using Create-react-app, there is no need to install anything or Eject, the simple solution is: since the
|
is still there no solution for this problem? its so annoying. |
Does that work for you? |
They have created a thousand ways to do this and none of them work. Stressful. Many times the variable is not used, but I will use it later, meanwhile there is this annoying warning. |
Related
#6871
#6915
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
no-unused-vars, etc.
Environment
Steps to Reproduce
In .eslintrc.js, when
react-app
is extended, e.g.extends: ['plugin:@typescript-eslint/recommended', "react-app"],
it is impossible to disable the
@typescript-eslint/no-unused-vars
rule, e.g.,eslint is invoked at the command line using
npx eslint --ext .js,.jsx,.ts,.tsx src
No error message regarding the configuration is emitted; it simply ignores the configuration.
After reading the code, I suspect that these rules also suffer from the same petrification.
Workaround
Include this at the top level of the config object:
This workaround is probably much more verbose than is wise or necessary, but it is sufficient.
The text was updated successfully, but these errors were encountered: