sort-imports should treat single import of multiple style as "multiple" type
See original GitHub issueWhat version of ESLint are you using? HEAD
What rule do you want to change?
sort-imports
What code should no longer be flagged as incorrect with this change?
import * as bar from 'bar.js';
import { a } from 'foo';
What happens when the rule is applied to this code now?
X:Y error Imports should be sorted alphabetically
Root cause
The rule uses node.specifiers.length
to determine if an import is of type multiple
or single
. The bug is that imports of multiple
-style with a single import (import { a } from 'foo';
) are treated as single
.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Expected 'multiple' syntax before 'single' syntax - Stack Overflow
Both import { getModule } from 'vuex-module-decorators'; and import { INavs } from '@/types'; are only importing a single named export. That ...
Read more >Configuration options for isort
If you want to skip multiple files you should specify twice: --skip file1 --skip file2. Values can be file names, directory names or...
Read more >sort-imports - Visual Studio Marketplace
Use a different style or parser. Styles (and parsers) can be configured on a per-project basis including support for different types of files...
Read more >Optimize Imports in WebStorm - The JetBrains Blog
It merges multiple imports from the same file. It can sort imports – and members inside them – by module name. To run...
Read more >Configuration · Scalafmt - Scalameta
When this parameter is disabled, no indentation is added for same-line single-arg cases; the assumption is that if the argument expression spans multiple...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@LegNeato thanks for your patience and for putting together that repro. I’m getting the same results now.
Before I consider the bug verified and accept the issue, are we comfortable treating the “single” option as a synonym for default imports and the “multiple” option as a synonym for named imports?
If accepted as stated, this would be a semver-minor change, as it could result in more errors in the following case:
Currently, the above case does not error. After this change, it would warn.
I’m closing this issue because it looks like consensus couldn’t be reached. While we wish we could accommodate all requests, we have limited resources and do need to prioritize. We’ve found that issues failing to reach consensus after 21 days tend to never reach consensus, and as a team have decided to close such issues. This doesn’t mean the idea isn’t interesting or valuable, only that it’s not something the team can commit to at the moment.