@tb-dev/eslint-config 4.2.1 → 4.3.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/dist/index.cjs +94 -68
- package/dist/index.js +93 -48
- package/package.json +9 -2
package/dist/index.cjs
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
const process = require("node:process");
|
|
25
|
-
const globals = require("globals");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const process = require('node:process');
|
|
4
|
+
const globals = require('globals');
|
|
5
|
+
|
|
26
6
|
var Glob = /* @__PURE__ */ ((Glob2) => {
|
|
27
7
|
Glob2["All"] = "**/*.?([cm])[jt]s?(x)";
|
|
28
8
|
Glob2["Javascript"] = "**/*.?([cm])js?(x)";
|
|
@@ -41,13 +21,18 @@ var GlobIgnore = /* @__PURE__ */ ((GlobIgnore2) => {
|
|
|
41
21
|
GlobIgnore2["Temp"] = "**/?(.)temp";
|
|
42
22
|
return GlobIgnore2;
|
|
43
23
|
})(GlobIgnore || {});
|
|
24
|
+
|
|
44
25
|
async function interopDefault(promise) {
|
|
45
26
|
const result = await promise;
|
|
46
27
|
return result.default ?? result;
|
|
47
28
|
}
|
|
29
|
+
async function json(path) {
|
|
30
|
+
return interopDefault(import(path));
|
|
31
|
+
}
|
|
48
32
|
function getIgnores() {
|
|
49
33
|
return Object.values(GlobIgnore);
|
|
50
34
|
}
|
|
35
|
+
|
|
51
36
|
const stylisticRules = {
|
|
52
37
|
"stylistic/array-bracket-newline": ["error", "consistent"],
|
|
53
38
|
"stylistic/array-bracket-spacing": ["error", "never"],
|
|
@@ -71,7 +56,11 @@ const stylisticRules = {
|
|
|
71
56
|
"stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
72
57
|
"stylistic/function-call-spacing": ["error", "never"],
|
|
73
58
|
"stylistic/function-paren-newline": ["error", "never"],
|
|
74
|
-
"stylistic/generator-star-spacing": ["error", {
|
|
59
|
+
"stylistic/generator-star-spacing": ["error", {
|
|
60
|
+
before: false,
|
|
61
|
+
after: true,
|
|
62
|
+
method: { before: true, after: false }
|
|
63
|
+
}],
|
|
75
64
|
"stylistic/implicit-arrow-linebreak": ["error", "beside"],
|
|
76
65
|
"stylistic/indent": ["error", 2, { flatTernaryExpressions: true }],
|
|
77
66
|
"stylistic/indent-binary-ops": ["error", 2],
|
|
@@ -155,12 +144,12 @@ const stylisticRules = {
|
|
|
155
144
|
async function stylistic(options) {
|
|
156
145
|
const { overrides, stylistic: enabled } = options;
|
|
157
146
|
if (!enabled) return {};
|
|
158
|
-
const plugin = await interopDefault(import(
|
|
147
|
+
const plugin = await interopDefault(import('@stylistic/eslint-plugin'));
|
|
159
148
|
const files = [Glob.All];
|
|
160
149
|
if (options.vue) files.push(Glob.Vue);
|
|
161
150
|
const rules = {
|
|
162
151
|
...stylisticRules,
|
|
163
|
-
...overrides
|
|
152
|
+
...overrides?.stylistic
|
|
164
153
|
};
|
|
165
154
|
return {
|
|
166
155
|
files,
|
|
@@ -168,15 +157,17 @@ async function stylistic(options) {
|
|
|
168
157
|
rules
|
|
169
158
|
};
|
|
170
159
|
}
|
|
160
|
+
|
|
171
161
|
async function vue(options) {
|
|
172
162
|
const { overrides, vue: enabled } = options;
|
|
173
163
|
if (!enabled) return [];
|
|
174
164
|
const [vuePlugin, vueParser, tsParser] = await Promise.all([
|
|
175
165
|
// @ts-expect-error no types
|
|
176
|
-
interopDefault(import(
|
|
177
|
-
interopDefault(import(
|
|
178
|
-
interopDefault(import(
|
|
166
|
+
interopDefault(import('eslint-plugin-vue')),
|
|
167
|
+
interopDefault(import('vue-eslint-parser')),
|
|
168
|
+
interopDefault(import('@typescript-eslint/parser'))
|
|
179
169
|
]);
|
|
170
|
+
const INLINE_ELEMENTS = await json("eslint-plugin-vue/lib/utils/inline-non-void-elements.json");
|
|
180
171
|
const rules = {
|
|
181
172
|
...vuePlugin.configs.base.rules,
|
|
182
173
|
"vue/attribute-hyphenation": ["error", "always"],
|
|
@@ -207,41 +198,17 @@ async function vue(options) {
|
|
|
207
198
|
}],
|
|
208
199
|
"vue/define-props-declaration": ["error", "type-based"],
|
|
209
200
|
"vue/enforce-style-attribute": ["error", { allow: ["scoped"] }],
|
|
210
|
-
"vue/first-attribute-linebreak": "off",
|
|
211
201
|
"vue/html-button-has-type": ["error", {
|
|
212
202
|
button: true,
|
|
213
203
|
submit: true,
|
|
214
204
|
reset: true
|
|
215
205
|
}],
|
|
216
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
217
|
-
singleline: "never",
|
|
218
|
-
multiline: "always",
|
|
219
|
-
selfClosingTag: {
|
|
220
|
-
singleline: "never",
|
|
221
|
-
multiline: "always"
|
|
222
|
-
}
|
|
223
|
-
}],
|
|
224
|
-
"vue/html-closing-bracket-spacing": ["error", {
|
|
225
|
-
startTag: "never",
|
|
226
|
-
endTag: "never",
|
|
227
|
-
selfClosingTag: "always"
|
|
228
|
-
}],
|
|
229
|
-
"vue/html-self-closing": ["error", {
|
|
230
|
-
html: {
|
|
231
|
-
void: "never",
|
|
232
|
-
normal: "always",
|
|
233
|
-
component: "always"
|
|
234
|
-
},
|
|
235
|
-
svg: "always",
|
|
236
|
-
math: "always"
|
|
237
|
-
}],
|
|
238
206
|
"vue/match-component-file-name": ["off", {
|
|
239
207
|
extensions: ["tsx", "vue"],
|
|
240
208
|
shouldMatchCase: false
|
|
241
209
|
}],
|
|
242
210
|
"vue/match-component-import-name": "error",
|
|
243
211
|
"vue/multi-word-component-names": "off",
|
|
244
|
-
"vue/mustache-interpolation-spacing": ["error", "always"],
|
|
245
212
|
"vue/no-arrow-functions-in-watch": "off",
|
|
246
213
|
"vue/no-async-in-computed-properties": "error",
|
|
247
214
|
"vue/no-boolean-default": ["error", "no-default"],
|
|
@@ -256,7 +223,6 @@ async function vue(options) {
|
|
|
256
223
|
"vue/no-expose-after-await": "error",
|
|
257
224
|
"vue/no-lifecycle-after-await": "error",
|
|
258
225
|
"vue/no-lone-template": "error",
|
|
259
|
-
"vue/no-multi-spaces": "error",
|
|
260
226
|
"vue/no-multiple-objects-in-class": "error",
|
|
261
227
|
"vue/no-mutating-props": "error",
|
|
262
228
|
"vue/no-parsing-error": "error",
|
|
@@ -270,7 +236,6 @@ async function vue(options) {
|
|
|
270
236
|
"vue/no-setup-props-reactivity-loss": "error",
|
|
271
237
|
"vue/no-shared-component-data": "error",
|
|
272
238
|
"vue/no-side-effects-in-computed-properties": "error",
|
|
273
|
-
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
274
239
|
"vue/no-static-inline-styles": ["error", { allowBinding: false }],
|
|
275
240
|
"vue/no-template-key": "error",
|
|
276
241
|
"vue/no-template-shadow": "error",
|
|
@@ -356,9 +321,63 @@ async function vue(options) {
|
|
|
356
321
|
"vue/valid-v-show": "error",
|
|
357
322
|
"vue/valid-v-slot": "error",
|
|
358
323
|
"vue/valid-v-text": "error",
|
|
359
|
-
...overrides
|
|
324
|
+
...overrides?.vue
|
|
360
325
|
};
|
|
361
326
|
if (options.stylistic) {
|
|
327
|
+
Object.assign(rules, {
|
|
328
|
+
"vue/first-attribute-linebreak": ["error", {
|
|
329
|
+
singleline: "beside",
|
|
330
|
+
multiline: "below"
|
|
331
|
+
}],
|
|
332
|
+
"vue/html-closing-bracket-newline": ["error", {
|
|
333
|
+
singleline: "never",
|
|
334
|
+
multiline: "always",
|
|
335
|
+
selfClosingTag: {
|
|
336
|
+
singleline: "never",
|
|
337
|
+
multiline: "always"
|
|
338
|
+
}
|
|
339
|
+
}],
|
|
340
|
+
"vue/html-closing-bracket-spacing": ["error", {
|
|
341
|
+
startTag: "never",
|
|
342
|
+
endTag: "never",
|
|
343
|
+
selfClosingTag: "always"
|
|
344
|
+
}],
|
|
345
|
+
"vue/html-indent": ["error", 2, {
|
|
346
|
+
attribute: 1,
|
|
347
|
+
baseIndent: 1,
|
|
348
|
+
closeBracket: 0,
|
|
349
|
+
alignAttributesVertically: true,
|
|
350
|
+
ignores: []
|
|
351
|
+
}],
|
|
352
|
+
"vue/html-quotes": ["error", "double", { avoidEscape: false }],
|
|
353
|
+
"vue/html-self-closing": ["error", {
|
|
354
|
+
html: {
|
|
355
|
+
void: "never",
|
|
356
|
+
normal: "always",
|
|
357
|
+
component: "always"
|
|
358
|
+
},
|
|
359
|
+
svg: "always",
|
|
360
|
+
math: "always"
|
|
361
|
+
}],
|
|
362
|
+
"vue/max-attributes-per-line": ["error", {
|
|
363
|
+
singleline: 1,
|
|
364
|
+
multiline: 1
|
|
365
|
+
}],
|
|
366
|
+
"vue/multiline-html-element-content-newline": ["error", {
|
|
367
|
+
ignoreWhenEmpty: true,
|
|
368
|
+
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
369
|
+
allowEmptyLines: false
|
|
370
|
+
}],
|
|
371
|
+
"vue/mustache-interpolation-spacing": ["error", "always"],
|
|
372
|
+
"vue/no-multi-spaces": ["error", { ignoreProperties: false }],
|
|
373
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
374
|
+
"vue/singleline-html-element-content-newline": ["off", {
|
|
375
|
+
ignoreWhenNoAttributes: true,
|
|
376
|
+
ignoreWhenEmpty: true,
|
|
377
|
+
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
378
|
+
externalIgnores: []
|
|
379
|
+
}]
|
|
380
|
+
});
|
|
362
381
|
const vueStylistic = [
|
|
363
382
|
"vue/array-bracket-newline",
|
|
364
383
|
"vue/array-bracket-spacing",
|
|
@@ -409,10 +428,11 @@ async function vue(options) {
|
|
|
409
428
|
}
|
|
410
429
|
];
|
|
411
430
|
}
|
|
431
|
+
|
|
412
432
|
async function vitest(options) {
|
|
413
433
|
const { overrides, vitest: enabled } = options;
|
|
414
434
|
if (!enabled) return {};
|
|
415
|
-
const plugin = await interopDefault(import(
|
|
435
|
+
const plugin = await interopDefault(import('eslint-plugin-vitest'));
|
|
416
436
|
return {
|
|
417
437
|
plugins: { vitest: plugin },
|
|
418
438
|
files: [Glob.Vitest],
|
|
@@ -448,14 +468,15 @@ async function vitest(options) {
|
|
|
448
468
|
"vitest/require-top-level-describe": ["error", { maxNumberOfTopLevelDescribes: 10 }],
|
|
449
469
|
"vitest/valid-describe-callback": "error",
|
|
450
470
|
"vitest/valid-expect": "error",
|
|
451
|
-
...overrides
|
|
471
|
+
...overrides?.vitest
|
|
452
472
|
}
|
|
453
473
|
};
|
|
454
474
|
}
|
|
475
|
+
|
|
455
476
|
async function unicorn(options) {
|
|
456
477
|
const { overrides, unicorn: enabled = true } = options;
|
|
457
478
|
if (!enabled) return {};
|
|
458
|
-
const plugin = await interopDefault(import(
|
|
479
|
+
const plugin = await interopDefault(import('eslint-plugin-unicorn'));
|
|
459
480
|
return {
|
|
460
481
|
plugins: { unicorn: plugin },
|
|
461
482
|
rules: {
|
|
@@ -498,10 +519,11 @@ async function unicorn(options) {
|
|
|
498
519
|
"unicorn/prefer-structured-clone": "error",
|
|
499
520
|
"unicorn/prefer-type-error": "error",
|
|
500
521
|
"unicorn/relative-url-style": ["error", "never"],
|
|
501
|
-
...overrides
|
|
522
|
+
...overrides?.unicorn
|
|
502
523
|
}
|
|
503
524
|
};
|
|
504
525
|
}
|
|
526
|
+
|
|
505
527
|
function javascript(options) {
|
|
506
528
|
const { overrides } = options;
|
|
507
529
|
const files = [Glob.All];
|
|
@@ -641,15 +663,16 @@ function javascript(options) {
|
|
|
641
663
|
"use-isnan": "error",
|
|
642
664
|
"valid-typeof": "error",
|
|
643
665
|
yoda: ["error", "never"],
|
|
644
|
-
...overrides
|
|
666
|
+
...overrides?.javascript
|
|
645
667
|
}
|
|
646
668
|
};
|
|
647
669
|
}
|
|
670
|
+
|
|
648
671
|
async function typescript(options) {
|
|
649
672
|
const { project, overrides } = options;
|
|
650
673
|
const [tsParser, tsPlugin] = await Promise.all([
|
|
651
|
-
interopDefault(import(
|
|
652
|
-
interopDefault(import(
|
|
674
|
+
interopDefault(import('@typescript-eslint/parser')),
|
|
675
|
+
interopDefault(import('@typescript-eslint/eslint-plugin'))
|
|
653
676
|
]);
|
|
654
677
|
const files = [Glob.Typescript];
|
|
655
678
|
if (options.vue) files.push(Glob.Vue);
|
|
@@ -853,7 +876,7 @@ async function typescript(options) {
|
|
|
853
876
|
"@typescript-eslint/unbound-method": "error",
|
|
854
877
|
"@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
|
|
855
878
|
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
|
856
|
-
...overrides
|
|
879
|
+
...overrides?.typescript
|
|
857
880
|
};
|
|
858
881
|
return {
|
|
859
882
|
files,
|
|
@@ -871,10 +894,11 @@ async function typescript(options) {
|
|
|
871
894
|
rules
|
|
872
895
|
};
|
|
873
896
|
}
|
|
897
|
+
|
|
874
898
|
async function perfectionist(options) {
|
|
875
899
|
const { overrides, perfectionist: enabled = true } = options;
|
|
876
900
|
if (!enabled) return {};
|
|
877
|
-
const plugin = await interopDefault(import(
|
|
901
|
+
const plugin = await interopDefault(import('eslint-plugin-perfectionist'));
|
|
878
902
|
return {
|
|
879
903
|
plugins: { perfectionist: plugin },
|
|
880
904
|
rules: {
|
|
@@ -933,10 +957,11 @@ async function perfectionist(options) {
|
|
|
933
957
|
order: "asc",
|
|
934
958
|
ignoreCase: true
|
|
935
959
|
}],
|
|
936
|
-
...overrides
|
|
960
|
+
...overrides?.perfectionist
|
|
937
961
|
}
|
|
938
962
|
};
|
|
939
963
|
}
|
|
964
|
+
|
|
940
965
|
async function defineConfig(options) {
|
|
941
966
|
const ignores = {
|
|
942
967
|
ignores: [...getIgnores(), ...options.ignores ?? []]
|
|
@@ -953,4 +978,5 @@ async function defineConfig(options) {
|
|
|
953
978
|
]);
|
|
954
979
|
return objects;
|
|
955
980
|
}
|
|
981
|
+
|
|
956
982
|
module.exports = defineConfig;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import globals from
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import globals from 'globals';
|
|
3
|
+
|
|
3
4
|
var Glob = /* @__PURE__ */ ((Glob2) => {
|
|
4
5
|
Glob2["All"] = "**/*.?([cm])[jt]s?(x)";
|
|
5
6
|
Glob2["Javascript"] = "**/*.?([cm])js?(x)";
|
|
@@ -18,13 +19,18 @@ var GlobIgnore = /* @__PURE__ */ ((GlobIgnore2) => {
|
|
|
18
19
|
GlobIgnore2["Temp"] = "**/?(.)temp";
|
|
19
20
|
return GlobIgnore2;
|
|
20
21
|
})(GlobIgnore || {});
|
|
22
|
+
|
|
21
23
|
async function interopDefault(promise) {
|
|
22
24
|
const result = await promise;
|
|
23
25
|
return result.default ?? result;
|
|
24
26
|
}
|
|
27
|
+
async function json(path) {
|
|
28
|
+
return interopDefault(import(path, { with: { type: "json" } }));
|
|
29
|
+
}
|
|
25
30
|
function getIgnores() {
|
|
26
31
|
return Object.values(GlobIgnore);
|
|
27
32
|
}
|
|
33
|
+
|
|
28
34
|
const stylisticRules = {
|
|
29
35
|
"stylistic/array-bracket-newline": ["error", "consistent"],
|
|
30
36
|
"stylistic/array-bracket-spacing": ["error", "never"],
|
|
@@ -48,7 +54,11 @@ const stylisticRules = {
|
|
|
48
54
|
"stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
49
55
|
"stylistic/function-call-spacing": ["error", "never"],
|
|
50
56
|
"stylistic/function-paren-newline": ["error", "never"],
|
|
51
|
-
"stylistic/generator-star-spacing": ["error", {
|
|
57
|
+
"stylistic/generator-star-spacing": ["error", {
|
|
58
|
+
before: false,
|
|
59
|
+
after: true,
|
|
60
|
+
method: { before: true, after: false }
|
|
61
|
+
}],
|
|
52
62
|
"stylistic/implicit-arrow-linebreak": ["error", "beside"],
|
|
53
63
|
"stylistic/indent": ["error", 2, { flatTernaryExpressions: true }],
|
|
54
64
|
"stylistic/indent-binary-ops": ["error", 2],
|
|
@@ -132,12 +142,12 @@ const stylisticRules = {
|
|
|
132
142
|
async function stylistic(options) {
|
|
133
143
|
const { overrides, stylistic: enabled } = options;
|
|
134
144
|
if (!enabled) return {};
|
|
135
|
-
const plugin = await interopDefault(import(
|
|
145
|
+
const plugin = await interopDefault(import('@stylistic/eslint-plugin'));
|
|
136
146
|
const files = [Glob.All];
|
|
137
147
|
if (options.vue) files.push(Glob.Vue);
|
|
138
148
|
const rules = {
|
|
139
149
|
...stylisticRules,
|
|
140
|
-
...overrides
|
|
150
|
+
...overrides?.stylistic
|
|
141
151
|
};
|
|
142
152
|
return {
|
|
143
153
|
files,
|
|
@@ -145,15 +155,17 @@ async function stylistic(options) {
|
|
|
145
155
|
rules
|
|
146
156
|
};
|
|
147
157
|
}
|
|
158
|
+
|
|
148
159
|
async function vue(options) {
|
|
149
160
|
const { overrides, vue: enabled } = options;
|
|
150
161
|
if (!enabled) return [];
|
|
151
162
|
const [vuePlugin, vueParser, tsParser] = await Promise.all([
|
|
152
163
|
// @ts-expect-error no types
|
|
153
|
-
interopDefault(import(
|
|
154
|
-
interopDefault(import(
|
|
155
|
-
interopDefault(import(
|
|
164
|
+
interopDefault(import('eslint-plugin-vue')),
|
|
165
|
+
interopDefault(import('vue-eslint-parser')),
|
|
166
|
+
interopDefault(import('@typescript-eslint/parser'))
|
|
156
167
|
]);
|
|
168
|
+
const INLINE_ELEMENTS = await json("eslint-plugin-vue/lib/utils/inline-non-void-elements.json");
|
|
157
169
|
const rules = {
|
|
158
170
|
...vuePlugin.configs.base.rules,
|
|
159
171
|
"vue/attribute-hyphenation": ["error", "always"],
|
|
@@ -184,41 +196,17 @@ async function vue(options) {
|
|
|
184
196
|
}],
|
|
185
197
|
"vue/define-props-declaration": ["error", "type-based"],
|
|
186
198
|
"vue/enforce-style-attribute": ["error", { allow: ["scoped"] }],
|
|
187
|
-
"vue/first-attribute-linebreak": "off",
|
|
188
199
|
"vue/html-button-has-type": ["error", {
|
|
189
200
|
button: true,
|
|
190
201
|
submit: true,
|
|
191
202
|
reset: true
|
|
192
203
|
}],
|
|
193
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
194
|
-
singleline: "never",
|
|
195
|
-
multiline: "always",
|
|
196
|
-
selfClosingTag: {
|
|
197
|
-
singleline: "never",
|
|
198
|
-
multiline: "always"
|
|
199
|
-
}
|
|
200
|
-
}],
|
|
201
|
-
"vue/html-closing-bracket-spacing": ["error", {
|
|
202
|
-
startTag: "never",
|
|
203
|
-
endTag: "never",
|
|
204
|
-
selfClosingTag: "always"
|
|
205
|
-
}],
|
|
206
|
-
"vue/html-self-closing": ["error", {
|
|
207
|
-
html: {
|
|
208
|
-
void: "never",
|
|
209
|
-
normal: "always",
|
|
210
|
-
component: "always"
|
|
211
|
-
},
|
|
212
|
-
svg: "always",
|
|
213
|
-
math: "always"
|
|
214
|
-
}],
|
|
215
204
|
"vue/match-component-file-name": ["off", {
|
|
216
205
|
extensions: ["tsx", "vue"],
|
|
217
206
|
shouldMatchCase: false
|
|
218
207
|
}],
|
|
219
208
|
"vue/match-component-import-name": "error",
|
|
220
209
|
"vue/multi-word-component-names": "off",
|
|
221
|
-
"vue/mustache-interpolation-spacing": ["error", "always"],
|
|
222
210
|
"vue/no-arrow-functions-in-watch": "off",
|
|
223
211
|
"vue/no-async-in-computed-properties": "error",
|
|
224
212
|
"vue/no-boolean-default": ["error", "no-default"],
|
|
@@ -233,7 +221,6 @@ async function vue(options) {
|
|
|
233
221
|
"vue/no-expose-after-await": "error",
|
|
234
222
|
"vue/no-lifecycle-after-await": "error",
|
|
235
223
|
"vue/no-lone-template": "error",
|
|
236
|
-
"vue/no-multi-spaces": "error",
|
|
237
224
|
"vue/no-multiple-objects-in-class": "error",
|
|
238
225
|
"vue/no-mutating-props": "error",
|
|
239
226
|
"vue/no-parsing-error": "error",
|
|
@@ -247,7 +234,6 @@ async function vue(options) {
|
|
|
247
234
|
"vue/no-setup-props-reactivity-loss": "error",
|
|
248
235
|
"vue/no-shared-component-data": "error",
|
|
249
236
|
"vue/no-side-effects-in-computed-properties": "error",
|
|
250
|
-
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
251
237
|
"vue/no-static-inline-styles": ["error", { allowBinding: false }],
|
|
252
238
|
"vue/no-template-key": "error",
|
|
253
239
|
"vue/no-template-shadow": "error",
|
|
@@ -333,9 +319,63 @@ async function vue(options) {
|
|
|
333
319
|
"vue/valid-v-show": "error",
|
|
334
320
|
"vue/valid-v-slot": "error",
|
|
335
321
|
"vue/valid-v-text": "error",
|
|
336
|
-
...overrides
|
|
322
|
+
...overrides?.vue
|
|
337
323
|
};
|
|
338
324
|
if (options.stylistic) {
|
|
325
|
+
Object.assign(rules, {
|
|
326
|
+
"vue/first-attribute-linebreak": ["error", {
|
|
327
|
+
singleline: "beside",
|
|
328
|
+
multiline: "below"
|
|
329
|
+
}],
|
|
330
|
+
"vue/html-closing-bracket-newline": ["error", {
|
|
331
|
+
singleline: "never",
|
|
332
|
+
multiline: "always",
|
|
333
|
+
selfClosingTag: {
|
|
334
|
+
singleline: "never",
|
|
335
|
+
multiline: "always"
|
|
336
|
+
}
|
|
337
|
+
}],
|
|
338
|
+
"vue/html-closing-bracket-spacing": ["error", {
|
|
339
|
+
startTag: "never",
|
|
340
|
+
endTag: "never",
|
|
341
|
+
selfClosingTag: "always"
|
|
342
|
+
}],
|
|
343
|
+
"vue/html-indent": ["error", 2, {
|
|
344
|
+
attribute: 1,
|
|
345
|
+
baseIndent: 1,
|
|
346
|
+
closeBracket: 0,
|
|
347
|
+
alignAttributesVertically: true,
|
|
348
|
+
ignores: []
|
|
349
|
+
}],
|
|
350
|
+
"vue/html-quotes": ["error", "double", { avoidEscape: false }],
|
|
351
|
+
"vue/html-self-closing": ["error", {
|
|
352
|
+
html: {
|
|
353
|
+
void: "never",
|
|
354
|
+
normal: "always",
|
|
355
|
+
component: "always"
|
|
356
|
+
},
|
|
357
|
+
svg: "always",
|
|
358
|
+
math: "always"
|
|
359
|
+
}],
|
|
360
|
+
"vue/max-attributes-per-line": ["error", {
|
|
361
|
+
singleline: 1,
|
|
362
|
+
multiline: 1
|
|
363
|
+
}],
|
|
364
|
+
"vue/multiline-html-element-content-newline": ["error", {
|
|
365
|
+
ignoreWhenEmpty: true,
|
|
366
|
+
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
367
|
+
allowEmptyLines: false
|
|
368
|
+
}],
|
|
369
|
+
"vue/mustache-interpolation-spacing": ["error", "always"],
|
|
370
|
+
"vue/no-multi-spaces": ["error", { ignoreProperties: false }],
|
|
371
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
372
|
+
"vue/singleline-html-element-content-newline": ["off", {
|
|
373
|
+
ignoreWhenNoAttributes: true,
|
|
374
|
+
ignoreWhenEmpty: true,
|
|
375
|
+
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
376
|
+
externalIgnores: []
|
|
377
|
+
}]
|
|
378
|
+
});
|
|
339
379
|
const vueStylistic = [
|
|
340
380
|
"vue/array-bracket-newline",
|
|
341
381
|
"vue/array-bracket-spacing",
|
|
@@ -386,10 +426,11 @@ async function vue(options) {
|
|
|
386
426
|
}
|
|
387
427
|
];
|
|
388
428
|
}
|
|
429
|
+
|
|
389
430
|
async function vitest(options) {
|
|
390
431
|
const { overrides, vitest: enabled } = options;
|
|
391
432
|
if (!enabled) return {};
|
|
392
|
-
const plugin = await interopDefault(import(
|
|
433
|
+
const plugin = await interopDefault(import('eslint-plugin-vitest'));
|
|
393
434
|
return {
|
|
394
435
|
plugins: { vitest: plugin },
|
|
395
436
|
files: [Glob.Vitest],
|
|
@@ -425,14 +466,15 @@ async function vitest(options) {
|
|
|
425
466
|
"vitest/require-top-level-describe": ["error", { maxNumberOfTopLevelDescribes: 10 }],
|
|
426
467
|
"vitest/valid-describe-callback": "error",
|
|
427
468
|
"vitest/valid-expect": "error",
|
|
428
|
-
...overrides
|
|
469
|
+
...overrides?.vitest
|
|
429
470
|
}
|
|
430
471
|
};
|
|
431
472
|
}
|
|
473
|
+
|
|
432
474
|
async function unicorn(options) {
|
|
433
475
|
const { overrides, unicorn: enabled = true } = options;
|
|
434
476
|
if (!enabled) return {};
|
|
435
|
-
const plugin = await interopDefault(import(
|
|
477
|
+
const plugin = await interopDefault(import('eslint-plugin-unicorn'));
|
|
436
478
|
return {
|
|
437
479
|
plugins: { unicorn: plugin },
|
|
438
480
|
rules: {
|
|
@@ -475,10 +517,11 @@ async function unicorn(options) {
|
|
|
475
517
|
"unicorn/prefer-structured-clone": "error",
|
|
476
518
|
"unicorn/prefer-type-error": "error",
|
|
477
519
|
"unicorn/relative-url-style": ["error", "never"],
|
|
478
|
-
...overrides
|
|
520
|
+
...overrides?.unicorn
|
|
479
521
|
}
|
|
480
522
|
};
|
|
481
523
|
}
|
|
524
|
+
|
|
482
525
|
function javascript(options) {
|
|
483
526
|
const { overrides } = options;
|
|
484
527
|
const files = [Glob.All];
|
|
@@ -618,15 +661,16 @@ function javascript(options) {
|
|
|
618
661
|
"use-isnan": "error",
|
|
619
662
|
"valid-typeof": "error",
|
|
620
663
|
yoda: ["error", "never"],
|
|
621
|
-
...overrides
|
|
664
|
+
...overrides?.javascript
|
|
622
665
|
}
|
|
623
666
|
};
|
|
624
667
|
}
|
|
668
|
+
|
|
625
669
|
async function typescript(options) {
|
|
626
670
|
const { project, overrides } = options;
|
|
627
671
|
const [tsParser, tsPlugin] = await Promise.all([
|
|
628
|
-
interopDefault(import(
|
|
629
|
-
interopDefault(import(
|
|
672
|
+
interopDefault(import('@typescript-eslint/parser')),
|
|
673
|
+
interopDefault(import('@typescript-eslint/eslint-plugin'))
|
|
630
674
|
]);
|
|
631
675
|
const files = [Glob.Typescript];
|
|
632
676
|
if (options.vue) files.push(Glob.Vue);
|
|
@@ -830,7 +874,7 @@ async function typescript(options) {
|
|
|
830
874
|
"@typescript-eslint/unbound-method": "error",
|
|
831
875
|
"@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
|
|
832
876
|
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
|
|
833
|
-
...overrides
|
|
877
|
+
...overrides?.typescript
|
|
834
878
|
};
|
|
835
879
|
return {
|
|
836
880
|
files,
|
|
@@ -848,10 +892,11 @@ async function typescript(options) {
|
|
|
848
892
|
rules
|
|
849
893
|
};
|
|
850
894
|
}
|
|
895
|
+
|
|
851
896
|
async function perfectionist(options) {
|
|
852
897
|
const { overrides, perfectionist: enabled = true } = options;
|
|
853
898
|
if (!enabled) return {};
|
|
854
|
-
const plugin = await interopDefault(import(
|
|
899
|
+
const plugin = await interopDefault(import('eslint-plugin-perfectionist'));
|
|
855
900
|
return {
|
|
856
901
|
plugins: { perfectionist: plugin },
|
|
857
902
|
rules: {
|
|
@@ -910,10 +955,11 @@ async function perfectionist(options) {
|
|
|
910
955
|
order: "asc",
|
|
911
956
|
ignoreCase: true
|
|
912
957
|
}],
|
|
913
|
-
...overrides
|
|
958
|
+
...overrides?.perfectionist
|
|
914
959
|
}
|
|
915
960
|
};
|
|
916
961
|
}
|
|
962
|
+
|
|
917
963
|
async function defineConfig(options) {
|
|
918
964
|
const ignores = {
|
|
919
965
|
ignores: [...getIgnores(), ...options.ignores ?? []]
|
|
@@ -930,6 +976,5 @@ async function defineConfig(options) {
|
|
|
930
976
|
]);
|
|
931
977
|
return objects;
|
|
932
978
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
};
|
|
979
|
+
|
|
980
|
+
export { defineConfig as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tb-dev/eslint-config",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "ESLint config",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/ferreira-tb/eslint-config/issues"
|
|
15
15
|
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"eslint",
|
|
18
|
+
"eslint-config",
|
|
19
|
+
"typescript",
|
|
20
|
+
"stylistic",
|
|
21
|
+
"vue"
|
|
22
|
+
],
|
|
16
23
|
"lint-staged": {
|
|
17
24
|
"*.{?(c|m)@(j|t)s,css,vue,md,json}": "eslint --config eslint.config.js --fix"
|
|
18
25
|
},
|
|
@@ -43,7 +50,7 @@
|
|
|
43
50
|
"typescript": "^5.4.0"
|
|
44
51
|
},
|
|
45
52
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
53
|
+
"node": ">=22"
|
|
47
54
|
},
|
|
48
55
|
"files": [
|
|
49
56
|
"dist/**/*"
|