-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw an error when no matching sortOrder group (#192)
Closes #190 This adds a more understandable error message when we encounter an import that does not fit into any group within `sortOrder`. I think the only time that should happen is when the user adds groups with `<TYPES>^.....` but no fallback `<TYPES>` bucket. We could try to shove one in somewhere automatically like we do with `<THIRD_PARTY_MODULES>`, but that could be pretty confusing and I don't know where it should go in that case. This also includes a hint about how to fix the error.
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import Foo from "./bar"; | ||
import type {Justify} from "#utils" | ||
import type {React} from "React"; | ||
import type {Internal} from "./types.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {expectError} from '../../test-setup/run_spec'; | ||
|
||
expectError( | ||
__dirname, | ||
"typescript", | ||
/Could not find a matching group in importOrder for: \"React\" on line 3. Did you forget to include \"<TYPES>\"\?$/, | ||
{ | ||
importOrder: ['^[./]', '<TYPES>^#utils$', '<TYPES>[.]'], | ||
importOrderParserPlugins: ['typescript'], | ||
} | ||
); |