diff --git a/README.md b/README.md index 1ba8a42..5d2a391 100644 --- a/README.md +++ b/README.md @@ -393,9 +393,9 @@ Each `import` is matched against _all_ regexes on the `from` string. The import Imports that don’t match any regex are grouped together last. -Side effect imports have `\u0000` prepended to their `from` string. You can match them with `"^\\u0000"`. +Side effect imports have `\u0000` _prepended_ to their `from` string (starts with `\u0000`). You can match them with `"^\\u0000"`. -Type imports have `\u0000` appended to their `from` string. You can match them with `"\\u0000$"` – but you probably need more than that to avoid them also being matched by other groups. +Type imports have `\u0000` _appended_ to their `from` string (ends with `\u0000`). You can match them with `"\\u0000$"` – but you probably need more than that to avoid them also being matched by other groups. The inner arrays are joined with one newline; the outer arrays are joined with two (creating a blank line). diff --git a/examples/.eslintrc.js b/examples/.eslintrc.js index 6c50581..ab4c7fa 100644 --- a/examples/.eslintrc.js +++ b/examples/.eslintrc.js @@ -126,7 +126,7 @@ module.exports = { "error", { // The default grouping, but with type imports first as a separate group. - groups: [["\u0000$"], ["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."]], + groups: [["^.*\\u0000$"], ["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."]], }, ], }, @@ -139,7 +139,7 @@ module.exports = { "error", { // The default grouping, but with type imports last as a separate group. - groups: [["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."], ["^.+\u0000$"]], + groups: [["^\\u0000"], ["^@?\\w"], ["^"], ["^\\."], ["^.+\\u0000$"]], }, ], }, @@ -154,7 +154,7 @@ module.exports = { // The default grouping, but with type imports first as a separate // group, sorting that group like non-type imports are grouped. groups: [ - ["^@?\\w.*\\u0000$", "\\u0000$", "^\\..*\\u0000$"], + ["^@?\\w.*\\u0000$", "^[^.].*\\u0000$", "^\\..*\\u0000$"], ["^\\u0000"], ["^@?\\w"], ["^"], diff --git a/test/__snapshots__/examples.test.js.snap b/test/__snapshots__/examples.test.js.snap index c15ce39..20c3387 100644 --- a/test/__snapshots__/examples.test.js.snap +++ b/test/__snapshots__/examples.test.js.snap @@ -140,12 +140,12 @@ import type { Page } from "./page"; import type { Css } from "./styles"; import type { Config } from "/config"; import type { AppRouter } from "@/App"; +import type { Story } from "@storybook/react"; import type { Component } from "react"; import type { Store } from "redux"; import "./polyfills"; -import type { Story } from "@storybook/react"; import { storiesOf } from "@storybook/react"; import react from "react";