1- import globals from "globals" ;
21import eslintJs from "@eslint/js" ;
32import eslintConfigPrettier from "eslint-config-prettier/flat" ;
3+ import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort" ;
4+ import globals from "globals" ;
45import tseslint from "typescript-eslint" ;
56
67export default tseslint . config (
@@ -11,6 +12,9 @@ export default tseslint.config(
1112 languageOptions : {
1213 globals : { ...globals . builtin , ...globals . node } ,
1314 } ,
15+ plugins : {
16+ "simple-import-sort" : eslintPluginSimpleImportSort ,
17+ } ,
1418 rules : {
1519 "@typescript-eslint/no-namespace" : "off" ,
1620 "@typescript-eslint/no-non-null-assertion" : "off" ,
@@ -20,6 +24,33 @@ export default tseslint.config(
2024 { fixStyle : "inline-type-imports" } ,
2125 ] ,
2226 "no-constant-condition" : [ "error" , { checkLoops : false } ] ,
27+
28+ "simple-import-sort/imports" : [
29+ "error" ,
30+ {
31+ groups : [
32+ // https://github.com/lydell/eslint-plugin-simple-import-sort/blob/20e25f3b83c713825f96b8494e2091e6600954d6/src/imports.js#L5-L19
33+ // Side effect imports.
34+ [ String . raw `^\u0000` ] ,
35+ // Remove blank lines between groups
36+ // https://github.com/lydell/eslint-plugin-simple-import-sort#how-do-i-remove-all-blank-lines-between-imports
37+ [
38+ // Node.js builtins prefixed with `node:`.
39+ "^node:" ,
40+ // Packages.
41+ // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
42+ String . raw `^@?\w` ,
43+ // Absolute imports and other imports such as Vue-style `@/foo`.
44+ // Anything not matched in another group.
45+ "^" ,
46+ // Relative imports.
47+ // Anything that starts with a dot.
48+ String . raw `^\.` ,
49+ ] ,
50+ ] ,
51+ } ,
52+ ] ,
53+ "simple-import-sort/exports" : "error" ,
2354 } ,
2455 } ,
2556 { ignores : [ "lib/" , ".yarn/" ] } ,
0 commit comments