Closed
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
module.exports = {
extends: [
'react-app',
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
rules: {
'@typescript-eslint/no-unused-vars': [1, { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'styled-components',
message: 'Please import from styled-components/macro.',
},
],
patterns: ['!styled-components/macro'],
},
],
},
};
// jest-styled-components.d.ts
declare namespace jest {
interface Matchers<R> {
toHaveStyleRule: import('jest-styled-components').jest.Matchers<
R
>['toHaveStyleRule'];
}
}
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["src", "test"],
"plugins": [
{
"name": "typescript-styled-plugin"
}
]
}
Expected Result
No crash. The same configuration and file works fine in v3.10.1
Actual Result
After upgrading to v4.0.1
TypeError: context.report() called with a messageId, but no messages were present in the rule metadata.
Occurred while linting /Users/redacted/frontend/src/types/jest-styled-components.d.ts:1
at /Users/redacted/frontend/node_modules/eslint/lib/linter/report-translator.js:317:23
at Object.report (/Users/redacted/frontend/node_modules/eslint/lib/linter/linter.js:905:41)
at TSModuleDeclaration (/Users/redacted/frontend/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js:124:33)
at /Users/redacted/frontend/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/Users/redacted/frontend/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/Users/redacted/frontend/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
at NodeEventGenerator.applySelectors (/Users/redacted/frontend/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
at NodeEventGenerator.enterNode (/Users/redacted/frontend/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
at CodePathAnalyzer.enterNode (/Users/redacted/frontend/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)
Additional Info
Versions
package | version |
---|---|
@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 |