We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
"import/no-duplicates": ["error", { "prefer-inline": true }],
Will detect an error in the following typescript code:
import type { X } from "xyz"; import "xyz"; // [...]
It will auto-fix by removing the import "xyz"; statement. This is not the desired behavior. I would expect it to stay as is.
import "xyz";
Merry Christmas 🎄
The text was updated successfully, but these errors were encountered:
I would expect prefer-inline: true to require import { type X } from 'xyz'; for the first line; does it not?
prefer-inline: true
import { type X } from 'xyz';
For the second line, I assume this is because xyz is side-effecting, and you want to ensure type-stripping leaves the evaluation intact?
xyz
Sorry, something went wrong.
It does not require import { type X } from 'xyz';. It does prefer mixed imports over one import for types and a separate one for named runtime.
import { abc } from "xyz"; import type { X } from "xyz";
would be changed to
import { abc, type X } from "xyz";
but if no named runtime imports exist, it won't touch import type ... declarations (which is consistent with typescript verbatimModuleSyntax).
import type ...
verbatimModuleSyntax
Precisely.
FYI, the style I'm aiming for with all the relevant rules:
@typescript-eslint/consistent-type-imports
import/no-duplicates { "prefer-inline": true }
import type {...}
@typescript-eslint/no-import-type-side-effects
import "..."
eslint-disable
Personally, I think this is a perfect solution to clean imports. Especially, if combined with import/order to group import type separately.
import/order
import type
No branches or pull requests
Will detect an error in the following typescript code:
It will auto-fix by removing the
import "xyz";
statement. This is not the desired behavior. I would expect it to stay as is.Merry Christmas 🎄
The text was updated successfully, but these errors were encountered: