11.0.0-beta.0 - Typescript interface/type no-undef error
prudolfs opened this issue · comments
babel-eslint starting with version 11 uses babel config. That's great because now it possible to use babel-eslint with @babel/preset-typescript. AFAIK @babel/preset-typescript just strips away typescript types. However, running lint does not work for typescript interfaces/types because it throws no-undef error. Simple example how to reproduce will throw 5 error
* 5:18 error 'IValue' is not defined no-undef
* 6:3 error 'a' is not defined no-undef
* 7:3 error 'b' is not defined no-undef
* 10:13 error 'Value' is not defined no-undef
* 10:21 error 'IValue' is not defined no-undef
The link you shared is not public but I probably have the very same error:
type Foo = 'string';
const foo: Foo = 'foo';
results in an error:
1:6 error 'Foo' is not defined no-undef
Any change to get babel-eslint to understand things like type
or interface
?
Running into the same issue... Has anyone found any workaround by any chance?
Yes. I'm using @typescript-eslint parser for .ts and .tsx files and disabled no-undef
in TypeScript files as undefined variables are covered by TypeScript anyway:
https://github.com/wiremore/eslint-config-wiremore/blob/master/typescript.js
Works fine for me!
Also running into this issue. Would rather not turn off no-undef
or switch to typescript-elint
instead of babel-eslint
+ @babel/preset-typescript
This seems maybe related: https://github.com/typescript-eslint/typescript-eslint#what-about-babel-and-babel-eslint.
Thank you for the issue. Now that @babel/eslint-parser
has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.