Closed soullivaneuh closed 4 years ago
Now that import type
exists, why not use that?
Either way, no-unused-vars
is an eslint core rule, and not part of this plugin.
@ljharb
Now that
import type
exists, why not use that?
Not sure what do you mean by that. May you provide an example?
Either way,
no-unused-vars
is an eslint core rule, and not part of this plugin.
Well, is was thinking it's related to react specific usage like this rule: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
Maybe I'm wrong?
Thanks.
This is weird, I tested my config against a main.ts
file (so not managed by the plugin):
import { Bar } from 'bar';
interface Thing {
foo: Bar;
}
And I don't have this king of error.
Ok you was right, this was a typescript plugin issue, adding this rule solve the problem:
'@typescript-eslint/no-unused-vars': ['error', {
args: 'none',
}],
Thanks for your help. But I'm curious about our first suggestion for import type
. May you add some details?
Yes, TS 3.8 has import type
for importing types, which means you can reserve import
only for value-space imports. It's much clearer and should have been the only way to import types since TS's inception, but at least now they've fixed their mistake.
With the following react-native typescript code block:
I have the following false positive error:
I setup the config for react using the
overrides
section (I have a global and generic configuration, not only for react):But the bug happens also with a global configuration.
It looks like the plugin is not working with import used on interfaces.
Note that you may see the full configuration on this Pretty project MR: https://gitlab.com/nexylan/pretty/-/merge_requests/71