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
[no-unused-vars] TypeError: context.report() called with a messageId, but no messages were present in the rule metadata. #2451
Comments
This happens because you're on ESLint v6, but the messageID we're using was released in v7. |
@bradzacher is @typescript-eslint v4.0.1 supposed to be compatible with eslint v6? I see it is included in the |
Which is why I marked this as a bug. |
Ok now I understand. I'm not too familiar with the project but I'm happy to work on a PR or provide any additional info if you can point me in the right direction. |
It's actually a super simple fix.
Has to handle the case where there are no messages defined, and default to something like the current v7 messages config: I.e. the above line becomes something like messages: baseRule.meta.messages ?? {
unusedVar: "'{{varName}}' is {{action}} but never used{{additional}}."
}, Happy to accept a PR if you want to do it! |
It looks like a lot of the other rules need to be fixed e.g. no-unused-expressions. Do you want one PR to fix them all? |
Yeah definitely. That'll be much easier to submit and merge. Go for it! |
I'm also thinking that the automated test suite should include different eslint versions in the test matrix to catch issues like this automatically. I'm looking into the best way to achieve that. |
Yeah testing old versions of things has always been a problem for us. Usually eslint isn't too much of a problem because its api and internals are pretty stable for our use case. We have an integration test for v6, but it's mostly there to make sure that we don't do any incompatible deep requires from eslint. If you can figure out a good way to do it, that'd be fantastic! |
@bradzacher I have implemented the missing messages fallbacks in #2461. I will look to improving the test configuration to support testing multiple eslint versions in a separate PR. |
@bradzacher I have implemented eslint version matrix in test runner in #2463. It is currently failing because it is based off master (which is not compatible with eslint v5 or v6 due to #2451). The tests should start to pass after it is rebased off #2461. |
@bradzacher Will you be publishing a new version including this fix in the near future? It's currently the only thing blocking us from using the new @typescript-eslint with create-react-app. |
We release every Monday morning (PST). This weekend I'm planning on fixing all of the scope analysis bugs people found in this version (see milestone), so Monday's version will be a much better version for you to upgrade CRA to. |
@bradzacher @esetnik Just for clarification I am getting this error too but it only occurs when trying to lint declaration files. If I use |
Repro
Expected Result
No crash. The same configuration and file works fine in v3.10.1
Actual Result
After upgrading to v4.0.1
Additional Info
typescript-eslint-debug.log
Versions
@typescript-eslint/eslint-plugin
4.0.1
@typescript-eslint/parser
4.0.1
TypeScript
4.0.2
ESLint
6.8.0
node
12.8.3
The text was updated successfully, but these errors were encountered: