mskelton / eslint-plugin-sort

Auto-fixable sort rules for ESLint.
https://www.npmjs.com/package/eslint-plugin-sort
ISC License
24 stars 1 forks source link

`sort/imports` side-effect group internal ordering #24

Closed seanblonien closed 2 years ago

seanblonien commented 2 years ago

As far as I understand the documentation for the sort/imports rule, each group's "order" property is for ordering the groups between each other, but it has nothing to do with how each group is internally ordered.

Right now I have side effect files (CSS files) that I need to be ordered in a specific way (changing the order in which the CSS files are imported changes how the CSS cascades/overrides each other). How can I disable the internal ordering of lines within a side-effects group, while still allowing for the top-level sorting of the side-effect group as a whole?

Right now I just disable the rule for the file which obviously works, but curious if this is configurable through the rule's options.

mskelton commented 2 years ago

Yeah, the ordering of imports within each group is alphabetical a-z which is not configurable. In my projects I've found it's very rare where side effect import order must be maintained (CSS is the exception which I tend not to use CSS files as I use CSS-in-JS or Tailwind).

I'd recommend continuing to ignore the rule for those imports that are problematic.