lydell / eslint-plugin-simple-import-sort

Easy autofixable import sorting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: relative side-effect imports are placed before relative imports

so1ve opened this issue · comments

commented

Consider the following code:

import "./c.css";

import {} from "./vue.vue";

With this group:

[
  // Node.js builtins prefixed with `node:`.
  ["^node:"],
  // Packages.
  // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
  ["^@?\\w"],
  // Absolute imports and other imports such as Vue-style `@/foo`.
  // Anything not matched in another group.
  ["^"],
  // Relative imports.
  // Anything that starts with a dot.
  ["^\\."],
  // Side effect imports.
  ["^\\u0000"],
];

The current code is what simple-import-sort wants, but not the ideal output. I'm not sure what I can do to fix, sorry for disturbing TuT

Hi!

With the groups you posted, the output is like this for me:

import {} from "./vue.vue";

import "./c.css";
commented

Thanks for your reply!

That's my fault. I only changed the default group in source code, but not the groups in eslintrc 😅