So, I have this piece of code in .ts file:
import {MicroEventInterface} from '../Interfaces';
export default class MicroEvent implements MicroEventInterface {
// code
And ESLint throws this error:
I have this config for TypeScript in ESLint:
typescript: {
extends: [
'plugin:@private/private/react' // private rep with React config
],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'import'
],
settings: {
'import/resolver': {
'node': {
'extensions': [
'.js',
'.jsx',
'.ts',
'.tsx'
],
'moduleDirectory': [
'node_modules/',
'src/'
]
}
},
react: {
createClass: 'createClass',
pragma: 'React',
version: '0.14.9'
}
}
}
So, everything seems like fine, but I can't conquer this error.
Any suggestions?
Thanks!
UPD:
Looks like if I console.log(
--- , MicroEventInterface);
error disappears. I think, ESLint does not treat implements
as actual usage.
Source: I am the maintainer of the typescript-eslint
project.
The latest version of the @typescript-eslint
tooling now has full support for scope analysis.
So the steps to fix this are now:
@typescript-eslint/parser
and @typescript-eslint/eslint-plugin
@typescript-eslint/no-unused-vars
no-unused-vars
rule - see this FAQ article in the project.Restart your IDE and you should now see the correct lint errors.