@tb-dev/eslint-config 5.0.2 → 5.0.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/dist/index.cjs +90 -317
- package/dist/index.d.ts +0 -6
- package/dist/index.js +90 -317
- package/package.json +2 -5
package/dist/index.cjs
CHANGED
|
@@ -8,12 +8,12 @@ const globals = require('globals');
|
|
|
8
8
|
var Glob = /* @__PURE__ */ ((Glob2) => {
|
|
9
9
|
Glob2["All"] = "**/*.?([cm])[jt]s?(x)";
|
|
10
10
|
Glob2["Javascript"] = "**/*.?([cm])js?(x)";
|
|
11
|
-
Glob2["Json"] = "**/*.json?([c5])";
|
|
12
11
|
Glob2["Typescript"] = "**/*.?([cm])ts?(x)";
|
|
13
12
|
Glob2["Vue"] = "**/*.vue";
|
|
14
13
|
return Glob2;
|
|
15
14
|
})(Glob || {});
|
|
16
15
|
var GlobIgnore = /* @__PURE__ */ ((GlobIgnore2) => {
|
|
16
|
+
GlobIgnore2["Autogenerated"] = "**/autogenerated";
|
|
17
17
|
GlobIgnore2["Cache"] = "**/cache";
|
|
18
18
|
GlobIgnore2["Dist"] = "**/dist";
|
|
19
19
|
GlobIgnore2["Log"] = "**/log?(s)";
|
|
@@ -28,138 +28,10 @@ async function interopDefault(promise) {
|
|
|
28
28
|
const result = await promise;
|
|
29
29
|
return result.default ?? result;
|
|
30
30
|
}
|
|
31
|
-
async function json(path) {
|
|
32
|
-
return interopDefault(import(path));
|
|
33
|
-
}
|
|
34
31
|
function getIgnores() {
|
|
35
32
|
return Object.values(GlobIgnore);
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
const stylisticRules = {
|
|
39
|
-
"stylistic/array-bracket-newline": ["error", "consistent"],
|
|
40
|
-
"stylistic/array-bracket-spacing": ["error", "never"],
|
|
41
|
-
"stylistic/array-element-newline": ["error", "consistent"],
|
|
42
|
-
"stylistic/arrow-parens": ["error", "always"],
|
|
43
|
-
"stylistic/arrow-spacing": "error",
|
|
44
|
-
"stylistic/block-spacing": "error",
|
|
45
|
-
"stylistic/brace-style": ["error", "stroustrup"],
|
|
46
|
-
"stylistic/comma-dangle": ["error", {
|
|
47
|
-
arrays: "always-multiline",
|
|
48
|
-
objects: "always-multiline",
|
|
49
|
-
imports: "always-multiline",
|
|
50
|
-
exports: "always-multiline",
|
|
51
|
-
functions: "always-multiline",
|
|
52
|
-
enums: "always-multiline"
|
|
53
|
-
}],
|
|
54
|
-
"stylistic/comma-spacing": ["error", { before: false, after: true }],
|
|
55
|
-
"stylistic/comma-style": ["error", "last"],
|
|
56
|
-
"stylistic/computed-property-spacing": ["error", "never"],
|
|
57
|
-
"stylistic/dot-location": ["error", "property"],
|
|
58
|
-
"stylistic/eol-last": ["error", "always"],
|
|
59
|
-
"stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
60
|
-
"stylistic/function-call-spacing": ["error", "never"],
|
|
61
|
-
"stylistic/function-paren-newline": ["error", "never"],
|
|
62
|
-
"stylistic/generator-star-spacing": ["error", {
|
|
63
|
-
before: false,
|
|
64
|
-
after: true,
|
|
65
|
-
method: { before: true, after: false }
|
|
66
|
-
}],
|
|
67
|
-
"stylistic/implicit-arrow-linebreak": ["error", "beside"],
|
|
68
|
-
"stylistic/indent": ["error", 2, { flatTernaryExpressions: true }],
|
|
69
|
-
"stylistic/indent-binary-ops": ["error", 2],
|
|
70
|
-
"stylistic/key-spacing": ["error", { afterColon: true, beforeColon: false, mode: "strict" }],
|
|
71
|
-
"stylistic/keyword-spacing": ["error", { after: true, before: true }],
|
|
72
|
-
"stylistic/line-comment-position": ["error", { position: "above" }],
|
|
73
|
-
"stylistic/linebreak-style": ["error", "unix"],
|
|
74
|
-
"stylistic/lines-between-class-members": ["error", {
|
|
75
|
-
enforce: [
|
|
76
|
-
{ blankLine: "always", prev: "method", next: "method" }
|
|
77
|
-
]
|
|
78
|
-
}],
|
|
79
|
-
"stylistic/max-len": ["error", {
|
|
80
|
-
code: 100,
|
|
81
|
-
tabWidth: 2,
|
|
82
|
-
ignoreComments: true,
|
|
83
|
-
ignoreTrailingComments: true,
|
|
84
|
-
ignoreUrls: true,
|
|
85
|
-
ignoreStrings: true,
|
|
86
|
-
ignoreTemplateLiterals: true,
|
|
87
|
-
ignoreRegExpLiterals: true
|
|
88
|
-
}],
|
|
89
|
-
"stylistic/member-delimiter-style": ["error", {
|
|
90
|
-
multiline: { delimiter: "semi", requireLast: true },
|
|
91
|
-
singleline: { delimiter: "semi", requireLast: true }
|
|
92
|
-
}],
|
|
93
|
-
"stylistic/new-parens": ["error", "always"],
|
|
94
|
-
"stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 2 }],
|
|
95
|
-
"stylistic/no-confusing-arrow": ["error", { allowParens: true }],
|
|
96
|
-
"stylistic/no-extra-parens": ["error", "all", {
|
|
97
|
-
nestedBinaryExpressions: false,
|
|
98
|
-
ternaryOperandBinaryExpressions: false
|
|
99
|
-
}],
|
|
100
|
-
"stylistic/no-extra-semi": "error",
|
|
101
|
-
"stylistic/no-floating-decimal": "error",
|
|
102
|
-
"stylistic/no-mixed-spaces-and-tabs": "error",
|
|
103
|
-
"stylistic/no-multi-spaces": "error",
|
|
104
|
-
"stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0 }],
|
|
105
|
-
"stylistic/no-tabs": "error",
|
|
106
|
-
"stylistic/no-trailing-spaces": "error",
|
|
107
|
-
"stylistic/no-whitespace-before-property": "error",
|
|
108
|
-
"stylistic/nonblock-statement-body-position": ["error", "beside"],
|
|
109
|
-
"stylistic/object-curly-newline": ["error", { consistent: true }],
|
|
110
|
-
"stylistic/object-curly-spacing": ["error", "always"],
|
|
111
|
-
"stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
112
|
-
"stylistic/operator-linebreak": ["error", "before"],
|
|
113
|
-
"stylistic/padded-blocks": ["error", "never"],
|
|
114
|
-
"stylistic/quote-props": ["error", "as-needed", { unnecessary: true, numbers: true }],
|
|
115
|
-
"stylistic/quotes": ["error", "single", { avoidEscape: true }],
|
|
116
|
-
"stylistic/rest-spread-spacing": ["error", "never"],
|
|
117
|
-
"stylistic/semi": ["error", "always"],
|
|
118
|
-
"stylistic/semi-spacing": ["error", { before: false, after: false }],
|
|
119
|
-
"stylistic/semi-style": ["error", "last"],
|
|
120
|
-
"stylistic/space-before-blocks": ["error", "always"],
|
|
121
|
-
"stylistic/space-before-function-paren": ["error", {
|
|
122
|
-
anonymous: "always",
|
|
123
|
-
named: "never",
|
|
124
|
-
asyncArrow: "always"
|
|
125
|
-
}],
|
|
126
|
-
"stylistic/space-in-parens": ["error", "never"],
|
|
127
|
-
"stylistic/space-infix-ops": "error",
|
|
128
|
-
"stylistic/space-unary-ops": [1, {
|
|
129
|
-
words: true,
|
|
130
|
-
nonwords: false
|
|
131
|
-
}],
|
|
132
|
-
"stylistic/spaced-comment": ["error", "always"],
|
|
133
|
-
"stylistic/switch-colon-spacing": ["error", { after: true, before: false }],
|
|
134
|
-
"stylistic/template-curly-spacing": ["error", "never"],
|
|
135
|
-
"stylistic/template-tag-spacing": ["error", "never"],
|
|
136
|
-
"stylistic/type-annotation-spacing": ["error", {
|
|
137
|
-
before: false,
|
|
138
|
-
after: true,
|
|
139
|
-
overrides: {
|
|
140
|
-
arrow: { before: true, after: true }
|
|
141
|
-
}
|
|
142
|
-
}],
|
|
143
|
-
"stylistic/type-generic-spacing": "error",
|
|
144
|
-
"stylistic/type-named-tuple-spacing": "error",
|
|
145
|
-
"stylistic/yield-star-spacing": ["error", "after"]
|
|
146
|
-
};
|
|
147
|
-
async function stylistic(options) {
|
|
148
|
-
if (!options.features?.stylistic) return {};
|
|
149
|
-
const plugin = await interopDefault(import('@stylistic/eslint-plugin'));
|
|
150
|
-
const files = [Glob.All];
|
|
151
|
-
if (options.features.vue) files.push(Glob.Vue);
|
|
152
|
-
const rules = {
|
|
153
|
-
...stylisticRules,
|
|
154
|
-
...options.overrides?.stylistic
|
|
155
|
-
};
|
|
156
|
-
return {
|
|
157
|
-
files,
|
|
158
|
-
plugins: { stylistic: plugin },
|
|
159
|
-
rules
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
35
|
async function vue(options) {
|
|
164
36
|
if (!options.features?.vue) return [];
|
|
165
37
|
const [vuePlugin, vueParser, tsParser] = await Promise.all([
|
|
@@ -168,46 +40,67 @@ async function vue(options) {
|
|
|
168
40
|
interopDefault(import('vue-eslint-parser')),
|
|
169
41
|
interopDefault(import('@typescript-eslint/parser'))
|
|
170
42
|
]);
|
|
171
|
-
const INLINE_ELEMENTS = await json("eslint-plugin-vue/lib/utils/inline-non-void-elements.json");
|
|
172
43
|
const rules = {
|
|
173
44
|
...vuePlugin.configs.base.rules,
|
|
174
45
|
"vue/attribute-hyphenation": ["error", "always"],
|
|
175
46
|
"vue/attributes-order": "error",
|
|
176
|
-
"vue/block-lang": [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
lang: "
|
|
180
|
-
|
|
47
|
+
"vue/block-lang": [
|
|
48
|
+
"error",
|
|
49
|
+
{
|
|
50
|
+
script: { lang: "ts" },
|
|
51
|
+
style: {
|
|
52
|
+
lang: "scss",
|
|
53
|
+
allowNoLang: true
|
|
54
|
+
}
|
|
181
55
|
}
|
|
182
|
-
|
|
183
|
-
"vue/block-order": [
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
56
|
+
],
|
|
57
|
+
"vue/block-order": [
|
|
58
|
+
"error",
|
|
59
|
+
{ order: [["script", "template"], "style:not([scoped])", "style[scoped]"] }
|
|
60
|
+
],
|
|
61
|
+
"vue/block-tag-newline": [
|
|
62
|
+
"error",
|
|
63
|
+
{
|
|
64
|
+
singleline: "always",
|
|
65
|
+
multiline: "always",
|
|
66
|
+
maxEmptyLines: 0
|
|
67
|
+
}
|
|
68
|
+
],
|
|
189
69
|
"vue/component-api-style": ["error", ["script-setup"]],
|
|
190
70
|
"vue/component-definition-name-casing": ["error", "PascalCase"],
|
|
191
|
-
"vue/component-name-in-template-casing": [
|
|
192
|
-
|
|
193
|
-
|
|
71
|
+
"vue/component-name-in-template-casing": [
|
|
72
|
+
"error",
|
|
73
|
+
"PascalCase",
|
|
74
|
+
{
|
|
75
|
+
registeredComponentsOnly: false
|
|
76
|
+
}
|
|
77
|
+
],
|
|
194
78
|
"vue/custom-event-name-casing": ["error", "kebab-case"],
|
|
195
79
|
"vue/define-emits-declaration": ["error", "type-based"],
|
|
196
|
-
"vue/define-macros-order": [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
80
|
+
"vue/define-macros-order": [
|
|
81
|
+
"error",
|
|
82
|
+
{
|
|
83
|
+
order: ["defineOptions", "defineProps", "defineModel", "defineEmits", "defineSlots"],
|
|
84
|
+
defineExposeLast: true
|
|
85
|
+
}
|
|
86
|
+
],
|
|
200
87
|
"vue/define-props-declaration": ["error", "type-based"],
|
|
201
88
|
"vue/enforce-style-attribute": ["error", { allow: ["scoped"] }],
|
|
202
|
-
"vue/html-button-has-type": [
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
89
|
+
"vue/html-button-has-type": [
|
|
90
|
+
"error",
|
|
91
|
+
{
|
|
92
|
+
button: true,
|
|
93
|
+
submit: true,
|
|
94
|
+
reset: true
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"vue/match-component-file-name": [
|
|
98
|
+
"off",
|
|
99
|
+
{
|
|
100
|
+
extensions: ["tsx", "vue"],
|
|
101
|
+
shouldMatchCase: false
|
|
102
|
+
}
|
|
103
|
+
],
|
|
211
104
|
"vue/match-component-import-name": "error",
|
|
212
105
|
"vue/multi-word-component-names": "off",
|
|
213
106
|
"vue/no-arrow-functions-in-watch": "off",
|
|
@@ -216,10 +109,13 @@ async function vue(options) {
|
|
|
216
109
|
"vue/no-computed-properties-in-data": "error",
|
|
217
110
|
"vue/no-dupe-keys": "error",
|
|
218
111
|
"vue/no-dupe-v-else-if": "error",
|
|
219
|
-
"vue/no-duplicate-attributes": [
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
112
|
+
"vue/no-duplicate-attributes": [
|
|
113
|
+
"error",
|
|
114
|
+
{
|
|
115
|
+
allowCoexistClass: true,
|
|
116
|
+
allowCoexistStyle: true
|
|
117
|
+
}
|
|
118
|
+
],
|
|
223
119
|
"vue/no-export-in-script-setup": "error",
|
|
224
120
|
"vue/no-expose-after-await": "error",
|
|
225
121
|
"vue/no-lifecycle-after-await": "error",
|
|
@@ -250,10 +146,13 @@ async function vue(options) {
|
|
|
250
146
|
"vue/no-use-computed-property-like-method": "error",
|
|
251
147
|
"vue/no-use-v-else-with-v-for": "error",
|
|
252
148
|
"vue/no-use-v-if-with-v-for": "error",
|
|
253
|
-
"vue/no-useless-mustaches": [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
149
|
+
"vue/no-useless-mustaches": [
|
|
150
|
+
"error",
|
|
151
|
+
{
|
|
152
|
+
ignoreIncludesComment: false,
|
|
153
|
+
ignoreStringEscape: false
|
|
154
|
+
}
|
|
155
|
+
],
|
|
257
156
|
"vue/no-useless-template-attributes": "error",
|
|
258
157
|
"vue/no-useless-v-bind": "error",
|
|
259
158
|
"vue/no-v-for-template-key-on-child": "error",
|
|
@@ -271,13 +170,16 @@ async function vue(options) {
|
|
|
271
170
|
"vue/require-default-prop": "off",
|
|
272
171
|
"vue/require-explicit-emits": ["error", { allowProps: false }],
|
|
273
172
|
"vue/require-explicit-slots": "error",
|
|
274
|
-
"vue/require-macro-variable-name": [
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
173
|
+
"vue/require-macro-variable-name": [
|
|
174
|
+
"error",
|
|
175
|
+
{
|
|
176
|
+
defineProps: "props",
|
|
177
|
+
defineEmits: "emit",
|
|
178
|
+
defineSlots: "slots",
|
|
179
|
+
useSlots: "slots",
|
|
180
|
+
useAttrs: "attrs"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
281
183
|
"vue/require-prop-types": "error",
|
|
282
184
|
"vue/require-render-return": "error",
|
|
283
185
|
"vue/require-slots-as-functions": "error",
|
|
@@ -289,17 +191,24 @@ async function vue(options) {
|
|
|
289
191
|
"vue/return-in-emits-validator": "error",
|
|
290
192
|
"vue/this-in-template": ["error", "never"],
|
|
291
193
|
"vue/use-v-on-exact": "error",
|
|
292
|
-
"vue/v-bind-style": [
|
|
293
|
-
|
|
294
|
-
|
|
194
|
+
"vue/v-bind-style": [
|
|
195
|
+
"error",
|
|
196
|
+
"shorthand",
|
|
197
|
+
{
|
|
198
|
+
sameNameShorthand: "always"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
295
201
|
"vue/v-for-delimiter-style": ["error", "of"],
|
|
296
202
|
"vue/v-on-handler-style": "off",
|
|
297
203
|
"vue/v-on-style": ["error", "shorthand"],
|
|
298
|
-
"vue/v-slot-style": [
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
204
|
+
"vue/v-slot-style": [
|
|
205
|
+
"error",
|
|
206
|
+
{
|
|
207
|
+
atComponent: "shorthand",
|
|
208
|
+
default: "shorthand",
|
|
209
|
+
named: "shorthand"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
303
212
|
"vue/v-on-event-hyphenation": ["error", "always"],
|
|
304
213
|
"vue/valid-attribute-name": "error",
|
|
305
214
|
"vue/valid-define-emits": "error",
|
|
@@ -324,87 +233,6 @@ async function vue(options) {
|
|
|
324
233
|
"vue/valid-v-text": "error",
|
|
325
234
|
...options.overrides?.vue
|
|
326
235
|
};
|
|
327
|
-
if (options.features.stylistic) {
|
|
328
|
-
Object.assign(rules, {
|
|
329
|
-
"vue/first-attribute-linebreak": ["error", {
|
|
330
|
-
singleline: "beside",
|
|
331
|
-
multiline: "below"
|
|
332
|
-
}],
|
|
333
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
334
|
-
singleline: "never",
|
|
335
|
-
multiline: "always",
|
|
336
|
-
selfClosingTag: {
|
|
337
|
-
singleline: "never",
|
|
338
|
-
multiline: "always"
|
|
339
|
-
}
|
|
340
|
-
}],
|
|
341
|
-
"vue/html-closing-bracket-spacing": ["error", {
|
|
342
|
-
startTag: "never",
|
|
343
|
-
endTag: "never",
|
|
344
|
-
selfClosingTag: "always"
|
|
345
|
-
}],
|
|
346
|
-
"vue/html-indent": ["error", 2, {
|
|
347
|
-
attribute: 1,
|
|
348
|
-
baseIndent: 1,
|
|
349
|
-
closeBracket: 0,
|
|
350
|
-
alignAttributesVertically: true,
|
|
351
|
-
ignores: []
|
|
352
|
-
}],
|
|
353
|
-
"vue/html-quotes": ["error", "double", { avoidEscape: false }],
|
|
354
|
-
"vue/html-self-closing": ["error", {
|
|
355
|
-
html: {
|
|
356
|
-
void: "never",
|
|
357
|
-
normal: "any",
|
|
358
|
-
component: "always"
|
|
359
|
-
},
|
|
360
|
-
svg: "always",
|
|
361
|
-
math: "always"
|
|
362
|
-
}],
|
|
363
|
-
"vue/max-attributes-per-line": ["error", {
|
|
364
|
-
singleline: Number.MAX_SAFE_INTEGER,
|
|
365
|
-
multiline: 1
|
|
366
|
-
}],
|
|
367
|
-
"vue/multiline-html-element-content-newline": ["error", {
|
|
368
|
-
ignoreWhenEmpty: true,
|
|
369
|
-
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
370
|
-
allowEmptyLines: false
|
|
371
|
-
}],
|
|
372
|
-
"vue/mustache-interpolation-spacing": ["error", "always"],
|
|
373
|
-
"vue/no-multi-spaces": ["error", { ignoreProperties: false }],
|
|
374
|
-
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
375
|
-
"vue/singleline-html-element-content-newline": ["off", {
|
|
376
|
-
ignoreWhenNoAttributes: true,
|
|
377
|
-
ignoreWhenEmpty: true,
|
|
378
|
-
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
379
|
-
externalIgnores: []
|
|
380
|
-
}]
|
|
381
|
-
});
|
|
382
|
-
const vueStylistic = [
|
|
383
|
-
"vue/array-bracket-newline",
|
|
384
|
-
"vue/array-bracket-spacing",
|
|
385
|
-
"vue/array-element-newline",
|
|
386
|
-
"vue/key-spacing",
|
|
387
|
-
"vue/keyword-spacing",
|
|
388
|
-
"vue/max-len",
|
|
389
|
-
"vue/no-extra-parens",
|
|
390
|
-
"vue/object-curly-newline",
|
|
391
|
-
"vue/object-curly-spacing",
|
|
392
|
-
"vue/object-property-newline",
|
|
393
|
-
"vue/operator-linebreak",
|
|
394
|
-
"vue/quote-props",
|
|
395
|
-
"vue/space-in-parens",
|
|
396
|
-
"vue/space-infix-ops",
|
|
397
|
-
"vue/space-unary-ops",
|
|
398
|
-
"vue/template-curly-spacing"
|
|
399
|
-
];
|
|
400
|
-
Object.assign(rules, vueStylistic.reduce((acc, rule) => {
|
|
401
|
-
const name = rule.replace("vue/", "stylistic/");
|
|
402
|
-
if (Object.hasOwn(stylisticRules, name)) {
|
|
403
|
-
acc[rule] = stylisticRules[name];
|
|
404
|
-
}
|
|
405
|
-
return acc;
|
|
406
|
-
}, {}));
|
|
407
|
-
}
|
|
408
236
|
return [
|
|
409
237
|
{ plugins: { vue: vuePlugin } },
|
|
410
238
|
{
|
|
@@ -429,58 +257,6 @@ async function vue(options) {
|
|
|
429
257
|
];
|
|
430
258
|
}
|
|
431
259
|
|
|
432
|
-
async function jsonc(options) {
|
|
433
|
-
if (!options.features?.jsonc) return [];
|
|
434
|
-
const [jsoncPlugin, jsoncParser] = await Promise.all([
|
|
435
|
-
interopDefault(import('eslint-plugin-jsonc')),
|
|
436
|
-
interopDefault(import('jsonc-eslint-parser'))
|
|
437
|
-
]);
|
|
438
|
-
const rules = {
|
|
439
|
-
"jsonc/no-bigint-literals": "error",
|
|
440
|
-
"jsonc/no-binary-expression": "error",
|
|
441
|
-
"jsonc/no-binary-numeric-literals": "error",
|
|
442
|
-
"jsonc/no-infinity": "error",
|
|
443
|
-
"jsonc/no-nan": "error",
|
|
444
|
-
"jsonc/no-number-props": "error",
|
|
445
|
-
"jsonc/no-undefined-value": "error",
|
|
446
|
-
"jsonc/valid-json-number": "error",
|
|
447
|
-
...options.overrides?.jsonc
|
|
448
|
-
};
|
|
449
|
-
if (options.features.stylistic) {
|
|
450
|
-
Object.assign(rules, {
|
|
451
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
452
|
-
"jsonc/quotes": ["error", "double", { avoidEscape: false }],
|
|
453
|
-
"jsonc/space-unary-ops": "error"
|
|
454
|
-
});
|
|
455
|
-
const jsoncStylistic = [
|
|
456
|
-
"jsonc/array-bracket-newline",
|
|
457
|
-
"jsonc/array-bracket-spacing",
|
|
458
|
-
"jsonc/array-element-newline",
|
|
459
|
-
"jsonc/comma-style",
|
|
460
|
-
"jsonc/indent",
|
|
461
|
-
"jsonc/key-spacing",
|
|
462
|
-
"jsonc/object-curly-newline",
|
|
463
|
-
"jsonc/object-curly-spacing",
|
|
464
|
-
"jsonc/object-property-newline"
|
|
465
|
-
];
|
|
466
|
-
Object.assign(rules, jsoncStylistic.reduce((acc, rule) => {
|
|
467
|
-
const name = rule.replace("jsonc/", "stylistic/");
|
|
468
|
-
if (Object.hasOwn(stylisticRules, name)) {
|
|
469
|
-
acc[rule] = stylisticRules[name];
|
|
470
|
-
}
|
|
471
|
-
return acc;
|
|
472
|
-
}, {}));
|
|
473
|
-
}
|
|
474
|
-
return [
|
|
475
|
-
{ plugins: { jsonc: jsoncPlugin } },
|
|
476
|
-
{
|
|
477
|
-
files: [Glob.Json],
|
|
478
|
-
languageOptions: { parser: jsoncParser }
|
|
479
|
-
},
|
|
480
|
-
{ rules }
|
|
481
|
-
];
|
|
482
|
-
}
|
|
483
|
-
|
|
484
260
|
async function unicorn(options) {
|
|
485
261
|
const { unicorn: enabled = true } = options.features ?? {};
|
|
486
262
|
if (!enabled) return {};
|
|
@@ -538,7 +314,6 @@ async function tailwind(options) {
|
|
|
538
314
|
const plugin = await interopDefault(import('eslint-plugin-tailwindcss'));
|
|
539
315
|
const callees = ["classnames", "clsx", "cn", "ctl", "cva", "tv"];
|
|
540
316
|
const rules = {
|
|
541
|
-
"tailwindcss/classnames-order": ["error", { callees }],
|
|
542
317
|
"tailwindcss/enforces-shorthand": ["error", { callees }],
|
|
543
318
|
"tailwindcss/no-contradicting-classname": ["error", { callees }],
|
|
544
319
|
...options.overrides?.tailwind
|
|
@@ -991,8 +766,6 @@ async function defineConfig(options) {
|
|
|
991
766
|
javascript(options),
|
|
992
767
|
typescript(options),
|
|
993
768
|
...await vue(options),
|
|
994
|
-
...await jsonc(options),
|
|
995
|
-
stylistic(options),
|
|
996
769
|
perfectionist(options),
|
|
997
770
|
unicorn(options),
|
|
998
771
|
tailwind(options),
|
package/dist/index.d.ts
CHANGED
|
@@ -16,13 +16,9 @@ declare interface ConfigObject {
|
|
|
16
16
|
|
|
17
17
|
declare interface ConfigOptions {
|
|
18
18
|
features?: {
|
|
19
|
-
/** @default false */
|
|
20
|
-
jsonc?: boolean;
|
|
21
19
|
/** @default true */
|
|
22
20
|
perfectionist?: boolean;
|
|
23
21
|
/** @default false */
|
|
24
|
-
stylistic?: boolean;
|
|
25
|
-
/** @default false */
|
|
26
22
|
tailwind?: boolean;
|
|
27
23
|
/** @default true */
|
|
28
24
|
unicorn?: boolean;
|
|
@@ -34,9 +30,7 @@ declare interface ConfigOptions {
|
|
|
34
30
|
ignores?: Ignores['ignores'];
|
|
35
31
|
overrides?: {
|
|
36
32
|
javascript?: Rules;
|
|
37
|
-
jsonc?: Rules;
|
|
38
33
|
perfectionist?: Rules;
|
|
39
|
-
stylistic?: Rules;
|
|
40
34
|
tailwind?: Rules;
|
|
41
35
|
typescript?: Rules;
|
|
42
36
|
unicorn?: Rules;
|
package/dist/index.js
CHANGED
|
@@ -4,12 +4,12 @@ import globals from 'globals';
|
|
|
4
4
|
var Glob = /* @__PURE__ */ ((Glob2) => {
|
|
5
5
|
Glob2["All"] = "**/*.?([cm])[jt]s?(x)";
|
|
6
6
|
Glob2["Javascript"] = "**/*.?([cm])js?(x)";
|
|
7
|
-
Glob2["Json"] = "**/*.json?([c5])";
|
|
8
7
|
Glob2["Typescript"] = "**/*.?([cm])ts?(x)";
|
|
9
8
|
Glob2["Vue"] = "**/*.vue";
|
|
10
9
|
return Glob2;
|
|
11
10
|
})(Glob || {});
|
|
12
11
|
var GlobIgnore = /* @__PURE__ */ ((GlobIgnore2) => {
|
|
12
|
+
GlobIgnore2["Autogenerated"] = "**/autogenerated";
|
|
13
13
|
GlobIgnore2["Cache"] = "**/cache";
|
|
14
14
|
GlobIgnore2["Dist"] = "**/dist";
|
|
15
15
|
GlobIgnore2["Log"] = "**/log?(s)";
|
|
@@ -24,138 +24,10 @@ async function interopDefault(promise) {
|
|
|
24
24
|
const result = await promise;
|
|
25
25
|
return result.default ?? result;
|
|
26
26
|
}
|
|
27
|
-
async function json(path) {
|
|
28
|
-
return interopDefault(import(path, { with: { type: "json" } }));
|
|
29
|
-
}
|
|
30
27
|
function getIgnores() {
|
|
31
28
|
return Object.values(GlobIgnore);
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
const stylisticRules = {
|
|
35
|
-
"stylistic/array-bracket-newline": ["error", "consistent"],
|
|
36
|
-
"stylistic/array-bracket-spacing": ["error", "never"],
|
|
37
|
-
"stylistic/array-element-newline": ["error", "consistent"],
|
|
38
|
-
"stylistic/arrow-parens": ["error", "always"],
|
|
39
|
-
"stylistic/arrow-spacing": "error",
|
|
40
|
-
"stylistic/block-spacing": "error",
|
|
41
|
-
"stylistic/brace-style": ["error", "stroustrup"],
|
|
42
|
-
"stylistic/comma-dangle": ["error", {
|
|
43
|
-
arrays: "always-multiline",
|
|
44
|
-
objects: "always-multiline",
|
|
45
|
-
imports: "always-multiline",
|
|
46
|
-
exports: "always-multiline",
|
|
47
|
-
functions: "always-multiline",
|
|
48
|
-
enums: "always-multiline"
|
|
49
|
-
}],
|
|
50
|
-
"stylistic/comma-spacing": ["error", { before: false, after: true }],
|
|
51
|
-
"stylistic/comma-style": ["error", "last"],
|
|
52
|
-
"stylistic/computed-property-spacing": ["error", "never"],
|
|
53
|
-
"stylistic/dot-location": ["error", "property"],
|
|
54
|
-
"stylistic/eol-last": ["error", "always"],
|
|
55
|
-
"stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
56
|
-
"stylistic/function-call-spacing": ["error", "never"],
|
|
57
|
-
"stylistic/function-paren-newline": ["error", "never"],
|
|
58
|
-
"stylistic/generator-star-spacing": ["error", {
|
|
59
|
-
before: false,
|
|
60
|
-
after: true,
|
|
61
|
-
method: { before: true, after: false }
|
|
62
|
-
}],
|
|
63
|
-
"stylistic/implicit-arrow-linebreak": ["error", "beside"],
|
|
64
|
-
"stylistic/indent": ["error", 2, { flatTernaryExpressions: true }],
|
|
65
|
-
"stylistic/indent-binary-ops": ["error", 2],
|
|
66
|
-
"stylistic/key-spacing": ["error", { afterColon: true, beforeColon: false, mode: "strict" }],
|
|
67
|
-
"stylistic/keyword-spacing": ["error", { after: true, before: true }],
|
|
68
|
-
"stylistic/line-comment-position": ["error", { position: "above" }],
|
|
69
|
-
"stylistic/linebreak-style": ["error", "unix"],
|
|
70
|
-
"stylistic/lines-between-class-members": ["error", {
|
|
71
|
-
enforce: [
|
|
72
|
-
{ blankLine: "always", prev: "method", next: "method" }
|
|
73
|
-
]
|
|
74
|
-
}],
|
|
75
|
-
"stylistic/max-len": ["error", {
|
|
76
|
-
code: 100,
|
|
77
|
-
tabWidth: 2,
|
|
78
|
-
ignoreComments: true,
|
|
79
|
-
ignoreTrailingComments: true,
|
|
80
|
-
ignoreUrls: true,
|
|
81
|
-
ignoreStrings: true,
|
|
82
|
-
ignoreTemplateLiterals: true,
|
|
83
|
-
ignoreRegExpLiterals: true
|
|
84
|
-
}],
|
|
85
|
-
"stylistic/member-delimiter-style": ["error", {
|
|
86
|
-
multiline: { delimiter: "semi", requireLast: true },
|
|
87
|
-
singleline: { delimiter: "semi", requireLast: true }
|
|
88
|
-
}],
|
|
89
|
-
"stylistic/new-parens": ["error", "always"],
|
|
90
|
-
"stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 2 }],
|
|
91
|
-
"stylistic/no-confusing-arrow": ["error", { allowParens: true }],
|
|
92
|
-
"stylistic/no-extra-parens": ["error", "all", {
|
|
93
|
-
nestedBinaryExpressions: false,
|
|
94
|
-
ternaryOperandBinaryExpressions: false
|
|
95
|
-
}],
|
|
96
|
-
"stylistic/no-extra-semi": "error",
|
|
97
|
-
"stylistic/no-floating-decimal": "error",
|
|
98
|
-
"stylistic/no-mixed-spaces-and-tabs": "error",
|
|
99
|
-
"stylistic/no-multi-spaces": "error",
|
|
100
|
-
"stylistic/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0 }],
|
|
101
|
-
"stylistic/no-tabs": "error",
|
|
102
|
-
"stylistic/no-trailing-spaces": "error",
|
|
103
|
-
"stylistic/no-whitespace-before-property": "error",
|
|
104
|
-
"stylistic/nonblock-statement-body-position": ["error", "beside"],
|
|
105
|
-
"stylistic/object-curly-newline": ["error", { consistent: true }],
|
|
106
|
-
"stylistic/object-curly-spacing": ["error", "always"],
|
|
107
|
-
"stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
108
|
-
"stylistic/operator-linebreak": ["error", "before"],
|
|
109
|
-
"stylistic/padded-blocks": ["error", "never"],
|
|
110
|
-
"stylistic/quote-props": ["error", "as-needed", { unnecessary: true, numbers: true }],
|
|
111
|
-
"stylistic/quotes": ["error", "single", { avoidEscape: true }],
|
|
112
|
-
"stylistic/rest-spread-spacing": ["error", "never"],
|
|
113
|
-
"stylistic/semi": ["error", "always"],
|
|
114
|
-
"stylistic/semi-spacing": ["error", { before: false, after: false }],
|
|
115
|
-
"stylistic/semi-style": ["error", "last"],
|
|
116
|
-
"stylistic/space-before-blocks": ["error", "always"],
|
|
117
|
-
"stylistic/space-before-function-paren": ["error", {
|
|
118
|
-
anonymous: "always",
|
|
119
|
-
named: "never",
|
|
120
|
-
asyncArrow: "always"
|
|
121
|
-
}],
|
|
122
|
-
"stylistic/space-in-parens": ["error", "never"],
|
|
123
|
-
"stylistic/space-infix-ops": "error",
|
|
124
|
-
"stylistic/space-unary-ops": [1, {
|
|
125
|
-
words: true,
|
|
126
|
-
nonwords: false
|
|
127
|
-
}],
|
|
128
|
-
"stylistic/spaced-comment": ["error", "always"],
|
|
129
|
-
"stylistic/switch-colon-spacing": ["error", { after: true, before: false }],
|
|
130
|
-
"stylistic/template-curly-spacing": ["error", "never"],
|
|
131
|
-
"stylistic/template-tag-spacing": ["error", "never"],
|
|
132
|
-
"stylistic/type-annotation-spacing": ["error", {
|
|
133
|
-
before: false,
|
|
134
|
-
after: true,
|
|
135
|
-
overrides: {
|
|
136
|
-
arrow: { before: true, after: true }
|
|
137
|
-
}
|
|
138
|
-
}],
|
|
139
|
-
"stylistic/type-generic-spacing": "error",
|
|
140
|
-
"stylistic/type-named-tuple-spacing": "error",
|
|
141
|
-
"stylistic/yield-star-spacing": ["error", "after"]
|
|
142
|
-
};
|
|
143
|
-
async function stylistic(options) {
|
|
144
|
-
if (!options.features?.stylistic) return {};
|
|
145
|
-
const plugin = await interopDefault(import('@stylistic/eslint-plugin'));
|
|
146
|
-
const files = [Glob.All];
|
|
147
|
-
if (options.features.vue) files.push(Glob.Vue);
|
|
148
|
-
const rules = {
|
|
149
|
-
...stylisticRules,
|
|
150
|
-
...options.overrides?.stylistic
|
|
151
|
-
};
|
|
152
|
-
return {
|
|
153
|
-
files,
|
|
154
|
-
plugins: { stylistic: plugin },
|
|
155
|
-
rules
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
|
|
159
31
|
async function vue(options) {
|
|
160
32
|
if (!options.features?.vue) return [];
|
|
161
33
|
const [vuePlugin, vueParser, tsParser] = await Promise.all([
|
|
@@ -164,46 +36,67 @@ async function vue(options) {
|
|
|
164
36
|
interopDefault(import('vue-eslint-parser')),
|
|
165
37
|
interopDefault(import('@typescript-eslint/parser'))
|
|
166
38
|
]);
|
|
167
|
-
const INLINE_ELEMENTS = await json("eslint-plugin-vue/lib/utils/inline-non-void-elements.json");
|
|
168
39
|
const rules = {
|
|
169
40
|
...vuePlugin.configs.base.rules,
|
|
170
41
|
"vue/attribute-hyphenation": ["error", "always"],
|
|
171
42
|
"vue/attributes-order": "error",
|
|
172
|
-
"vue/block-lang": [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
lang: "
|
|
176
|
-
|
|
43
|
+
"vue/block-lang": [
|
|
44
|
+
"error",
|
|
45
|
+
{
|
|
46
|
+
script: { lang: "ts" },
|
|
47
|
+
style: {
|
|
48
|
+
lang: "scss",
|
|
49
|
+
allowNoLang: true
|
|
50
|
+
}
|
|
177
51
|
}
|
|
178
|
-
|
|
179
|
-
"vue/block-order": [
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
52
|
+
],
|
|
53
|
+
"vue/block-order": [
|
|
54
|
+
"error",
|
|
55
|
+
{ order: [["script", "template"], "style:not([scoped])", "style[scoped]"] }
|
|
56
|
+
],
|
|
57
|
+
"vue/block-tag-newline": [
|
|
58
|
+
"error",
|
|
59
|
+
{
|
|
60
|
+
singleline: "always",
|
|
61
|
+
multiline: "always",
|
|
62
|
+
maxEmptyLines: 0
|
|
63
|
+
}
|
|
64
|
+
],
|
|
185
65
|
"vue/component-api-style": ["error", ["script-setup"]],
|
|
186
66
|
"vue/component-definition-name-casing": ["error", "PascalCase"],
|
|
187
|
-
"vue/component-name-in-template-casing": [
|
|
188
|
-
|
|
189
|
-
|
|
67
|
+
"vue/component-name-in-template-casing": [
|
|
68
|
+
"error",
|
|
69
|
+
"PascalCase",
|
|
70
|
+
{
|
|
71
|
+
registeredComponentsOnly: false
|
|
72
|
+
}
|
|
73
|
+
],
|
|
190
74
|
"vue/custom-event-name-casing": ["error", "kebab-case"],
|
|
191
75
|
"vue/define-emits-declaration": ["error", "type-based"],
|
|
192
|
-
"vue/define-macros-order": [
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
76
|
+
"vue/define-macros-order": [
|
|
77
|
+
"error",
|
|
78
|
+
{
|
|
79
|
+
order: ["defineOptions", "defineProps", "defineModel", "defineEmits", "defineSlots"],
|
|
80
|
+
defineExposeLast: true
|
|
81
|
+
}
|
|
82
|
+
],
|
|
196
83
|
"vue/define-props-declaration": ["error", "type-based"],
|
|
197
84
|
"vue/enforce-style-attribute": ["error", { allow: ["scoped"] }],
|
|
198
|
-
"vue/html-button-has-type": [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
85
|
+
"vue/html-button-has-type": [
|
|
86
|
+
"error",
|
|
87
|
+
{
|
|
88
|
+
button: true,
|
|
89
|
+
submit: true,
|
|
90
|
+
reset: true
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"vue/match-component-file-name": [
|
|
94
|
+
"off",
|
|
95
|
+
{
|
|
96
|
+
extensions: ["tsx", "vue"],
|
|
97
|
+
shouldMatchCase: false
|
|
98
|
+
}
|
|
99
|
+
],
|
|
207
100
|
"vue/match-component-import-name": "error",
|
|
208
101
|
"vue/multi-word-component-names": "off",
|
|
209
102
|
"vue/no-arrow-functions-in-watch": "off",
|
|
@@ -212,10 +105,13 @@ async function vue(options) {
|
|
|
212
105
|
"vue/no-computed-properties-in-data": "error",
|
|
213
106
|
"vue/no-dupe-keys": "error",
|
|
214
107
|
"vue/no-dupe-v-else-if": "error",
|
|
215
|
-
"vue/no-duplicate-attributes": [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
108
|
+
"vue/no-duplicate-attributes": [
|
|
109
|
+
"error",
|
|
110
|
+
{
|
|
111
|
+
allowCoexistClass: true,
|
|
112
|
+
allowCoexistStyle: true
|
|
113
|
+
}
|
|
114
|
+
],
|
|
219
115
|
"vue/no-export-in-script-setup": "error",
|
|
220
116
|
"vue/no-expose-after-await": "error",
|
|
221
117
|
"vue/no-lifecycle-after-await": "error",
|
|
@@ -246,10 +142,13 @@ async function vue(options) {
|
|
|
246
142
|
"vue/no-use-computed-property-like-method": "error",
|
|
247
143
|
"vue/no-use-v-else-with-v-for": "error",
|
|
248
144
|
"vue/no-use-v-if-with-v-for": "error",
|
|
249
|
-
"vue/no-useless-mustaches": [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
145
|
+
"vue/no-useless-mustaches": [
|
|
146
|
+
"error",
|
|
147
|
+
{
|
|
148
|
+
ignoreIncludesComment: false,
|
|
149
|
+
ignoreStringEscape: false
|
|
150
|
+
}
|
|
151
|
+
],
|
|
253
152
|
"vue/no-useless-template-attributes": "error",
|
|
254
153
|
"vue/no-useless-v-bind": "error",
|
|
255
154
|
"vue/no-v-for-template-key-on-child": "error",
|
|
@@ -267,13 +166,16 @@ async function vue(options) {
|
|
|
267
166
|
"vue/require-default-prop": "off",
|
|
268
167
|
"vue/require-explicit-emits": ["error", { allowProps: false }],
|
|
269
168
|
"vue/require-explicit-slots": "error",
|
|
270
|
-
"vue/require-macro-variable-name": [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
169
|
+
"vue/require-macro-variable-name": [
|
|
170
|
+
"error",
|
|
171
|
+
{
|
|
172
|
+
defineProps: "props",
|
|
173
|
+
defineEmits: "emit",
|
|
174
|
+
defineSlots: "slots",
|
|
175
|
+
useSlots: "slots",
|
|
176
|
+
useAttrs: "attrs"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
277
179
|
"vue/require-prop-types": "error",
|
|
278
180
|
"vue/require-render-return": "error",
|
|
279
181
|
"vue/require-slots-as-functions": "error",
|
|
@@ -285,17 +187,24 @@ async function vue(options) {
|
|
|
285
187
|
"vue/return-in-emits-validator": "error",
|
|
286
188
|
"vue/this-in-template": ["error", "never"],
|
|
287
189
|
"vue/use-v-on-exact": "error",
|
|
288
|
-
"vue/v-bind-style": [
|
|
289
|
-
|
|
290
|
-
|
|
190
|
+
"vue/v-bind-style": [
|
|
191
|
+
"error",
|
|
192
|
+
"shorthand",
|
|
193
|
+
{
|
|
194
|
+
sameNameShorthand: "always"
|
|
195
|
+
}
|
|
196
|
+
],
|
|
291
197
|
"vue/v-for-delimiter-style": ["error", "of"],
|
|
292
198
|
"vue/v-on-handler-style": "off",
|
|
293
199
|
"vue/v-on-style": ["error", "shorthand"],
|
|
294
|
-
"vue/v-slot-style": [
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
200
|
+
"vue/v-slot-style": [
|
|
201
|
+
"error",
|
|
202
|
+
{
|
|
203
|
+
atComponent: "shorthand",
|
|
204
|
+
default: "shorthand",
|
|
205
|
+
named: "shorthand"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
299
208
|
"vue/v-on-event-hyphenation": ["error", "always"],
|
|
300
209
|
"vue/valid-attribute-name": "error",
|
|
301
210
|
"vue/valid-define-emits": "error",
|
|
@@ -320,87 +229,6 @@ async function vue(options) {
|
|
|
320
229
|
"vue/valid-v-text": "error",
|
|
321
230
|
...options.overrides?.vue
|
|
322
231
|
};
|
|
323
|
-
if (options.features.stylistic) {
|
|
324
|
-
Object.assign(rules, {
|
|
325
|
-
"vue/first-attribute-linebreak": ["error", {
|
|
326
|
-
singleline: "beside",
|
|
327
|
-
multiline: "below"
|
|
328
|
-
}],
|
|
329
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
330
|
-
singleline: "never",
|
|
331
|
-
multiline: "always",
|
|
332
|
-
selfClosingTag: {
|
|
333
|
-
singleline: "never",
|
|
334
|
-
multiline: "always"
|
|
335
|
-
}
|
|
336
|
-
}],
|
|
337
|
-
"vue/html-closing-bracket-spacing": ["error", {
|
|
338
|
-
startTag: "never",
|
|
339
|
-
endTag: "never",
|
|
340
|
-
selfClosingTag: "always"
|
|
341
|
-
}],
|
|
342
|
-
"vue/html-indent": ["error", 2, {
|
|
343
|
-
attribute: 1,
|
|
344
|
-
baseIndent: 1,
|
|
345
|
-
closeBracket: 0,
|
|
346
|
-
alignAttributesVertically: true,
|
|
347
|
-
ignores: []
|
|
348
|
-
}],
|
|
349
|
-
"vue/html-quotes": ["error", "double", { avoidEscape: false }],
|
|
350
|
-
"vue/html-self-closing": ["error", {
|
|
351
|
-
html: {
|
|
352
|
-
void: "never",
|
|
353
|
-
normal: "any",
|
|
354
|
-
component: "always"
|
|
355
|
-
},
|
|
356
|
-
svg: "always",
|
|
357
|
-
math: "always"
|
|
358
|
-
}],
|
|
359
|
-
"vue/max-attributes-per-line": ["error", {
|
|
360
|
-
singleline: Number.MAX_SAFE_INTEGER,
|
|
361
|
-
multiline: 1
|
|
362
|
-
}],
|
|
363
|
-
"vue/multiline-html-element-content-newline": ["error", {
|
|
364
|
-
ignoreWhenEmpty: true,
|
|
365
|
-
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
366
|
-
allowEmptyLines: false
|
|
367
|
-
}],
|
|
368
|
-
"vue/mustache-interpolation-spacing": ["error", "always"],
|
|
369
|
-
"vue/no-multi-spaces": ["error", { ignoreProperties: false }],
|
|
370
|
-
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
371
|
-
"vue/singleline-html-element-content-newline": ["off", {
|
|
372
|
-
ignoreWhenNoAttributes: true,
|
|
373
|
-
ignoreWhenEmpty: true,
|
|
374
|
-
ignores: ["pre", "textarea", ...INLINE_ELEMENTS],
|
|
375
|
-
externalIgnores: []
|
|
376
|
-
}]
|
|
377
|
-
});
|
|
378
|
-
const vueStylistic = [
|
|
379
|
-
"vue/array-bracket-newline",
|
|
380
|
-
"vue/array-bracket-spacing",
|
|
381
|
-
"vue/array-element-newline",
|
|
382
|
-
"vue/key-spacing",
|
|
383
|
-
"vue/keyword-spacing",
|
|
384
|
-
"vue/max-len",
|
|
385
|
-
"vue/no-extra-parens",
|
|
386
|
-
"vue/object-curly-newline",
|
|
387
|
-
"vue/object-curly-spacing",
|
|
388
|
-
"vue/object-property-newline",
|
|
389
|
-
"vue/operator-linebreak",
|
|
390
|
-
"vue/quote-props",
|
|
391
|
-
"vue/space-in-parens",
|
|
392
|
-
"vue/space-infix-ops",
|
|
393
|
-
"vue/space-unary-ops",
|
|
394
|
-
"vue/template-curly-spacing"
|
|
395
|
-
];
|
|
396
|
-
Object.assign(rules, vueStylistic.reduce((acc, rule) => {
|
|
397
|
-
const name = rule.replace("vue/", "stylistic/");
|
|
398
|
-
if (Object.hasOwn(stylisticRules, name)) {
|
|
399
|
-
acc[rule] = stylisticRules[name];
|
|
400
|
-
}
|
|
401
|
-
return acc;
|
|
402
|
-
}, {}));
|
|
403
|
-
}
|
|
404
232
|
return [
|
|
405
233
|
{ plugins: { vue: vuePlugin } },
|
|
406
234
|
{
|
|
@@ -425,58 +253,6 @@ async function vue(options) {
|
|
|
425
253
|
];
|
|
426
254
|
}
|
|
427
255
|
|
|
428
|
-
async function jsonc(options) {
|
|
429
|
-
if (!options.features?.jsonc) return [];
|
|
430
|
-
const [jsoncPlugin, jsoncParser] = await Promise.all([
|
|
431
|
-
interopDefault(import('eslint-plugin-jsonc')),
|
|
432
|
-
interopDefault(import('jsonc-eslint-parser'))
|
|
433
|
-
]);
|
|
434
|
-
const rules = {
|
|
435
|
-
"jsonc/no-bigint-literals": "error",
|
|
436
|
-
"jsonc/no-binary-expression": "error",
|
|
437
|
-
"jsonc/no-binary-numeric-literals": "error",
|
|
438
|
-
"jsonc/no-infinity": "error",
|
|
439
|
-
"jsonc/no-nan": "error",
|
|
440
|
-
"jsonc/no-number-props": "error",
|
|
441
|
-
"jsonc/no-undefined-value": "error",
|
|
442
|
-
"jsonc/valid-json-number": "error",
|
|
443
|
-
...options.overrides?.jsonc
|
|
444
|
-
};
|
|
445
|
-
if (options.features.stylistic) {
|
|
446
|
-
Object.assign(rules, {
|
|
447
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
448
|
-
"jsonc/quotes": ["error", "double", { avoidEscape: false }],
|
|
449
|
-
"jsonc/space-unary-ops": "error"
|
|
450
|
-
});
|
|
451
|
-
const jsoncStylistic = [
|
|
452
|
-
"jsonc/array-bracket-newline",
|
|
453
|
-
"jsonc/array-bracket-spacing",
|
|
454
|
-
"jsonc/array-element-newline",
|
|
455
|
-
"jsonc/comma-style",
|
|
456
|
-
"jsonc/indent",
|
|
457
|
-
"jsonc/key-spacing",
|
|
458
|
-
"jsonc/object-curly-newline",
|
|
459
|
-
"jsonc/object-curly-spacing",
|
|
460
|
-
"jsonc/object-property-newline"
|
|
461
|
-
];
|
|
462
|
-
Object.assign(rules, jsoncStylistic.reduce((acc, rule) => {
|
|
463
|
-
const name = rule.replace("jsonc/", "stylistic/");
|
|
464
|
-
if (Object.hasOwn(stylisticRules, name)) {
|
|
465
|
-
acc[rule] = stylisticRules[name];
|
|
466
|
-
}
|
|
467
|
-
return acc;
|
|
468
|
-
}, {}));
|
|
469
|
-
}
|
|
470
|
-
return [
|
|
471
|
-
{ plugins: { jsonc: jsoncPlugin } },
|
|
472
|
-
{
|
|
473
|
-
files: [Glob.Json],
|
|
474
|
-
languageOptions: { parser: jsoncParser }
|
|
475
|
-
},
|
|
476
|
-
{ rules }
|
|
477
|
-
];
|
|
478
|
-
}
|
|
479
|
-
|
|
480
256
|
async function unicorn(options) {
|
|
481
257
|
const { unicorn: enabled = true } = options.features ?? {};
|
|
482
258
|
if (!enabled) return {};
|
|
@@ -534,7 +310,6 @@ async function tailwind(options) {
|
|
|
534
310
|
const plugin = await interopDefault(import('eslint-plugin-tailwindcss'));
|
|
535
311
|
const callees = ["classnames", "clsx", "cn", "ctl", "cva", "tv"];
|
|
536
312
|
const rules = {
|
|
537
|
-
"tailwindcss/classnames-order": ["error", { callees }],
|
|
538
313
|
"tailwindcss/enforces-shorthand": ["error", { callees }],
|
|
539
314
|
"tailwindcss/no-contradicting-classname": ["error", { callees }],
|
|
540
315
|
...options.overrides?.tailwind
|
|
@@ -987,8 +762,6 @@ async function defineConfig(options) {
|
|
|
987
762
|
javascript(options),
|
|
988
763
|
typescript(options),
|
|
989
764
|
...await vue(options),
|
|
990
|
-
...await jsonc(options),
|
|
991
|
-
stylistic(options),
|
|
992
765
|
perfectionist(options),
|
|
993
766
|
unicorn(options),
|
|
994
767
|
tailwind(options),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tb-dev/eslint-config",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "ESLint config",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,17 +17,14 @@
|
|
|
17
17
|
"eslint",
|
|
18
18
|
"eslint-config",
|
|
19
19
|
"typescript",
|
|
20
|
-
"stylistic",
|
|
21
20
|
"vue"
|
|
22
21
|
],
|
|
23
22
|
"lint-staged": {
|
|
24
|
-
"*.{?(c|m)@(j|t)s,css,vue,md,json}": "
|
|
23
|
+
"*.{?(c|m)@(j|t)s,css,vue,md,json}": "prettier --write"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"@stylistic/eslint-plugin": "^2.6.1",
|
|
28
26
|
"@typescript-eslint/eslint-plugin": "^8.0.1",
|
|
29
27
|
"@typescript-eslint/parser": "^8.0.1",
|
|
30
|
-
"eslint-plugin-jsonc": "^2.16.0",
|
|
31
28
|
"eslint-plugin-perfectionist": "^3.1.2",
|
|
32
29
|
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
33
30
|
"eslint-plugin-unicorn": "^55.0.0",
|