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
[Fix] no-extraneous-dependencies
/TypeScript: do not error when importing type from dev dependencies
#1820
[Fix] no-extraneous-dependencies
/TypeScript: do not error when importing type from dev dependencies
#1820
Conversation
@ljharb please can you review? :) |
1 similar comment
…rting type from dev dependencies Fixes #1618.
], | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry about that one.
Would it be a good idea to add https://eslint.org/docs/rules/eol-last to the eslint config of the project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would, thanks; i'll do that.
|
||
describe('TypeScript', function () { | ||
getTSParsers() | ||
.filter((parser) => parser !== require.resolve('typescript-eslint-parser')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why filter this one out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typescript-eslint-parser
is the old parser and doesn't support the importKind
property. That parser was not done at the time of typescript 3.8 which is the one that supports this feature
I've added it back with the cases as all invalid.
no-extraneous-dependencies
/TypeScript: do not error when importing type from dev dependencies
Awesome, was just coming to ask if this was potentially possible - thanks for your work on this @fernandopasik ! Looking forward to this being released. |
TIL: importing just typescript types using the keyword `import type` the eslint `no-extraneous-dependencies` does not get applied. I might be misusing it in this case. import-js/eslint-plugin-import#1820
@fernandopasik // works
import type { Foo } from "types-package";
// doesn't work yet
import { type Foo } from "types-package". |
Hey @AndyOGo ! Thanks, I think typescript introduced those after this PR |
@fernandopasik I admire your work. |
😳 You must mean you only admire @ljharb work, he's the only legend there thank you! 🙇♂️ |
Of course, I admire @ljharb bombastic work a lot. In general I admire people who seek to understand semantics, to help and make contributions. So, I admire both of you. |
fixes #1618
This PR is to avoid error
should be listed in the project's dependencies, not devDependencies.
when only importing typescript types