@keeex/eslint-config 1.12.5 → 2.0.0
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/LICENSE +1 -1
- package/README.md +97 -150
- package/package.json +75 -41
- package/src/bin/kxeslint-dump.js +16 -0
- package/src/bin/kxeslint-setup.js +111 -0
- package/src/config/base.js +168 -254
- package/src/config/globals.js +42 -0
- package/src/config/importx.js +104 -0
- package/src/config/lazy.js +8 -0
- package/src/config/mocha.js +32 -47
- package/src/config/react/reacthooks.js +12 -0
- package/src/config/react/reactnative.js +26 -0
- package/src/config/react.js +74 -0
- package/src/config/reactfullconfig.js +16 -0
- package/src/config/typescript.js +88 -340
- package/src/defaults.js +41 -0
- package/src/dependencies.js +183 -0
- package/src/environ.js +7 -0
- package/src/index.js +66 -299
- package/src/sections.js +61 -0
- package/src/bin/eslint-depcheck.js +0 -103
- package/src/config/common.js +0 -7
- package/src/config/deprecation.js +0 -8
- package/src/config/import.js +0 -63
- package/src/config/jsx.js +0 -128
- package/src/config/promise.js +0 -9
- package/src/config/reacthooks.js +0 -8
- package/src/config/reactnative.js +0 -19
- package/src/config/typescript_types.js +0 -27
- package/src/consts.js +0 -1
package/src/config/base.js
CHANGED
|
@@ -1,256 +1,170 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
maxNestedCallbacks,
|
|
5
|
-
maxStatements,
|
|
6
|
-
} = require("./common.js");
|
|
1
|
+
/* eslint-disable no-magic-numbers */
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import pluginPromise from "eslint-plugin-promise";
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"error",
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
"
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"warn",
|
|
174
|
-
{
|
|
175
|
-
"skipBlankLines": true,
|
|
176
|
-
"skipComments": true,
|
|
177
|
-
"IIFEs": true,
|
|
178
|
-
},
|
|
179
|
-
],
|
|
180
|
-
"max-nested-callbacks": ["warn", maxNestedCallbacks],
|
|
181
|
-
"max-statements": ["warn", maxStatements],
|
|
182
|
-
"max-statements-per-line": ["warn"],
|
|
183
|
-
"new-parens": ["error"],
|
|
184
|
-
"newline-per-chained-call": ["error"],
|
|
185
|
-
"no-array-constructor": ["warn"],
|
|
186
|
-
"no-lonely-if": ["warn"],
|
|
187
|
-
"no-mixed-operators": ["warn"],
|
|
188
|
-
"no-multi-assign": ["error"],
|
|
189
|
-
"no-multiple-empty-lines": ["error", {max: 1, maxBOF: 0, maxEOF: 0}],
|
|
190
|
-
"no-negated-condition": ["warn"],
|
|
191
|
-
"no-nested-ternary": ["error"],
|
|
192
|
-
"no-new-object": ["error"],
|
|
193
|
-
"no-tabs": ["error"],
|
|
194
|
-
"no-trailing-spaces": ["error"],
|
|
195
|
-
"no-unneeded-ternary": ["warn"],
|
|
196
|
-
"no-whitespace-before-property": ["error"],
|
|
197
|
-
"object-curly-newline": [
|
|
198
|
-
"error",
|
|
199
|
-
{"multiline": true},
|
|
200
|
-
],
|
|
201
|
-
"object-curly-spacing": ["error"],
|
|
202
|
-
"object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
|
|
203
|
-
"operator-assignment": ["warn"],
|
|
204
|
-
"operator-linebreak": ["error", "before"],
|
|
205
|
-
"padded-blocks": ["error", "never"],
|
|
206
|
-
"prefer-exponentiation-operator": ["error"],
|
|
207
|
-
"prefer-object-spread": ["error"],
|
|
208
|
-
"quote-props": ["error", "consistent"],
|
|
209
|
-
"quotes": ["error"],
|
|
210
|
-
"semi": ["error"],
|
|
211
|
-
"semi-spacing": ["error"],
|
|
212
|
-
"semi-style": ["error"],
|
|
213
|
-
"space-before-blocks": ["error"],
|
|
214
|
-
"space-before-function-paren": [
|
|
215
|
-
"error",
|
|
216
|
-
{
|
|
217
|
-
"anonymous": "never",
|
|
218
|
-
"named": "never",
|
|
219
|
-
"asyncArrow": "always",
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
"space-in-parens": ["error"],
|
|
223
|
-
"space-infix-ops": ["error"],
|
|
224
|
-
"space-unary-ops": [
|
|
225
|
-
"error",
|
|
226
|
-
{
|
|
227
|
-
"words": true,
|
|
228
|
-
"nonwords": false,
|
|
229
|
-
},
|
|
230
|
-
],
|
|
231
|
-
"spaced-comment": ["error"],
|
|
232
|
-
"switch-colon-spacing": ["error"],
|
|
233
|
-
"template-tag-spacing": ["error"],
|
|
234
|
-
"unicode-bom": ["error"],
|
|
235
|
-
"arrow-body-style": ["error"],
|
|
236
|
-
"arrow-parens": ["error", "as-needed"],
|
|
237
|
-
"arrow-spacing": ["error"],
|
|
238
|
-
"generator-star-spacing": ["error", "after"],
|
|
239
|
-
"no-duplicate-imports": ["error"],
|
|
240
|
-
"no-useless-computed-key": ["error"],
|
|
241
|
-
"no-useless-constructor": ["warn"],
|
|
242
|
-
"no-useless-rename": ["error"],
|
|
243
|
-
"no-var": ["error"],
|
|
244
|
-
"object-shorthand": ["error"],
|
|
245
|
-
"prefer-arrow-callback": ["warn"],
|
|
246
|
-
"prefer-const": ["warn"],
|
|
247
|
-
"prefer-numeric-literals": ["error"],
|
|
248
|
-
"prefer-rest-params": ["warn"],
|
|
249
|
-
"prefer-spread": ["error"],
|
|
250
|
-
"prefer-template": ["error"],
|
|
251
|
-
"rest-spread-spacing": ["error"],
|
|
252
|
-
"symbol-description": ["warn"],
|
|
253
|
-
"template-curly-spacing": ["error"],
|
|
254
|
-
"yield-star-spacing": ["error"],
|
|
255
|
-
},
|
|
5
|
+
import * as sections from "../sections.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Apply the recommended eslint configuration plus KeeeX tweaks.
|
|
9
|
+
*
|
|
10
|
+
* @param configResult - The eslint configuration object currently being built.
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line max-lines-per-function
|
|
13
|
+
export const apply = (configResult, eslintConfig) => {
|
|
14
|
+
// Basic options
|
|
15
|
+
const sharedSection = sections.getNamedSection(configResult, "keeex/shared");
|
|
16
|
+
sections.sectionAddOption(sharedSection, "linterOptions", "reportUnusedDisableDirectives", true);
|
|
17
|
+
sections.sectionAddOption(sharedSection, "languageOptions", "ecmaVersion", "latest");
|
|
18
|
+
sections.sectionAddOption(sharedSection, "languageOptions", "sourceType", "module");
|
|
19
|
+
sections.sectionAddOption(
|
|
20
|
+
sharedSection,
|
|
21
|
+
"languageOptions",
|
|
22
|
+
"parserOptions",
|
|
23
|
+
{
|
|
24
|
+
ecmaFeatures: eslintConfig.react ? {jsx: true} : undefined,
|
|
25
|
+
ecmaVersion: "latest",
|
|
26
|
+
sourceType: "module",
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
// Global ignores
|
|
30
|
+
if (eslintConfig.ignores.length > 0) {
|
|
31
|
+
const globalIgnores = sections.getNamedSection(configResult, "keeex/ignores");
|
|
32
|
+
globalIgnores.ignores = [...eslintConfig.ignores];
|
|
33
|
+
}
|
|
34
|
+
// Base eslint
|
|
35
|
+
configResult.push(js.configs.recommended);
|
|
36
|
+
const eslintCustom = sections.getNamedSection(configResult, "keeex/eslint-override");
|
|
37
|
+
sections.configureRules(
|
|
38
|
+
eslintCustom,
|
|
39
|
+
"",
|
|
40
|
+
{
|
|
41
|
+
"array-callback-return": "error",
|
|
42
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
43
|
+
"block-scoped-var": "warn",
|
|
44
|
+
"camelcase": "warn",
|
|
45
|
+
"class-methods-use-this": ["warn", {exceptMethods: ["render"]}],
|
|
46
|
+
"complexity": ["warn", {max: 25, variant: "modified"}],
|
|
47
|
+
"curly": ["error", "multi-line"],
|
|
48
|
+
"eqeqeq": "warn",
|
|
49
|
+
"func-style": "error",
|
|
50
|
+
"guard-for-in": "warn",
|
|
51
|
+
"max-classes-per-file": "error",
|
|
52
|
+
"max-depth": ["warn", 5],
|
|
53
|
+
"max-lines": ["warn", {max: 1000, skipBlankLines: true, skipComments: true}],
|
|
54
|
+
"max-lines-per-function": [
|
|
55
|
+
"warn",
|
|
56
|
+
{IIFEs: true, max: 60, skipBlankLines: true, skipComments: true},
|
|
57
|
+
],
|
|
58
|
+
"max-nested-callbacks": ["warn", 6],
|
|
59
|
+
"max-params": ["warn", {max: 5}],
|
|
60
|
+
"no-alert": "error",
|
|
61
|
+
"no-array-constructor": "error",
|
|
62
|
+
"no-await-in-loop": "warn",
|
|
63
|
+
"no-caller": "error",
|
|
64
|
+
"no-console": "warn",
|
|
65
|
+
"no-constant-condition": "warn",
|
|
66
|
+
"no-constructor-return": "error",
|
|
67
|
+
"no-delete-var": "error",
|
|
68
|
+
"no-div-regex": "warn",
|
|
69
|
+
"no-duplicate-imports": "error",
|
|
70
|
+
"no-else-return": "warn",
|
|
71
|
+
"no-eq-null": "error",
|
|
72
|
+
"no-eval": "error",
|
|
73
|
+
"no-extend-native": "error",
|
|
74
|
+
"no-extra-bind": "error",
|
|
75
|
+
"no-extra-label": "warn",
|
|
76
|
+
"no-global-assign": "error",
|
|
77
|
+
"no-implicit-coercion": "warn",
|
|
78
|
+
"no-implied-eval": "error",
|
|
79
|
+
"no-invalid-this": "error",
|
|
80
|
+
"no-irregular-whitespace": [
|
|
81
|
+
"error",
|
|
82
|
+
{
|
|
83
|
+
skipComments: true,
|
|
84
|
+
skipJSXText: true,
|
|
85
|
+
skipRegExps: true,
|
|
86
|
+
skipStrings: true,
|
|
87
|
+
skipTemplates: true,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
"no-iterator": "error",
|
|
91
|
+
"no-label-var": "error",
|
|
92
|
+
"no-lonely-if": "warn",
|
|
93
|
+
"no-loop-func": "warn",
|
|
94
|
+
"no-magic-numbers": [
|
|
95
|
+
"warn",
|
|
96
|
+
{
|
|
97
|
+
ignore: [1, -1, "1n", "-1n", 0, "0n"],
|
|
98
|
+
ignoreClassFieldInitialValues: true,
|
|
99
|
+
ignoreDefaultValues: true,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
"no-multi-assign": "error",
|
|
103
|
+
"no-negated-condition": "warn",
|
|
104
|
+
"no-nested-ternary": "error",
|
|
105
|
+
"no-new-func": "error",
|
|
106
|
+
"no-new-wrappers": "error",
|
|
107
|
+
"no-object-constructor": "error",
|
|
108
|
+
"no-param-reassign": "warn",
|
|
109
|
+
"no-promise-executor-return": "error",
|
|
110
|
+
"no-proto": "error",
|
|
111
|
+
"no-return-assign": "error",
|
|
112
|
+
"no-script-url": "error",
|
|
113
|
+
"no-self-compare": "warn",
|
|
114
|
+
"no-sequences": "warn",
|
|
115
|
+
"no-shadow": "warn",
|
|
116
|
+
"no-shadow-restricted-names": "error",
|
|
117
|
+
"no-throw-literal": "error",
|
|
118
|
+
"no-undef-init": "warn",
|
|
119
|
+
"no-unmodified-loop-condition": "warn",
|
|
120
|
+
"no-unneeded-ternary": "warn",
|
|
121
|
+
"no-unreachable-loop": "warn",
|
|
122
|
+
"no-unused-expressions": "warn",
|
|
123
|
+
"no-use-before-define": "warn",
|
|
124
|
+
"no-useless-assignment": "warn",
|
|
125
|
+
"no-useless-call": "error",
|
|
126
|
+
"no-useless-computed-key": "warn",
|
|
127
|
+
"no-useless-concat": "warn",
|
|
128
|
+
"no-useless-constructor": "warn",
|
|
129
|
+
"no-useless-rename": "warn",
|
|
130
|
+
"no-useless-return": "warn",
|
|
131
|
+
"no-var": "error",
|
|
132
|
+
"no-void": ["error", {allowAsStatement: true}],
|
|
133
|
+
"one-var": ["warn", "never"],
|
|
134
|
+
"prefer-arrow-callback": "warn",
|
|
135
|
+
"prefer-const": ["warn", {ignoreReadBeforeAssign: true}],
|
|
136
|
+
"prefer-exponentiation-operator": "warn",
|
|
137
|
+
"prefer-named-capture-group": "warn",
|
|
138
|
+
"prefer-numeric-literals": "warn",
|
|
139
|
+
"prefer-object-has-own": "warn",
|
|
140
|
+
"prefer-object-spread": "warn",
|
|
141
|
+
"prefer-promise-reject-errors": "error",
|
|
142
|
+
"prefer-regex-literals": "warn",
|
|
143
|
+
"prefer-rest-params": "error",
|
|
144
|
+
"prefer-spread": "error",
|
|
145
|
+
"prefer-template": "warn",
|
|
146
|
+
"radix": ["warn", "as-needed"],
|
|
147
|
+
"require-atomic-updates": "warn",
|
|
148
|
+
"require-await": "warn",
|
|
149
|
+
"require-unicode-regexp": "warn",
|
|
150
|
+
"sort-imports": ["warn", {ignoreCase: true, allowSeparatedGroups: true}],
|
|
151
|
+
"sort-keys": ["warn", "asc", {caseSensitive: false, minKeys: 3, natural: true}],
|
|
152
|
+
"symbol-description": "error",
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
// Promises
|
|
156
|
+
configResult.push(pluginPromise.configs["flat/recommended"]);
|
|
157
|
+
const promiseCustom = sections.getNamedSection(configResult, "keeex/promise-override");
|
|
158
|
+
sections.configureRules(
|
|
159
|
+
promiseCustom,
|
|
160
|
+
"promise",
|
|
161
|
+
{
|
|
162
|
+
"avoid-new": "warn",
|
|
163
|
+
"no-multiple-resolved": "error",
|
|
164
|
+
"no-promise-in-callback": "warn",
|
|
165
|
+
"prefer-await-to-callbacks": "warn",
|
|
166
|
+
"prefer-await-to-then": "warn",
|
|
167
|
+
"spec-only": "error",
|
|
168
|
+
},
|
|
169
|
+
);
|
|
256
170
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
|
|
3
|
+
import * as sections from "../sections.js";
|
|
4
|
+
|
|
5
|
+
const base = {builtin: true, es2025: true};
|
|
6
|
+
|
|
7
|
+
/** Create the actual eslint globals object from user input */
|
|
8
|
+
const getGlobalsFromConfig = configGlobals => {
|
|
9
|
+
const res = {};
|
|
10
|
+
if (configGlobals?.builtin) Object.assign(res, globals.builtin);
|
|
11
|
+
if (configGlobals?.browser) Object.assign(res, globals.browser);
|
|
12
|
+
if (configGlobals?.commonjs) Object.assign(res, globals.commonjs);
|
|
13
|
+
if (configGlobals?.es2025) Object.assign(res, globals.es2025);
|
|
14
|
+
if (configGlobals?.mocha) Object.assign(res, globals.mocha);
|
|
15
|
+
if (configGlobals?.node) Object.assign(res, globals.nodeBuiltin);
|
|
16
|
+
if (configGlobals?.serviceworker) Object.assign(res, globals.serviceworker);
|
|
17
|
+
if (configGlobals?.worker) Object.assign(res, globals.worker);
|
|
18
|
+
if (configGlobals?.custom) Object.assign(res, configGlobals.custom);
|
|
19
|
+
return res;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const apply = (configResult, eslintConfig) => {
|
|
23
|
+
const sharedGlobals = eslintConfig.globals.find(c => c.files === undefined);
|
|
24
|
+
const sharedSection = sections.getNamedSection(configResult, "keeex/shared");
|
|
25
|
+
sections.sectionAddOption(
|
|
26
|
+
sharedSection,
|
|
27
|
+
"languageOptions",
|
|
28
|
+
"globals",
|
|
29
|
+
getGlobalsFromConfig({...base, ...sharedGlobals.globals}),
|
|
30
|
+
);
|
|
31
|
+
for (const globalConfig of eslintConfig.globals) {
|
|
32
|
+
if (!globalConfig.files) continue;
|
|
33
|
+
const overrideSection = sections.getNamedSection(configResult, `keeex/globals-${globalConfig.files.join(",")}`);
|
|
34
|
+
overrideSection.files = [...globalConfig.files];
|
|
35
|
+
sections.sectionAddOption(
|
|
36
|
+
overrideSection,
|
|
37
|
+
"languageOptions",
|
|
38
|
+
"globals",
|
|
39
|
+
getGlobalsFromConfig(globalConfig.globals),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import eslintPluginImportX from "eslint-plugin-import-x";
|
|
2
|
+
|
|
3
|
+
import * as sections from "../sections.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Apply the import-x configs
|
|
7
|
+
*
|
|
8
|
+
* @param configResult - The eslint configuration object currently being built.
|
|
9
|
+
*/
|
|
10
|
+
// eslint-disable-next-line max-lines-per-function
|
|
11
|
+
export const apply = (configResult, eslintConfig) => {
|
|
12
|
+
if (eslintConfig.import === false) return;
|
|
13
|
+
configResult.push({
|
|
14
|
+
...eslintPluginImportX.flatConfigs.recommended,
|
|
15
|
+
languageOptions: {},
|
|
16
|
+
});
|
|
17
|
+
if (eslintConfig.typescript) configResult.push(eslintPluginImportX.flatConfigs.typescript);
|
|
18
|
+
const override = sections.getNamedSection(configResult, "keeex/importx-override");
|
|
19
|
+
sections.configureRules(
|
|
20
|
+
override,
|
|
21
|
+
"import-x",
|
|
22
|
+
{
|
|
23
|
+
"first": "error",
|
|
24
|
+
"newline-after-import": "warn",
|
|
25
|
+
"no-amd": "error",
|
|
26
|
+
"no-anonymous-default-export": "warn",
|
|
27
|
+
"no-commonjs": "error",
|
|
28
|
+
"no-empty-named-blocks": "warn",
|
|
29
|
+
"no-named-default": "error",
|
|
30
|
+
"no-self-import": "error",
|
|
31
|
+
"no-unresolved": "warn",
|
|
32
|
+
"no-useless-path-segments": "warn",
|
|
33
|
+
"order": [
|
|
34
|
+
"warn",
|
|
35
|
+
{
|
|
36
|
+
alphabetize: {
|
|
37
|
+
order: "asc",
|
|
38
|
+
caseInsensitive: true,
|
|
39
|
+
},
|
|
40
|
+
groups: [
|
|
41
|
+
"builtin",
|
|
42
|
+
"external",
|
|
43
|
+
"internal",
|
|
44
|
+
"parent",
|
|
45
|
+
"sibling",
|
|
46
|
+
"index",
|
|
47
|
+
"object",
|
|
48
|
+
"type",
|
|
49
|
+
"unknown",
|
|
50
|
+
],
|
|
51
|
+
"newlines-between": "always-and-inside-groups",
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
if (!eslintConfig.noBase) {
|
|
57
|
+
const baseSection = sections.getNamedSection(configResult, "keeex/eslint-override");
|
|
58
|
+
sections.configureRules(baseSection, "", {"sort-imports": "off"});
|
|
59
|
+
}
|
|
60
|
+
if (typeof eslintConfig.import === "number") {
|
|
61
|
+
sections.configureRules(
|
|
62
|
+
override,
|
|
63
|
+
"import-x",
|
|
64
|
+
{
|
|
65
|
+
"no-cycle": ["error", {maxDepth: eslintConfig.import}],
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
} else {
|
|
69
|
+
sections.configureRules(override, "import-x", {"no-cycle": "error"});
|
|
70
|
+
}
|
|
71
|
+
if (eslintConfig.typescript) {
|
|
72
|
+
sections.configureRules(
|
|
73
|
+
override,
|
|
74
|
+
"import-x",
|
|
75
|
+
{"no-extraneous-dependencies": ["error", {includeTypes: true}]},
|
|
76
|
+
);
|
|
77
|
+
if (eslintConfig.react) {
|
|
78
|
+
sections.sectionAddOption(override, "settings", "import-x/extensions", [".ts", ".tsx"]);
|
|
79
|
+
} else {
|
|
80
|
+
sections.sectionAddOption(override, "settings", "import-x/extensions", [".ts"]);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
sections.configureRules(
|
|
84
|
+
override,
|
|
85
|
+
"import-x",
|
|
86
|
+
{
|
|
87
|
+
"extensions": ["error", "ignorePackages"],
|
|
88
|
+
"no-deprecated": "warn",
|
|
89
|
+
"no-extraneous-dependencies": "error",
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
if (eslintConfig.react) {
|
|
93
|
+
sections.sectionAddOption(override, "settings", "import-x/extensions", [".js", ".jsx"]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (eslintConfig.typescript) {
|
|
97
|
+
sections.sectionAddOption(override, "settings", "import-x/resolver", "typescript");
|
|
98
|
+
}
|
|
99
|
+
if (eslintConfig.react) {
|
|
100
|
+
const webOverride = sections.getNamedSection(configResult, "keeex/importx-override-webapp");
|
|
101
|
+
webOverride.files = ["src/webapp"];
|
|
102
|
+
sections.sectionAddOption(webOverride, "settings", "import-x/resolver", "webpack");
|
|
103
|
+
}
|
|
104
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const base = () => import("./base.js");
|
|
2
|
+
export const globals = () => import("./globals.js");
|
|
3
|
+
export const importx = () => import("./importx.js");
|
|
4
|
+
export const mocha = () => import("./mocha.js");
|
|
5
|
+
export const react = () => import("./react.js");
|
|
6
|
+
export const reactHooks = () => import("./react/reacthooks.js");
|
|
7
|
+
export const reactNative = () => import("./react/reactnative.js");
|
|
8
|
+
export const typescript = () => import("./typescript.js");
|