@schoero/configs 0.0.0-beta.2 → 0.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint/imports.js +73 -58
- package/package.json +1 -1
package/eslint/imports.js
CHANGED
|
@@ -3,79 +3,94 @@ import eslintPluginImportNewlines from "eslint-plugin-import-newlines";
|
|
|
3
3
|
import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort";
|
|
4
4
|
import eslintPluginUnusedImports from "eslint-plugin-unused-imports";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
files: ["**/*.{js,jsx,cjs,mjs,ts,tsx}"],
|
|
10
|
-
plugins: {
|
|
11
|
-
"eslint-plugin-unused-imports": eslintPluginUnusedImports,
|
|
12
|
-
"eslint-plugin-import-newlines": eslintPluginImportNewlines,
|
|
13
|
-
"eslint-plugin-import": eslintPluginImport,
|
|
14
|
-
"eslint-plugin-simple-import-sort": eslintPluginSimpleImportSort
|
|
15
|
-
},
|
|
16
|
-
rules: {
|
|
17
|
-
"eslint-plugin-unused-imports/no-unused-imports": "warn",
|
|
18
|
-
"eslint-plugin-unused-imports/no-unused-vars": "off",
|
|
6
|
+
import eslintParserTypeScript from "@typescript-eslint/parser";
|
|
7
|
+
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"eslint-plugin-import/no-self-import": "warn",
|
|
24
|
-
"eslint-plugin-import/no-useless-path-segments": ["warn", { noUselessIndex: false }],
|
|
9
|
+
const importRules = {
|
|
10
|
+
"eslint-plugin-unused-imports/no-unused-imports": "warn",
|
|
11
|
+
"eslint-plugin-unused-imports/no-unused-vars": "off",
|
|
25
12
|
|
|
26
|
-
|
|
13
|
+
"eslint-plugin-import/first": "warn",
|
|
14
|
+
"eslint-plugin-import/newline-after-import": ["warn", { count: 2 }],
|
|
15
|
+
"eslint-plugin-import/no-duplicates": "warn",
|
|
16
|
+
"eslint-plugin-import/no-self-import": "warn",
|
|
17
|
+
"eslint-plugin-import/no-useless-path-segments": ["warn", { noUselessIndex: false }],
|
|
27
18
|
|
|
28
|
-
|
|
29
|
-
"eslint-plugin-simple-import-sort/imports": [
|
|
30
|
-
"warn",
|
|
31
|
-
{
|
|
32
|
-
groups: [
|
|
19
|
+
"eslint-plugin-import-newlines/enforce": ["warn", { "items": 6, "max-len": 119 }],
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
"eslint-plugin-simple-import-sort/exports": "warn",
|
|
22
|
+
"eslint-plugin-simple-import-sort/imports": ["warn", {
|
|
23
|
+
groups: [
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
// side effect imports
|
|
26
|
+
["^\\u0000"],
|
|
39
27
|
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
// node builtins
|
|
29
|
+
["^node:"],
|
|
42
30
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
["^@schoero"],
|
|
46
|
-
["^(?!node:)(.*):"],
|
|
31
|
+
// external packages
|
|
32
|
+
["^"],
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
// internal packages
|
|
35
|
+
["^@"],
|
|
36
|
+
["^@schoero"],
|
|
37
|
+
["^(?!node:)(.*):"],
|
|
50
38
|
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
// parent imports. Put `..` last
|
|
40
|
+
["^\\.\\.(?!/?.*\\u0000$)", "^\\.\\./?(?!.*\\u0000$)"],
|
|
53
41
|
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
// other relative imports. Put same-folder imports and `.` last
|
|
43
|
+
["^\\./(?=.*/)(?!/?.*\\u0000$)", "^\\.(?!/?.*\\u0000$)", "^\\./?(?!.*\\u0000$)"],
|
|
56
44
|
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
// style imports
|
|
46
|
+
["^.+\\.s?css$"],
|
|
59
47
|
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
// json imports
|
|
49
|
+
["^.+\\.jsonc?$"],
|
|
62
50
|
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
// type imports
|
|
52
|
+
["^node:(.*)\\u0000$"],
|
|
65
53
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
["^@schoero(.*)\\u0000$"],
|
|
69
|
-
["^(?!node:)(.*):(.*)\\u0000$"],
|
|
54
|
+
// types from external packages
|
|
55
|
+
["\\u0000$"],
|
|
70
56
|
|
|
71
|
-
|
|
72
|
-
|
|
57
|
+
// types from internal packages
|
|
58
|
+
["^@(.*)\\u0000$"],
|
|
59
|
+
["^@schoero(.*)\\u0000$"],
|
|
60
|
+
["^(?!node:)(.*):(.*)\\u0000$"],
|
|
73
61
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
]
|
|
79
|
-
|
|
62
|
+
// types from parent imports. Put `..` last
|
|
63
|
+
["^\\.\\.(?=/?\\u0000$)", "^\\.\\./?\\u0000$"],
|
|
64
|
+
|
|
65
|
+
// types from other relative imports. Put same-folder imports and `.` last
|
|
66
|
+
["^\\./(?=.*\\u0000$)", "^\\.(?=/?\\u0000$)", "^\\./?\\u0000$"]
|
|
67
|
+
]
|
|
68
|
+
}]
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** @type { import("eslint").Linter.FlatConfig[] } */
|
|
72
|
+
export const imports = [
|
|
73
|
+
{
|
|
74
|
+
files: ["**/*.{js,jsx,cjs,mjs}"],
|
|
75
|
+
plugins: {
|
|
76
|
+
"eslint-plugin-unused-imports": eslintPluginUnusedImports,
|
|
77
|
+
"eslint-plugin-import-newlines": eslintPluginImportNewlines,
|
|
78
|
+
"eslint-plugin-import": eslintPluginImport,
|
|
79
|
+
"eslint-plugin-simple-import-sort": eslintPluginSimpleImportSort
|
|
80
|
+
},
|
|
81
|
+
rules: importRules
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
files: ["**/*.{ts,tsx}"],
|
|
85
|
+
languageOptions: {
|
|
86
|
+
parserOptions: {
|
|
87
|
+
project: "./tsconfig.json"
|
|
88
|
+
},
|
|
89
|
+
parser: eslintParserTypeScript
|
|
90
|
+
},
|
|
91
|
+
plugins: {
|
|
92
|
+
"eslint-plugin-unused-imports": eslintPluginUnusedImports
|
|
93
|
+
},
|
|
94
|
+
rules: importRules
|
|
80
95
|
}
|
|
81
96
|
];
|
package/package.json
CHANGED