sort-imports rule could allow grouping
See original GitHub issueWhat rule do you want to change?
We like to group imports by what’s an external dependency versus what is in our application. It would be nice if the sort-imports
allowed for groupings with a blank line in between.
Does this change cause the rule to produce more or fewer warnings? Fewer, I think.
How will the change be implemented? (New option, new default behavior, etc.)?
New option, something like allow-grouping
or sort-within-groups
. Maybe default as well, but not necessary.
Please provide some example code that this change will affect:
import React from 'react';
import {shallow} from 'enzyme';
import PagesList from 'js/admin/pages/components/list';
What does the rule currently do for this code?
It complains about sort order, as import PagesList
should be above import React
.
What will the rule do after it’s changed? It will allow for groups of imports separated by blank lines and run on each group separately.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:10 (8 by maintainers)
Alright, @platinumazure, I’ve updated the description.
The last would be great, but the second one is what I had imagined. Basically I’d like for the rule to enforce sorting within groupings, but not across them. Enforcing grouping based on what is local vs external seems like potentially an entirely different rule. I’ll update a little later with the template.