@lincy/eslint-config 3.2.1 → 3.3.1
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/README.md +38 -14
- package/dist/index.cjs +151 -124
- package/dist/index.d.cts +23 -12
- package/dist/index.d.ts +23 -12
- package/dist/index.js +151 -123
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @lincy/eslint-config
|
|
1
|
+
# @lincy/eslint-config Eslint扁平化规则
|
|
2
2
|
|
|
3
3
|
[](https://npmjs.com/package/@lincy/eslint-config)
|
|
4
4
|
|
|
@@ -143,6 +143,18 @@ export default lincy({
|
|
|
143
143
|
test: false, // 默认值: true
|
|
144
144
|
// 是否启用 markdown 规则
|
|
145
145
|
markdown: false, // 默认值: true
|
|
146
|
+
// 覆盖规则
|
|
147
|
+
overrides: {},
|
|
148
|
+
|
|
149
|
+
// 包含以下键名将会自动整合到一个规则里
|
|
150
|
+
files: [],
|
|
151
|
+
ignores: [],
|
|
152
|
+
languageOptions: {},
|
|
153
|
+
linterOptions: {},
|
|
154
|
+
processor: {},
|
|
155
|
+
plugins: {},
|
|
156
|
+
rules: [],
|
|
157
|
+
settings: {}
|
|
146
158
|
})
|
|
147
159
|
```
|
|
148
160
|
|
|
@@ -181,13 +193,6 @@ export default lincy(
|
|
|
181
193
|
},
|
|
182
194
|
},
|
|
183
195
|
},
|
|
184
|
-
// 自定义排除文件(夹)
|
|
185
|
-
{
|
|
186
|
-
ignores: [
|
|
187
|
-
'**/assets',
|
|
188
|
-
'**/static',
|
|
189
|
-
],
|
|
190
|
-
},
|
|
191
196
|
// 你还可以继续配置多个 ESLint Flat Configs
|
|
192
197
|
{
|
|
193
198
|
files: ['**/*.ts'],
|
|
@@ -267,10 +272,21 @@ type foo = { bar: 2 }
|
|
|
267
272
|
|
|
268
273
|
```js
|
|
269
274
|
// eslint.config.js
|
|
270
|
-
import
|
|
275
|
+
import lincy from '@lincy/eslint-config'
|
|
271
276
|
|
|
272
|
-
export default
|
|
273
|
-
{
|
|
277
|
+
export default lincy(
|
|
278
|
+
{
|
|
279
|
+
isInEditor: true,
|
|
280
|
+
vue: true,
|
|
281
|
+
typescript: true,
|
|
282
|
+
stylistic: true,
|
|
283
|
+
gitignore: true,
|
|
284
|
+
test: true,
|
|
285
|
+
jsonc: true,
|
|
286
|
+
yaml: true,
|
|
287
|
+
markdown: true,
|
|
288
|
+
overrides: {}
|
|
289
|
+
},
|
|
274
290
|
{
|
|
275
291
|
// 记得在这里指定文件 glob,否则可能会导致 vue 插件处理非 vue 文件
|
|
276
292
|
files: ['**/*.vue'],
|
|
@@ -291,21 +307,29 @@ export default antfu(
|
|
|
291
307
|
|
|
292
308
|
```js
|
|
293
309
|
// eslint.config.js
|
|
294
|
-
import
|
|
310
|
+
import lincy from '@lincy/eslint-config'
|
|
295
311
|
|
|
296
|
-
export default
|
|
312
|
+
export default lincy({
|
|
297
313
|
overrides: {
|
|
314
|
+
// 重写vue规则
|
|
298
315
|
vue: {
|
|
299
316
|
'vue/operator-linebreak': ['error', 'before'],
|
|
300
317
|
},
|
|
318
|
+
// 重写ts规则
|
|
301
319
|
typescript: {
|
|
302
320
|
'ts/consistent-type-definitions': ['error', 'interface'],
|
|
303
321
|
},
|
|
322
|
+
// 重写js规则
|
|
304
323
|
javascript: {},
|
|
305
324
|
stylistic: {
|
|
306
|
-
'
|
|
325
|
+
'lincy/consistent-list-newline': 'off',
|
|
307
326
|
},
|
|
308
327
|
yaml: {},
|
|
328
|
+
jsonc: {},
|
|
329
|
+
markdown: {},
|
|
330
|
+
test: {},
|
|
331
|
+
|
|
332
|
+
// 追加自定义排除文件(夹)
|
|
309
333
|
ignores: [
|
|
310
334
|
'**/assets',
|
|
311
335
|
'**/static',
|
package/dist/index.cjs
CHANGED
|
@@ -88,7 +88,6 @@ __export(src_exports, {
|
|
|
88
88
|
stylistic: () => stylistic,
|
|
89
89
|
test: () => test,
|
|
90
90
|
typescript: () => typescript,
|
|
91
|
-
typescriptWithTypes: () => typescriptWithTypes,
|
|
92
91
|
unicorn: () => unicorn,
|
|
93
92
|
vue: () => vue,
|
|
94
93
|
warnUnnecessaryOffRules: () => warnUnnecessaryOffRules,
|
|
@@ -274,22 +273,30 @@ function ignores(options = {}) {
|
|
|
274
273
|
}
|
|
275
274
|
|
|
276
275
|
// src/configs/imports.ts
|
|
277
|
-
function imports() {
|
|
276
|
+
function imports(options = {}) {
|
|
277
|
+
const {
|
|
278
|
+
stylistic: stylistic2 = true
|
|
279
|
+
} = options;
|
|
278
280
|
return [
|
|
279
281
|
{
|
|
280
282
|
plugins: {
|
|
283
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
281
284
|
import: import_eslint_plugin_i.default
|
|
282
285
|
},
|
|
283
286
|
rules: {
|
|
287
|
+
"antfu/import-dedupe": "error",
|
|
288
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
284
289
|
"import/export": "error",
|
|
285
290
|
"import/first": "error",
|
|
286
|
-
"import/newline-after-import": ["error", { considerComments: true, count: 1 }],
|
|
287
291
|
"import/no-duplicates": "error",
|
|
288
292
|
"import/no-mutable-exports": "error",
|
|
289
293
|
"import/no-named-default": "error",
|
|
290
294
|
"import/no-self-import": "error",
|
|
291
295
|
"import/no-webpack-loader-syntax": "error",
|
|
292
|
-
"import/order": "error"
|
|
296
|
+
"import/order": "error",
|
|
297
|
+
...stylistic2 ? {
|
|
298
|
+
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
299
|
+
} : {}
|
|
293
300
|
}
|
|
294
301
|
}
|
|
295
302
|
];
|
|
@@ -334,8 +341,6 @@ function javascript(options = {}) {
|
|
|
334
341
|
},
|
|
335
342
|
rules: {
|
|
336
343
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
337
|
-
"antfu/import-dedupe": "error",
|
|
338
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
339
344
|
"antfu/top-level-function": "error",
|
|
340
345
|
"array-callback-return": "error",
|
|
341
346
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
@@ -534,7 +539,10 @@ function javascript(options = {}) {
|
|
|
534
539
|
}
|
|
535
540
|
|
|
536
541
|
// src/configs/jsdoc.ts
|
|
537
|
-
function jsdoc() {
|
|
542
|
+
function jsdoc(options = {}) {
|
|
543
|
+
const {
|
|
544
|
+
stylistic: stylistic2 = true
|
|
545
|
+
} = options;
|
|
538
546
|
return [
|
|
539
547
|
{
|
|
540
548
|
plugins: {
|
|
@@ -542,16 +550,13 @@ function jsdoc() {
|
|
|
542
550
|
},
|
|
543
551
|
rules: {
|
|
544
552
|
"jsdoc/check-access": "warn",
|
|
545
|
-
"jsdoc/check-alignment": "warn",
|
|
546
553
|
"jsdoc/check-param-names": "warn",
|
|
547
554
|
"jsdoc/check-property-names": "warn",
|
|
548
555
|
"jsdoc/check-types": "warn",
|
|
549
556
|
"jsdoc/empty-tags": "warn",
|
|
550
557
|
"jsdoc/implements-on-classes": "warn",
|
|
551
|
-
"jsdoc/multiline-blocks": "warn",
|
|
552
558
|
"jsdoc/no-defaults": "warn",
|
|
553
559
|
"jsdoc/no-multi-asterisks": "warn",
|
|
554
|
-
"jsdoc/no-types": "warn",
|
|
555
560
|
"jsdoc/require-param-name": "warn",
|
|
556
561
|
"jsdoc/require-property": "warn",
|
|
557
562
|
"jsdoc/require-property-description": "warn",
|
|
@@ -559,14 +564,22 @@ function jsdoc() {
|
|
|
559
564
|
"jsdoc/require-returns-check": "warn",
|
|
560
565
|
"jsdoc/require-returns-description": "warn",
|
|
561
566
|
"jsdoc/require-yields-check": "warn",
|
|
562
|
-
"jsdoc/valid-types": "warn"
|
|
567
|
+
"jsdoc/valid-types": "warn",
|
|
568
|
+
...stylistic2 ? {
|
|
569
|
+
"jsdoc/check-alignment": "warn",
|
|
570
|
+
"jsdoc/multiline-blocks": "warn"
|
|
571
|
+
} : {}
|
|
563
572
|
}
|
|
564
573
|
}
|
|
565
574
|
];
|
|
566
575
|
}
|
|
567
576
|
|
|
568
577
|
// src/configs/jsonc.ts
|
|
569
|
-
function jsonc() {
|
|
578
|
+
function jsonc(options = {}) {
|
|
579
|
+
const {
|
|
580
|
+
stylistic: stylistic2 = true,
|
|
581
|
+
overrides = {}
|
|
582
|
+
} = options;
|
|
570
583
|
return [
|
|
571
584
|
{
|
|
572
585
|
plugins: {
|
|
@@ -579,11 +592,6 @@ function jsonc() {
|
|
|
579
592
|
parser: import_jsonc_eslint_parser.default
|
|
580
593
|
},
|
|
581
594
|
rules: {
|
|
582
|
-
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
583
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
584
|
-
"jsonc/comma-style": ["error", "last"],
|
|
585
|
-
"jsonc/indent": ["error", 2],
|
|
586
|
-
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
587
595
|
"jsonc/no-bigint-literals": "error",
|
|
588
596
|
"jsonc/no-binary-expression": "error",
|
|
589
597
|
"jsonc/no-binary-numeric-literals": "error",
|
|
@@ -607,14 +615,22 @@ function jsonc() {
|
|
|
607
615
|
"jsonc/no-undefined-value": "error",
|
|
608
616
|
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
609
617
|
"jsonc/no-useless-escape": "error",
|
|
610
|
-
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
611
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
612
|
-
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
613
|
-
"jsonc/quote-props": "error",
|
|
614
|
-
"jsonc/quotes": "error",
|
|
615
618
|
"jsonc/space-unary-ops": "error",
|
|
616
619
|
"jsonc/valid-json-number": "error",
|
|
617
|
-
"jsonc/vue-custom-block/no-parsing-error": "error"
|
|
620
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
621
|
+
...stylistic2 ? {
|
|
622
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
623
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
624
|
+
"jsonc/comma-style": ["error", "last"],
|
|
625
|
+
"jsonc/indent": ["error", 2],
|
|
626
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
627
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
628
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
629
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
630
|
+
"jsonc/quote-props": "error",
|
|
631
|
+
"jsonc/quotes": "error"
|
|
632
|
+
} : {},
|
|
633
|
+
...overrides
|
|
618
634
|
}
|
|
619
635
|
}
|
|
620
636
|
];
|
|
@@ -669,6 +685,25 @@ function markdown(options = {}) {
|
|
|
669
685
|
"unicode-bom": "off",
|
|
670
686
|
"unused-imports/no-unused-imports": OFF,
|
|
671
687
|
"unused-imports/no-unused-vars": OFF,
|
|
688
|
+
// Type aware rules
|
|
689
|
+
...{
|
|
690
|
+
"ts/await-thenable": OFF,
|
|
691
|
+
"ts/dot-notation": OFF,
|
|
692
|
+
"ts/no-floating-promises": OFF,
|
|
693
|
+
"ts/no-for-in-array": OFF,
|
|
694
|
+
"ts/no-implied-eval": OFF,
|
|
695
|
+
"ts/no-misused-promises": OFF,
|
|
696
|
+
"ts/no-throw-literal": OFF,
|
|
697
|
+
"ts/no-unnecessary-type-assertion": OFF,
|
|
698
|
+
"ts/no-unsafe-argument": OFF,
|
|
699
|
+
"ts/no-unsafe-assignment": OFF,
|
|
700
|
+
"ts/no-unsafe-call": OFF,
|
|
701
|
+
"ts/no-unsafe-member-access": OFF,
|
|
702
|
+
"ts/no-unsafe-return": OFF,
|
|
703
|
+
"ts/restrict-plus-operands": OFF,
|
|
704
|
+
"ts/restrict-template-expressions": OFF,
|
|
705
|
+
"ts/unbound-method": OFF
|
|
706
|
+
},
|
|
672
707
|
...overrides
|
|
673
708
|
}
|
|
674
709
|
}
|
|
@@ -976,7 +1011,7 @@ function stylistic(options = {}) {
|
|
|
976
1011
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
977
1012
|
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
978
1013
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
979
|
-
"style/multiline-ternary": ["error", "
|
|
1014
|
+
"style/multiline-ternary": ["error", "never"],
|
|
980
1015
|
"style/no-mixed-spaces-and-tabs": "error",
|
|
981
1016
|
"style/no-multi-spaces": "error",
|
|
982
1017
|
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
@@ -1063,8 +1098,31 @@ function warnUnnecessaryOffRules() {
|
|
|
1063
1098
|
function typescript(options) {
|
|
1064
1099
|
const {
|
|
1065
1100
|
componentExts = [],
|
|
1066
|
-
overrides = {}
|
|
1101
|
+
overrides = {},
|
|
1102
|
+
parserOptions = {},
|
|
1103
|
+
tsconfigPath
|
|
1067
1104
|
} = options ?? {};
|
|
1105
|
+
const typeAwareRules = {
|
|
1106
|
+
"dot-notation": OFF,
|
|
1107
|
+
"no-implied-eval": OFF,
|
|
1108
|
+
"no-throw-literal": OFF,
|
|
1109
|
+
"ts/await-thenable": "error",
|
|
1110
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1111
|
+
"ts/no-floating-promises": "error",
|
|
1112
|
+
"ts/no-for-in-array": "error",
|
|
1113
|
+
"ts/no-implied-eval": "error",
|
|
1114
|
+
"ts/no-misused-promises": "error",
|
|
1115
|
+
"ts/no-throw-literal": "error",
|
|
1116
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1117
|
+
"ts/no-unsafe-argument": "error",
|
|
1118
|
+
"ts/no-unsafe-assignment": "error",
|
|
1119
|
+
"ts/no-unsafe-call": "error",
|
|
1120
|
+
"ts/no-unsafe-member-access": "error",
|
|
1121
|
+
"ts/no-unsafe-return": "error",
|
|
1122
|
+
"ts/restrict-plus-operands": "error",
|
|
1123
|
+
"ts/restrict-template-expressions": "error",
|
|
1124
|
+
"ts/unbound-method": "error"
|
|
1125
|
+
};
|
|
1068
1126
|
return [
|
|
1069
1127
|
{
|
|
1070
1128
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -1083,7 +1141,12 @@ function typescript(options) {
|
|
|
1083
1141
|
languageOptions: {
|
|
1084
1142
|
parser: import_parser.default,
|
|
1085
1143
|
parserOptions: {
|
|
1086
|
-
sourceType: "module"
|
|
1144
|
+
sourceType: "module",
|
|
1145
|
+
...tsconfigPath ? {
|
|
1146
|
+
project: [tsconfigPath],
|
|
1147
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
1148
|
+
} : {},
|
|
1149
|
+
...parserOptions
|
|
1087
1150
|
}
|
|
1088
1151
|
},
|
|
1089
1152
|
rules: {
|
|
@@ -1127,6 +1190,7 @@ function typescript(options) {
|
|
|
1127
1190
|
"ts/prefer-ts-expect-error": "error",
|
|
1128
1191
|
"ts/triple-slash-reference": OFF,
|
|
1129
1192
|
"ts/unified-signatures": OFF,
|
|
1193
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1130
1194
|
...overrides
|
|
1131
1195
|
}
|
|
1132
1196
|
},
|
|
@@ -1153,54 +1217,6 @@ function typescript(options) {
|
|
|
1153
1217
|
}
|
|
1154
1218
|
];
|
|
1155
1219
|
}
|
|
1156
|
-
function typescriptWithTypes(options) {
|
|
1157
|
-
const {
|
|
1158
|
-
componentExts = [],
|
|
1159
|
-
tsconfigPath,
|
|
1160
|
-
tsconfigRootDir = import_node_process.default.cwd(),
|
|
1161
|
-
overrides = {}
|
|
1162
|
-
} = options;
|
|
1163
|
-
return [
|
|
1164
|
-
{
|
|
1165
|
-
files: [
|
|
1166
|
-
GLOB_TS,
|
|
1167
|
-
GLOB_TSX,
|
|
1168
|
-
...componentExts.map((ext) => `**/*.${ext}`),
|
|
1169
|
-
"!**/*.md/*.*"
|
|
1170
|
-
],
|
|
1171
|
-
ignores: ["**/*.md/*.*"],
|
|
1172
|
-
languageOptions: {
|
|
1173
|
-
parser: import_parser.default,
|
|
1174
|
-
parserOptions: {
|
|
1175
|
-
project: [tsconfigPath],
|
|
1176
|
-
tsconfigRootDir
|
|
1177
|
-
}
|
|
1178
|
-
},
|
|
1179
|
-
rules: {
|
|
1180
|
-
"dot-notation": OFF,
|
|
1181
|
-
"no-implied-eval": OFF,
|
|
1182
|
-
"no-throw-literal": OFF,
|
|
1183
|
-
"ts/await-thenable": "error",
|
|
1184
|
-
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1185
|
-
"ts/no-floating-promises": "error",
|
|
1186
|
-
"ts/no-for-in-array": "error",
|
|
1187
|
-
"ts/no-implied-eval": "error",
|
|
1188
|
-
"ts/no-misused-promises": "error",
|
|
1189
|
-
"ts/no-throw-literal": "error",
|
|
1190
|
-
"ts/no-unnecessary-type-assertion": "error",
|
|
1191
|
-
"ts/no-unsafe-argument": "error",
|
|
1192
|
-
"ts/no-unsafe-assignment": "error",
|
|
1193
|
-
"ts/no-unsafe-call": "error",
|
|
1194
|
-
"ts/no-unsafe-member-access": "error",
|
|
1195
|
-
"ts/no-unsafe-return": "error",
|
|
1196
|
-
"ts/restrict-plus-operands": "error",
|
|
1197
|
-
"ts/restrict-template-expressions": "error",
|
|
1198
|
-
"ts/unbound-method": "error",
|
|
1199
|
-
...overrides
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
];
|
|
1203
|
-
}
|
|
1204
1220
|
|
|
1205
1221
|
// src/configs/unicorn.ts
|
|
1206
1222
|
function unicorn() {
|
|
@@ -1250,7 +1266,8 @@ vueVersion = vueVersion && vueVersion[0];
|
|
|
1250
1266
|
vueVersion = Number.isNaN(vueVersion) ? "3" : vueVersion;
|
|
1251
1267
|
function vue(options = {}) {
|
|
1252
1268
|
const {
|
|
1253
|
-
overrides = {}
|
|
1269
|
+
overrides = {},
|
|
1270
|
+
stylistic: stylistic2 = true
|
|
1254
1271
|
} = options;
|
|
1255
1272
|
return [
|
|
1256
1273
|
{
|
|
@@ -1284,20 +1301,9 @@ function vue(options = {}) {
|
|
|
1284
1301
|
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
1285
1302
|
},
|
|
1286
1303
|
"node/prefer-global/process": OFF,
|
|
1287
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1288
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1289
1304
|
"vue/block-order": ["error", {
|
|
1290
1305
|
order: ["template", "script", "style"]
|
|
1291
1306
|
}],
|
|
1292
|
-
"vue/block-spacing": ["error", "always"],
|
|
1293
|
-
"vue/block-tag-newline": ["error", {
|
|
1294
|
-
multiline: "always",
|
|
1295
|
-
singleline: "always"
|
|
1296
|
-
}],
|
|
1297
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1298
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1299
|
-
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1300
|
-
"vue/comma-style": ["error", "last"],
|
|
1301
1307
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1302
1308
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1303
1309
|
"vue/custom-event-name-casing": vueVersion === "3" ? ["error", "camelCase"] : ["error", "kebab-case"],
|
|
@@ -1308,9 +1314,6 @@ function vue(options = {}) {
|
|
|
1308
1314
|
"vue/dot-location": ["error", "property"],
|
|
1309
1315
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1310
1316
|
"vue/eqeqeq": ["error", "smart"],
|
|
1311
|
-
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1312
|
-
exceptions: ["-"]
|
|
1313
|
-
}],
|
|
1314
1317
|
"vue/html-indent": ["error", 4, {
|
|
1315
1318
|
alignAttributesVertically: true,
|
|
1316
1319
|
attribute: 1,
|
|
@@ -1327,8 +1330,6 @@ function vue(options = {}) {
|
|
|
1327
1330
|
math: "always",
|
|
1328
1331
|
svg: "always"
|
|
1329
1332
|
}],
|
|
1330
|
-
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1331
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1332
1333
|
"vue/max-attributes-per-line": OFF,
|
|
1333
1334
|
"vue/multi-word-component-names": OFF,
|
|
1334
1335
|
"vue/no-constant-condition": "warn",
|
|
@@ -1350,9 +1351,6 @@ function vue(options = {}) {
|
|
|
1350
1351
|
"vue/no-useless-v-bind": "error",
|
|
1351
1352
|
"vue/no-v-html": OFF,
|
|
1352
1353
|
"vue/no-v-text-v-html-on-component": OFF,
|
|
1353
|
-
"vue/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
1354
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1355
|
-
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1356
1354
|
"vue/object-shorthand": [
|
|
1357
1355
|
"error",
|
|
1358
1356
|
"always",
|
|
@@ -1361,18 +1359,39 @@ function vue(options = {}) {
|
|
|
1361
1359
|
ignoreConstructors: false
|
|
1362
1360
|
}
|
|
1363
1361
|
],
|
|
1364
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1365
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1366
1362
|
"vue/prefer-separate-static-class": "error",
|
|
1367
1363
|
"vue/prefer-template": "error",
|
|
1368
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1369
1364
|
"vue/require-default-prop": OFF,
|
|
1370
1365
|
"vue/require-prop-types": OFF,
|
|
1371
1366
|
"vue/singleline-html-element-content-newline": "off",
|
|
1372
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1373
1367
|
"vue/space-infix-ops": "error",
|
|
1374
1368
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1375
|
-
|
|
1369
|
+
...stylistic2 ? {
|
|
1370
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1371
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1372
|
+
"vue/block-spacing": ["error", "always"],
|
|
1373
|
+
"vue/block-tag-newline": ["error", {
|
|
1374
|
+
multiline: "always",
|
|
1375
|
+
singleline: "always"
|
|
1376
|
+
}],
|
|
1377
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1378
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1379
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1380
|
+
"vue/comma-style": ["error", "last"],
|
|
1381
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1382
|
+
exceptions: ["-"]
|
|
1383
|
+
}],
|
|
1384
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1385
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1386
|
+
"vue/object-curly-newline": OFF,
|
|
1387
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1388
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1389
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1390
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1391
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1392
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1393
|
+
"vue/template-curly-spacing": "error"
|
|
1394
|
+
} : {},
|
|
1376
1395
|
...overrides
|
|
1377
1396
|
}
|
|
1378
1397
|
}
|
|
@@ -1382,7 +1401,8 @@ function vue(options = {}) {
|
|
|
1382
1401
|
// src/configs/yaml.ts
|
|
1383
1402
|
function yaml(options = {}) {
|
|
1384
1403
|
const {
|
|
1385
|
-
overrides = {}
|
|
1404
|
+
overrides = {},
|
|
1405
|
+
stylistic: stylistic2 = true
|
|
1386
1406
|
} = options;
|
|
1387
1407
|
return [
|
|
1388
1408
|
{
|
|
@@ -1398,23 +1418,25 @@ function yaml(options = {}) {
|
|
|
1398
1418
|
rules: {
|
|
1399
1419
|
"style/spaced-comment": OFF,
|
|
1400
1420
|
"yaml/block-mapping": "error",
|
|
1401
|
-
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1402
1421
|
"yaml/block-sequence": "error",
|
|
1403
|
-
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1404
|
-
"yaml/flow-mapping-curly-newline": "error",
|
|
1405
|
-
"yaml/flow-mapping-curly-spacing": "error",
|
|
1406
|
-
"yaml/flow-sequence-bracket-newline": "error",
|
|
1407
|
-
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1408
|
-
"yaml/indent": ["error", 2],
|
|
1409
|
-
"yaml/key-spacing": "error",
|
|
1410
1422
|
"yaml/no-empty-key": "error",
|
|
1411
1423
|
"yaml/no-empty-sequence-entry": "error",
|
|
1412
1424
|
"yaml/no-irregular-whitespace": "error",
|
|
1413
|
-
"yaml/no-tab-indent": "error",
|
|
1414
1425
|
"yaml/plain-scalar": "error",
|
|
1415
|
-
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1416
|
-
"yaml/spaced-comment": "error",
|
|
1417
1426
|
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1427
|
+
...stylistic2 ? {
|
|
1428
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1429
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1430
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1431
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1432
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1433
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1434
|
+
"yaml/indent": ["error", 2],
|
|
1435
|
+
"yaml/key-spacing": "error",
|
|
1436
|
+
"yaml/no-tab-indent": "error",
|
|
1437
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1438
|
+
"yaml/spaced-comment": "error"
|
|
1439
|
+
} : {},
|
|
1418
1440
|
...overrides
|
|
1419
1441
|
}
|
|
1420
1442
|
}
|
|
@@ -1488,8 +1510,12 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1488
1510
|
}),
|
|
1489
1511
|
comments(),
|
|
1490
1512
|
node(),
|
|
1491
|
-
jsdoc(
|
|
1492
|
-
|
|
1513
|
+
jsdoc({
|
|
1514
|
+
stylistic: enableStylistic
|
|
1515
|
+
}),
|
|
1516
|
+
imports({
|
|
1517
|
+
stylistic: enableStylistic
|
|
1518
|
+
}),
|
|
1493
1519
|
unicorn()
|
|
1494
1520
|
);
|
|
1495
1521
|
const componentExts = [];
|
|
@@ -1497,16 +1523,10 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1497
1523
|
componentExts.push("vue");
|
|
1498
1524
|
if (enableTypeScript) {
|
|
1499
1525
|
configs.push(typescript({
|
|
1526
|
+
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1500
1527
|
componentExts,
|
|
1501
1528
|
overrides: overrides.typescript
|
|
1502
1529
|
}));
|
|
1503
|
-
if (typeof enableTypeScript !== "boolean") {
|
|
1504
|
-
configs.push(typescriptWithTypes({
|
|
1505
|
-
...enableTypeScript,
|
|
1506
|
-
componentExts,
|
|
1507
|
-
overrides: overrides.typescriptWithTypes
|
|
1508
|
-
}));
|
|
1509
|
-
}
|
|
1510
1530
|
}
|
|
1511
1531
|
if (enableStylistic) {
|
|
1512
1532
|
configs.push(stylistic({
|
|
@@ -1522,18 +1542,26 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1522
1542
|
if (enableVue) {
|
|
1523
1543
|
configs.push(vue({
|
|
1524
1544
|
overrides: overrides.vue,
|
|
1545
|
+
stylistic: enableStylistic,
|
|
1525
1546
|
typescript: !!enableTypeScript
|
|
1526
1547
|
}));
|
|
1527
1548
|
}
|
|
1528
1549
|
if (options.jsonc ?? true) {
|
|
1529
1550
|
configs.push(
|
|
1530
|
-
jsonc(
|
|
1551
|
+
jsonc({
|
|
1552
|
+
overrides: overrides.jsonc,
|
|
1553
|
+
stylistic: enableStylistic
|
|
1554
|
+
}),
|
|
1531
1555
|
sortPackageJson(),
|
|
1532
1556
|
sortTsconfig()
|
|
1533
1557
|
);
|
|
1534
1558
|
}
|
|
1535
|
-
if (options.yaml ?? true)
|
|
1536
|
-
configs.push(yaml(
|
|
1559
|
+
if (options.yaml ?? true) {
|
|
1560
|
+
configs.push(yaml({
|
|
1561
|
+
overrides: overrides.yaml,
|
|
1562
|
+
stylistic: enableStylistic
|
|
1563
|
+
}));
|
|
1564
|
+
}
|
|
1537
1565
|
if (options.markdown ?? true) {
|
|
1538
1566
|
configs.push(markdown({
|
|
1539
1567
|
componentExts,
|
|
@@ -1615,7 +1643,6 @@ var src_default = lincy;
|
|
|
1615
1643
|
stylistic,
|
|
1616
1644
|
test,
|
|
1617
1645
|
typescript,
|
|
1618
|
-
typescriptWithTypes,
|
|
1619
1646
|
unicorn,
|
|
1620
1647
|
vue,
|
|
1621
1648
|
warnUnnecessaryOffRules,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
2
2
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
+
export { default as parserTs } from '@typescript-eslint/parser';
|
|
3
5
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
4
6
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
5
7
|
export { default as pluginImport } from 'eslint-plugin-i';
|
|
@@ -14,7 +16,6 @@ export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
|
14
16
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
15
17
|
export { default as pluginYaml } from 'eslint-plugin-yml';
|
|
16
18
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
17
|
-
export { default as parserTs } from '@typescript-eslint/parser';
|
|
18
19
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
19
20
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
20
21
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
@@ -28,13 +29,25 @@ interface OptionsComponentExts {
|
|
|
28
29
|
*/
|
|
29
30
|
componentExts?: string[];
|
|
30
31
|
}
|
|
32
|
+
interface OptionsTypeScriptParserOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Additional parser options for TypeScript.
|
|
35
|
+
*/
|
|
36
|
+
parserOptions?: Partial<ParserOptions>;
|
|
37
|
+
}
|
|
31
38
|
interface OptionsTypeScriptWithTypes {
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
/**
|
|
40
|
+
* When this options is provided, type aware rules will be enabled.
|
|
41
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
42
|
+
*/
|
|
43
|
+
tsconfigPath?: string;
|
|
34
44
|
}
|
|
35
45
|
interface OptionsHasTypeScript {
|
|
36
46
|
typescript?: boolean;
|
|
37
47
|
}
|
|
48
|
+
interface OptionsStylistic {
|
|
49
|
+
stylistic?: boolean;
|
|
50
|
+
}
|
|
38
51
|
interface OptionsOverrides {
|
|
39
52
|
overrides?: FlatESLintConfigItem['rules'];
|
|
40
53
|
ignores?: string[];
|
|
@@ -107,7 +120,6 @@ interface OptionsConfig {
|
|
|
107
120
|
overrides?: {
|
|
108
121
|
javascript?: FlatESLintConfigItem['rules'];
|
|
109
122
|
typescript?: FlatESLintConfigItem['rules'];
|
|
110
|
-
typescriptWithTypes?: FlatESLintConfigItem['rules'];
|
|
111
123
|
stylistic?: FlatESLintConfigItem['rules'];
|
|
112
124
|
test?: FlatESLintConfigItem['rules'];
|
|
113
125
|
vue?: FlatESLintConfigItem['rules'];
|
|
@@ -127,13 +139,13 @@ declare function comments(): FlatESLintConfigItem[];
|
|
|
127
139
|
|
|
128
140
|
declare function ignores(options?: OptionsOverrides): FlatESLintConfigItem[];
|
|
129
141
|
|
|
130
|
-
declare function imports(): FlatESLintConfigItem[];
|
|
142
|
+
declare function imports(options?: OptionsStylistic): FlatESLintConfigItem[];
|
|
131
143
|
|
|
132
144
|
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
|
|
133
145
|
|
|
134
|
-
declare function jsdoc(): FlatESLintConfigItem[];
|
|
146
|
+
declare function jsdoc(options?: OptionsStylistic): FlatESLintConfigItem[];
|
|
135
147
|
|
|
136
|
-
declare function jsonc(): FlatESLintConfigItem[];
|
|
148
|
+
declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatESLintConfigItem[];
|
|
137
149
|
|
|
138
150
|
declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
|
|
139
151
|
|
|
@@ -154,14 +166,13 @@ declare function sortTsconfig(): FlatESLintConfigItem[];
|
|
|
154
166
|
|
|
155
167
|
declare function stylistic(options?: OptionsOverrides): FlatESLintConfigItem[];
|
|
156
168
|
|
|
157
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
|
|
158
|
-
declare function typescriptWithTypes(options: OptionsTypeScriptWithTypes & OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
|
|
169
|
+
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
|
|
159
170
|
|
|
160
171
|
declare function unicorn(): FlatESLintConfigItem[];
|
|
161
172
|
|
|
162
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
|
|
173
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
163
174
|
|
|
164
|
-
declare function yaml(options?: OptionsOverrides): FlatESLintConfigItem[];
|
|
175
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
165
176
|
|
|
166
177
|
declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
|
|
167
178
|
|
|
@@ -198,4 +209,4 @@ declare const GLOB_TESTS: string[];
|
|
|
198
209
|
declare const GLOB_ALL_SRC: string[];
|
|
199
210
|
declare const GLOB_EXCLUDE: string[];
|
|
200
211
|
|
|
201
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsTypeScriptWithTypes, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, recordRulesState, recordRulesStateConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript,
|
|
212
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, recordRulesState, recordRulesStateConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
2
2
|
import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
3
|
+
import { ParserOptions } from '@typescript-eslint/parser';
|
|
4
|
+
export { default as parserTs } from '@typescript-eslint/parser';
|
|
3
5
|
export { default as pluginAntfu } from 'eslint-plugin-antfu';
|
|
4
6
|
export { default as pluginComments } from 'eslint-plugin-eslint-comments';
|
|
5
7
|
export { default as pluginImport } from 'eslint-plugin-i';
|
|
@@ -14,7 +16,6 @@ export { default as pluginUnusedImports } from 'eslint-plugin-unused-imports';
|
|
|
14
16
|
export { default as pluginVue } from 'eslint-plugin-vue';
|
|
15
17
|
export { default as pluginYaml } from 'eslint-plugin-yml';
|
|
16
18
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
17
|
-
export { default as parserTs } from '@typescript-eslint/parser';
|
|
18
19
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
19
20
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
20
21
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
@@ -28,13 +29,25 @@ interface OptionsComponentExts {
|
|
|
28
29
|
*/
|
|
29
30
|
componentExts?: string[];
|
|
30
31
|
}
|
|
32
|
+
interface OptionsTypeScriptParserOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Additional parser options for TypeScript.
|
|
35
|
+
*/
|
|
36
|
+
parserOptions?: Partial<ParserOptions>;
|
|
37
|
+
}
|
|
31
38
|
interface OptionsTypeScriptWithTypes {
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
/**
|
|
40
|
+
* When this options is provided, type aware rules will be enabled.
|
|
41
|
+
* @see https://typescript-eslint.io/linting/typed-linting/
|
|
42
|
+
*/
|
|
43
|
+
tsconfigPath?: string;
|
|
34
44
|
}
|
|
35
45
|
interface OptionsHasTypeScript {
|
|
36
46
|
typescript?: boolean;
|
|
37
47
|
}
|
|
48
|
+
interface OptionsStylistic {
|
|
49
|
+
stylistic?: boolean;
|
|
50
|
+
}
|
|
38
51
|
interface OptionsOverrides {
|
|
39
52
|
overrides?: FlatESLintConfigItem['rules'];
|
|
40
53
|
ignores?: string[];
|
|
@@ -107,7 +120,6 @@ interface OptionsConfig {
|
|
|
107
120
|
overrides?: {
|
|
108
121
|
javascript?: FlatESLintConfigItem['rules'];
|
|
109
122
|
typescript?: FlatESLintConfigItem['rules'];
|
|
110
|
-
typescriptWithTypes?: FlatESLintConfigItem['rules'];
|
|
111
123
|
stylistic?: FlatESLintConfigItem['rules'];
|
|
112
124
|
test?: FlatESLintConfigItem['rules'];
|
|
113
125
|
vue?: FlatESLintConfigItem['rules'];
|
|
@@ -127,13 +139,13 @@ declare function comments(): FlatESLintConfigItem[];
|
|
|
127
139
|
|
|
128
140
|
declare function ignores(options?: OptionsOverrides): FlatESLintConfigItem[];
|
|
129
141
|
|
|
130
|
-
declare function imports(): FlatESLintConfigItem[];
|
|
142
|
+
declare function imports(options?: OptionsStylistic): FlatESLintConfigItem[];
|
|
131
143
|
|
|
132
144
|
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
|
|
133
145
|
|
|
134
|
-
declare function jsdoc(): FlatESLintConfigItem[];
|
|
146
|
+
declare function jsdoc(options?: OptionsStylistic): FlatESLintConfigItem[];
|
|
135
147
|
|
|
136
|
-
declare function jsonc(): FlatESLintConfigItem[];
|
|
148
|
+
declare function jsonc(options?: OptionsStylistic & OptionsOverrides): FlatESLintConfigItem[];
|
|
137
149
|
|
|
138
150
|
declare function markdown(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
|
|
139
151
|
|
|
@@ -154,14 +166,13 @@ declare function sortTsconfig(): FlatESLintConfigItem[];
|
|
|
154
166
|
|
|
155
167
|
declare function stylistic(options?: OptionsOverrides): FlatESLintConfigItem[];
|
|
156
168
|
|
|
157
|
-
declare function typescript(options?: OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
|
|
158
|
-
declare function typescriptWithTypes(options: OptionsTypeScriptWithTypes & OptionsComponentExts & OptionsOverrides): FlatESLintConfigItem[];
|
|
169
|
+
declare function typescript(options?: OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions): FlatESLintConfigItem[];
|
|
159
170
|
|
|
160
171
|
declare function unicorn(): FlatESLintConfigItem[];
|
|
161
172
|
|
|
162
|
-
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides): FlatESLintConfigItem[];
|
|
173
|
+
declare function vue(options?: OptionsHasTypeScript & OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
163
174
|
|
|
164
|
-
declare function yaml(options?: OptionsOverrides): FlatESLintConfigItem[];
|
|
175
|
+
declare function yaml(options?: OptionsOverrides & OptionsStylistic): FlatESLintConfigItem[];
|
|
165
176
|
|
|
166
177
|
declare function test(options?: OptionsIsInEditor & OptionsOverrides): FlatESLintConfigItem[];
|
|
167
178
|
|
|
@@ -198,4 +209,4 @@ declare const GLOB_TESTS: string[];
|
|
|
198
209
|
declare const GLOB_ALL_SRC: string[];
|
|
199
210
|
declare const GLOB_EXCLUDE: string[];
|
|
200
211
|
|
|
201
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsTypeScriptWithTypes, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, recordRulesState, recordRulesStateConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript,
|
|
212
|
+
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsHasTypeScript, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, recordRulesState, recordRulesStateConfigs, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, warnUnnecessaryOffRules, yaml };
|
package/dist/index.js
CHANGED
|
@@ -172,22 +172,30 @@ function ignores(options = {}) {
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
// src/configs/imports.ts
|
|
175
|
-
function imports() {
|
|
175
|
+
function imports(options = {}) {
|
|
176
|
+
const {
|
|
177
|
+
stylistic: stylistic2 = true
|
|
178
|
+
} = options;
|
|
176
179
|
return [
|
|
177
180
|
{
|
|
178
181
|
plugins: {
|
|
182
|
+
antfu: default2,
|
|
179
183
|
import: default4
|
|
180
184
|
},
|
|
181
185
|
rules: {
|
|
186
|
+
"antfu/import-dedupe": "error",
|
|
187
|
+
"antfu/no-import-node-modules-by-path": "error",
|
|
182
188
|
"import/export": "error",
|
|
183
189
|
"import/first": "error",
|
|
184
|
-
"import/newline-after-import": ["error", { considerComments: true, count: 1 }],
|
|
185
190
|
"import/no-duplicates": "error",
|
|
186
191
|
"import/no-mutable-exports": "error",
|
|
187
192
|
"import/no-named-default": "error",
|
|
188
193
|
"import/no-self-import": "error",
|
|
189
194
|
"import/no-webpack-loader-syntax": "error",
|
|
190
|
-
"import/order": "error"
|
|
195
|
+
"import/order": "error",
|
|
196
|
+
...stylistic2 ? {
|
|
197
|
+
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
198
|
+
} : {}
|
|
191
199
|
}
|
|
192
200
|
}
|
|
193
201
|
];
|
|
@@ -232,8 +240,6 @@ function javascript(options = {}) {
|
|
|
232
240
|
},
|
|
233
241
|
rules: {
|
|
234
242
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
235
|
-
"antfu/import-dedupe": "error",
|
|
236
|
-
"antfu/no-import-node-modules-by-path": "error",
|
|
237
243
|
"antfu/top-level-function": "error",
|
|
238
244
|
"array-callback-return": "error",
|
|
239
245
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
@@ -432,7 +438,10 @@ function javascript(options = {}) {
|
|
|
432
438
|
}
|
|
433
439
|
|
|
434
440
|
// src/configs/jsdoc.ts
|
|
435
|
-
function jsdoc() {
|
|
441
|
+
function jsdoc(options = {}) {
|
|
442
|
+
const {
|
|
443
|
+
stylistic: stylistic2 = true
|
|
444
|
+
} = options;
|
|
436
445
|
return [
|
|
437
446
|
{
|
|
438
447
|
plugins: {
|
|
@@ -440,16 +449,13 @@ function jsdoc() {
|
|
|
440
449
|
},
|
|
441
450
|
rules: {
|
|
442
451
|
"jsdoc/check-access": "warn",
|
|
443
|
-
"jsdoc/check-alignment": "warn",
|
|
444
452
|
"jsdoc/check-param-names": "warn",
|
|
445
453
|
"jsdoc/check-property-names": "warn",
|
|
446
454
|
"jsdoc/check-types": "warn",
|
|
447
455
|
"jsdoc/empty-tags": "warn",
|
|
448
456
|
"jsdoc/implements-on-classes": "warn",
|
|
449
|
-
"jsdoc/multiline-blocks": "warn",
|
|
450
457
|
"jsdoc/no-defaults": "warn",
|
|
451
458
|
"jsdoc/no-multi-asterisks": "warn",
|
|
452
|
-
"jsdoc/no-types": "warn",
|
|
453
459
|
"jsdoc/require-param-name": "warn",
|
|
454
460
|
"jsdoc/require-property": "warn",
|
|
455
461
|
"jsdoc/require-property-description": "warn",
|
|
@@ -457,14 +463,22 @@ function jsdoc() {
|
|
|
457
463
|
"jsdoc/require-returns-check": "warn",
|
|
458
464
|
"jsdoc/require-returns-description": "warn",
|
|
459
465
|
"jsdoc/require-yields-check": "warn",
|
|
460
|
-
"jsdoc/valid-types": "warn"
|
|
466
|
+
"jsdoc/valid-types": "warn",
|
|
467
|
+
...stylistic2 ? {
|
|
468
|
+
"jsdoc/check-alignment": "warn",
|
|
469
|
+
"jsdoc/multiline-blocks": "warn"
|
|
470
|
+
} : {}
|
|
461
471
|
}
|
|
462
472
|
}
|
|
463
473
|
];
|
|
464
474
|
}
|
|
465
475
|
|
|
466
476
|
// src/configs/jsonc.ts
|
|
467
|
-
function jsonc() {
|
|
477
|
+
function jsonc(options = {}) {
|
|
478
|
+
const {
|
|
479
|
+
stylistic: stylistic2 = true,
|
|
480
|
+
overrides = {}
|
|
481
|
+
} = options;
|
|
468
482
|
return [
|
|
469
483
|
{
|
|
470
484
|
plugins: {
|
|
@@ -477,11 +491,6 @@ function jsonc() {
|
|
|
477
491
|
parser: default19
|
|
478
492
|
},
|
|
479
493
|
rules: {
|
|
480
|
-
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
481
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
482
|
-
"jsonc/comma-style": ["error", "last"],
|
|
483
|
-
"jsonc/indent": ["error", 2],
|
|
484
|
-
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
485
494
|
"jsonc/no-bigint-literals": "error",
|
|
486
495
|
"jsonc/no-binary-expression": "error",
|
|
487
496
|
"jsonc/no-binary-numeric-literals": "error",
|
|
@@ -505,14 +514,22 @@ function jsonc() {
|
|
|
505
514
|
"jsonc/no-undefined-value": "error",
|
|
506
515
|
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
507
516
|
"jsonc/no-useless-escape": "error",
|
|
508
|
-
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
509
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
510
|
-
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
511
|
-
"jsonc/quote-props": "error",
|
|
512
|
-
"jsonc/quotes": "error",
|
|
513
517
|
"jsonc/space-unary-ops": "error",
|
|
514
518
|
"jsonc/valid-json-number": "error",
|
|
515
|
-
"jsonc/vue-custom-block/no-parsing-error": "error"
|
|
519
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
520
|
+
...stylistic2 ? {
|
|
521
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
522
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
523
|
+
"jsonc/comma-style": ["error", "last"],
|
|
524
|
+
"jsonc/indent": ["error", 2],
|
|
525
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
526
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
527
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
528
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
529
|
+
"jsonc/quote-props": "error",
|
|
530
|
+
"jsonc/quotes": "error"
|
|
531
|
+
} : {},
|
|
532
|
+
...overrides
|
|
516
533
|
}
|
|
517
534
|
}
|
|
518
535
|
];
|
|
@@ -567,6 +584,25 @@ function markdown(options = {}) {
|
|
|
567
584
|
"unicode-bom": "off",
|
|
568
585
|
"unused-imports/no-unused-imports": OFF,
|
|
569
586
|
"unused-imports/no-unused-vars": OFF,
|
|
587
|
+
// Type aware rules
|
|
588
|
+
...{
|
|
589
|
+
"ts/await-thenable": OFF,
|
|
590
|
+
"ts/dot-notation": OFF,
|
|
591
|
+
"ts/no-floating-promises": OFF,
|
|
592
|
+
"ts/no-for-in-array": OFF,
|
|
593
|
+
"ts/no-implied-eval": OFF,
|
|
594
|
+
"ts/no-misused-promises": OFF,
|
|
595
|
+
"ts/no-throw-literal": OFF,
|
|
596
|
+
"ts/no-unnecessary-type-assertion": OFF,
|
|
597
|
+
"ts/no-unsafe-argument": OFF,
|
|
598
|
+
"ts/no-unsafe-assignment": OFF,
|
|
599
|
+
"ts/no-unsafe-call": OFF,
|
|
600
|
+
"ts/no-unsafe-member-access": OFF,
|
|
601
|
+
"ts/no-unsafe-return": OFF,
|
|
602
|
+
"ts/restrict-plus-operands": OFF,
|
|
603
|
+
"ts/restrict-template-expressions": OFF,
|
|
604
|
+
"ts/unbound-method": OFF
|
|
605
|
+
},
|
|
570
606
|
...overrides
|
|
571
607
|
}
|
|
572
608
|
}
|
|
@@ -874,7 +910,7 @@ function stylistic(options = {}) {
|
|
|
874
910
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
875
911
|
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
876
912
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
877
|
-
"style/multiline-ternary": ["error", "
|
|
913
|
+
"style/multiline-ternary": ["error", "never"],
|
|
878
914
|
"style/no-mixed-spaces-and-tabs": "error",
|
|
879
915
|
"style/no-multi-spaces": "error",
|
|
880
916
|
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
@@ -961,8 +997,31 @@ function warnUnnecessaryOffRules() {
|
|
|
961
997
|
function typescript(options) {
|
|
962
998
|
const {
|
|
963
999
|
componentExts = [],
|
|
964
|
-
overrides = {}
|
|
1000
|
+
overrides = {},
|
|
1001
|
+
parserOptions = {},
|
|
1002
|
+
tsconfigPath
|
|
965
1003
|
} = options ?? {};
|
|
1004
|
+
const typeAwareRules = {
|
|
1005
|
+
"dot-notation": OFF,
|
|
1006
|
+
"no-implied-eval": OFF,
|
|
1007
|
+
"no-throw-literal": OFF,
|
|
1008
|
+
"ts/await-thenable": "error",
|
|
1009
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1010
|
+
"ts/no-floating-promises": "error",
|
|
1011
|
+
"ts/no-for-in-array": "error",
|
|
1012
|
+
"ts/no-implied-eval": "error",
|
|
1013
|
+
"ts/no-misused-promises": "error",
|
|
1014
|
+
"ts/no-throw-literal": "error",
|
|
1015
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1016
|
+
"ts/no-unsafe-argument": "error",
|
|
1017
|
+
"ts/no-unsafe-assignment": "error",
|
|
1018
|
+
"ts/no-unsafe-call": "error",
|
|
1019
|
+
"ts/no-unsafe-member-access": "error",
|
|
1020
|
+
"ts/no-unsafe-return": "error",
|
|
1021
|
+
"ts/restrict-plus-operands": "error",
|
|
1022
|
+
"ts/restrict-template-expressions": "error",
|
|
1023
|
+
"ts/unbound-method": "error"
|
|
1024
|
+
};
|
|
966
1025
|
return [
|
|
967
1026
|
{
|
|
968
1027
|
// Install the plugins without globs, so they can be configured separately.
|
|
@@ -981,7 +1040,12 @@ function typescript(options) {
|
|
|
981
1040
|
languageOptions: {
|
|
982
1041
|
parser: default16,
|
|
983
1042
|
parserOptions: {
|
|
984
|
-
sourceType: "module"
|
|
1043
|
+
sourceType: "module",
|
|
1044
|
+
...tsconfigPath ? {
|
|
1045
|
+
project: [tsconfigPath],
|
|
1046
|
+
tsconfigRootDir: process.cwd()
|
|
1047
|
+
} : {},
|
|
1048
|
+
...parserOptions
|
|
985
1049
|
}
|
|
986
1050
|
},
|
|
987
1051
|
rules: {
|
|
@@ -1025,6 +1089,7 @@ function typescript(options) {
|
|
|
1025
1089
|
"ts/prefer-ts-expect-error": "error",
|
|
1026
1090
|
"ts/triple-slash-reference": OFF,
|
|
1027
1091
|
"ts/unified-signatures": OFF,
|
|
1092
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1028
1093
|
...overrides
|
|
1029
1094
|
}
|
|
1030
1095
|
},
|
|
@@ -1051,54 +1116,6 @@ function typescript(options) {
|
|
|
1051
1116
|
}
|
|
1052
1117
|
];
|
|
1053
1118
|
}
|
|
1054
|
-
function typescriptWithTypes(options) {
|
|
1055
|
-
const {
|
|
1056
|
-
componentExts = [],
|
|
1057
|
-
tsconfigPath,
|
|
1058
|
-
tsconfigRootDir = process.cwd(),
|
|
1059
|
-
overrides = {}
|
|
1060
|
-
} = options;
|
|
1061
|
-
return [
|
|
1062
|
-
{
|
|
1063
|
-
files: [
|
|
1064
|
-
GLOB_TS,
|
|
1065
|
-
GLOB_TSX,
|
|
1066
|
-
...componentExts.map((ext) => `**/*.${ext}`),
|
|
1067
|
-
"!**/*.md/*.*"
|
|
1068
|
-
],
|
|
1069
|
-
ignores: ["**/*.md/*.*"],
|
|
1070
|
-
languageOptions: {
|
|
1071
|
-
parser: default16,
|
|
1072
|
-
parserOptions: {
|
|
1073
|
-
project: [tsconfigPath],
|
|
1074
|
-
tsconfigRootDir
|
|
1075
|
-
}
|
|
1076
|
-
},
|
|
1077
|
-
rules: {
|
|
1078
|
-
"dot-notation": OFF,
|
|
1079
|
-
"no-implied-eval": OFF,
|
|
1080
|
-
"no-throw-literal": OFF,
|
|
1081
|
-
"ts/await-thenable": "error",
|
|
1082
|
-
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1083
|
-
"ts/no-floating-promises": "error",
|
|
1084
|
-
"ts/no-for-in-array": "error",
|
|
1085
|
-
"ts/no-implied-eval": "error",
|
|
1086
|
-
"ts/no-misused-promises": "error",
|
|
1087
|
-
"ts/no-throw-literal": "error",
|
|
1088
|
-
"ts/no-unnecessary-type-assertion": "error",
|
|
1089
|
-
"ts/no-unsafe-argument": "error",
|
|
1090
|
-
"ts/no-unsafe-assignment": "error",
|
|
1091
|
-
"ts/no-unsafe-call": "error",
|
|
1092
|
-
"ts/no-unsafe-member-access": "error",
|
|
1093
|
-
"ts/no-unsafe-return": "error",
|
|
1094
|
-
"ts/restrict-plus-operands": "error",
|
|
1095
|
-
"ts/restrict-template-expressions": "error",
|
|
1096
|
-
"ts/unbound-method": "error",
|
|
1097
|
-
...overrides
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
];
|
|
1101
|
-
}
|
|
1102
1119
|
|
|
1103
1120
|
// src/configs/unicorn.ts
|
|
1104
1121
|
function unicorn() {
|
|
@@ -1148,7 +1165,8 @@ vueVersion = vueVersion && vueVersion[0];
|
|
|
1148
1165
|
vueVersion = Number.isNaN(vueVersion) ? "3" : vueVersion;
|
|
1149
1166
|
function vue(options = {}) {
|
|
1150
1167
|
const {
|
|
1151
|
-
overrides = {}
|
|
1168
|
+
overrides = {},
|
|
1169
|
+
stylistic: stylistic2 = true
|
|
1152
1170
|
} = options;
|
|
1153
1171
|
return [
|
|
1154
1172
|
{
|
|
@@ -1182,20 +1200,9 @@ function vue(options = {}) {
|
|
|
1182
1200
|
...default13.configs.recommended.rules
|
|
1183
1201
|
},
|
|
1184
1202
|
"node/prefer-global/process": OFF,
|
|
1185
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1186
|
-
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1187
1203
|
"vue/block-order": ["error", {
|
|
1188
1204
|
order: ["template", "script", "style"]
|
|
1189
1205
|
}],
|
|
1190
|
-
"vue/block-spacing": ["error", "always"],
|
|
1191
|
-
"vue/block-tag-newline": ["error", {
|
|
1192
|
-
multiline: "always",
|
|
1193
|
-
singleline: "always"
|
|
1194
|
-
}],
|
|
1195
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1196
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1197
|
-
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1198
|
-
"vue/comma-style": ["error", "last"],
|
|
1199
1206
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1200
1207
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1201
1208
|
"vue/custom-event-name-casing": vueVersion === "3" ? ["error", "camelCase"] : ["error", "kebab-case"],
|
|
@@ -1206,9 +1213,6 @@ function vue(options = {}) {
|
|
|
1206
1213
|
"vue/dot-location": ["error", "property"],
|
|
1207
1214
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1208
1215
|
"vue/eqeqeq": ["error", "smart"],
|
|
1209
|
-
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1210
|
-
exceptions: ["-"]
|
|
1211
|
-
}],
|
|
1212
1216
|
"vue/html-indent": ["error", 4, {
|
|
1213
1217
|
alignAttributesVertically: true,
|
|
1214
1218
|
attribute: 1,
|
|
@@ -1225,8 +1229,6 @@ function vue(options = {}) {
|
|
|
1225
1229
|
math: "always",
|
|
1226
1230
|
svg: "always"
|
|
1227
1231
|
}],
|
|
1228
|
-
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1229
|
-
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1230
1232
|
"vue/max-attributes-per-line": OFF,
|
|
1231
1233
|
"vue/multi-word-component-names": OFF,
|
|
1232
1234
|
"vue/no-constant-condition": "warn",
|
|
@@ -1248,9 +1250,6 @@ function vue(options = {}) {
|
|
|
1248
1250
|
"vue/no-useless-v-bind": "error",
|
|
1249
1251
|
"vue/no-v-html": OFF,
|
|
1250
1252
|
"vue/no-v-text-v-html-on-component": OFF,
|
|
1251
|
-
"vue/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
1252
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1253
|
-
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1254
1253
|
"vue/object-shorthand": [
|
|
1255
1254
|
"error",
|
|
1256
1255
|
"always",
|
|
@@ -1259,18 +1258,39 @@ function vue(options = {}) {
|
|
|
1259
1258
|
ignoreConstructors: false
|
|
1260
1259
|
}
|
|
1261
1260
|
],
|
|
1262
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1263
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1264
1261
|
"vue/prefer-separate-static-class": "error",
|
|
1265
1262
|
"vue/prefer-template": "error",
|
|
1266
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1267
1263
|
"vue/require-default-prop": OFF,
|
|
1268
1264
|
"vue/require-prop-types": OFF,
|
|
1269
1265
|
"vue/singleline-html-element-content-newline": "off",
|
|
1270
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1271
1266
|
"vue/space-infix-ops": "error",
|
|
1272
1267
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1273
|
-
|
|
1268
|
+
...stylistic2 ? {
|
|
1269
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1270
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1271
|
+
"vue/block-spacing": ["error", "always"],
|
|
1272
|
+
"vue/block-tag-newline": ["error", {
|
|
1273
|
+
multiline: "always",
|
|
1274
|
+
singleline: "always"
|
|
1275
|
+
}],
|
|
1276
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1277
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1278
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1279
|
+
"vue/comma-style": ["error", "last"],
|
|
1280
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1281
|
+
exceptions: ["-"]
|
|
1282
|
+
}],
|
|
1283
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1284
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1285
|
+
"vue/object-curly-newline": OFF,
|
|
1286
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1287
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1288
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1289
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1290
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1291
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1292
|
+
"vue/template-curly-spacing": "error"
|
|
1293
|
+
} : {},
|
|
1274
1294
|
...overrides
|
|
1275
1295
|
}
|
|
1276
1296
|
}
|
|
@@ -1280,7 +1300,8 @@ function vue(options = {}) {
|
|
|
1280
1300
|
// src/configs/yaml.ts
|
|
1281
1301
|
function yaml(options = {}) {
|
|
1282
1302
|
const {
|
|
1283
|
-
overrides = {}
|
|
1303
|
+
overrides = {},
|
|
1304
|
+
stylistic: stylistic2 = true
|
|
1284
1305
|
} = options;
|
|
1285
1306
|
return [
|
|
1286
1307
|
{
|
|
@@ -1296,23 +1317,25 @@ function yaml(options = {}) {
|
|
|
1296
1317
|
rules: {
|
|
1297
1318
|
"style/spaced-comment": OFF,
|
|
1298
1319
|
"yaml/block-mapping": "error",
|
|
1299
|
-
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1300
1320
|
"yaml/block-sequence": "error",
|
|
1301
|
-
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1302
|
-
"yaml/flow-mapping-curly-newline": "error",
|
|
1303
|
-
"yaml/flow-mapping-curly-spacing": "error",
|
|
1304
|
-
"yaml/flow-sequence-bracket-newline": "error",
|
|
1305
|
-
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1306
|
-
"yaml/indent": ["error", 2],
|
|
1307
|
-
"yaml/key-spacing": "error",
|
|
1308
1321
|
"yaml/no-empty-key": "error",
|
|
1309
1322
|
"yaml/no-empty-sequence-entry": "error",
|
|
1310
1323
|
"yaml/no-irregular-whitespace": "error",
|
|
1311
|
-
"yaml/no-tab-indent": "error",
|
|
1312
1324
|
"yaml/plain-scalar": "error",
|
|
1313
|
-
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1314
|
-
"yaml/spaced-comment": "error",
|
|
1315
1325
|
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1326
|
+
...stylistic2 ? {
|
|
1327
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1328
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1329
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1330
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1331
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1332
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1333
|
+
"yaml/indent": ["error", 2],
|
|
1334
|
+
"yaml/key-spacing": "error",
|
|
1335
|
+
"yaml/no-tab-indent": "error",
|
|
1336
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1337
|
+
"yaml/spaced-comment": "error"
|
|
1338
|
+
} : {},
|
|
1316
1339
|
...overrides
|
|
1317
1340
|
}
|
|
1318
1341
|
}
|
|
@@ -1386,8 +1409,12 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1386
1409
|
}),
|
|
1387
1410
|
comments(),
|
|
1388
1411
|
node(),
|
|
1389
|
-
jsdoc(
|
|
1390
|
-
|
|
1412
|
+
jsdoc({
|
|
1413
|
+
stylistic: enableStylistic
|
|
1414
|
+
}),
|
|
1415
|
+
imports({
|
|
1416
|
+
stylistic: enableStylistic
|
|
1417
|
+
}),
|
|
1391
1418
|
unicorn()
|
|
1392
1419
|
);
|
|
1393
1420
|
const componentExts = [];
|
|
@@ -1395,16 +1422,10 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1395
1422
|
componentExts.push("vue");
|
|
1396
1423
|
if (enableTypeScript) {
|
|
1397
1424
|
configs.push(typescript({
|
|
1425
|
+
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
1398
1426
|
componentExts,
|
|
1399
1427
|
overrides: overrides.typescript
|
|
1400
1428
|
}));
|
|
1401
|
-
if (typeof enableTypeScript !== "boolean") {
|
|
1402
|
-
configs.push(typescriptWithTypes({
|
|
1403
|
-
...enableTypeScript,
|
|
1404
|
-
componentExts,
|
|
1405
|
-
overrides: overrides.typescriptWithTypes
|
|
1406
|
-
}));
|
|
1407
|
-
}
|
|
1408
1429
|
}
|
|
1409
1430
|
if (enableStylistic) {
|
|
1410
1431
|
configs.push(stylistic({
|
|
@@ -1420,18 +1441,26 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1420
1441
|
if (enableVue) {
|
|
1421
1442
|
configs.push(vue({
|
|
1422
1443
|
overrides: overrides.vue,
|
|
1444
|
+
stylistic: enableStylistic,
|
|
1423
1445
|
typescript: !!enableTypeScript
|
|
1424
1446
|
}));
|
|
1425
1447
|
}
|
|
1426
1448
|
if (options.jsonc ?? true) {
|
|
1427
1449
|
configs.push(
|
|
1428
|
-
jsonc(
|
|
1450
|
+
jsonc({
|
|
1451
|
+
overrides: overrides.jsonc,
|
|
1452
|
+
stylistic: enableStylistic
|
|
1453
|
+
}),
|
|
1429
1454
|
sortPackageJson(),
|
|
1430
1455
|
sortTsconfig()
|
|
1431
1456
|
);
|
|
1432
1457
|
}
|
|
1433
|
-
if (options.yaml ?? true)
|
|
1434
|
-
configs.push(yaml(
|
|
1458
|
+
if (options.yaml ?? true) {
|
|
1459
|
+
configs.push(yaml({
|
|
1460
|
+
overrides: overrides.yaml,
|
|
1461
|
+
stylistic: enableStylistic
|
|
1462
|
+
}));
|
|
1463
|
+
}
|
|
1435
1464
|
if (options.markdown ?? true) {
|
|
1436
1465
|
configs.push(markdown({
|
|
1437
1466
|
componentExts,
|
|
@@ -1513,7 +1542,6 @@ export {
|
|
|
1513
1542
|
stylistic,
|
|
1514
1543
|
test,
|
|
1515
1544
|
typescript,
|
|
1516
|
-
typescriptWithTypes,
|
|
1517
1545
|
unicorn,
|
|
1518
1546
|
vue,
|
|
1519
1547
|
warnUnnecessaryOffRules,
|
package/package.json
CHANGED