@lincy/eslint-config 5.1.1 → 5.2.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 +29 -0
- package/dist/index.cjs +52 -15
- package/dist/index.d.cts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.js +52 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -261,6 +261,27 @@ export default lincy({
|
|
|
261
261
|
unocss: {
|
|
262
262
|
// unocss 规则
|
|
263
263
|
},
|
|
264
|
+
comments: {
|
|
265
|
+
// comments 规则
|
|
266
|
+
},
|
|
267
|
+
imports: {
|
|
268
|
+
// imports 规则
|
|
269
|
+
},
|
|
270
|
+
jsdoc: {
|
|
271
|
+
// jsdoc 规则
|
|
272
|
+
},
|
|
273
|
+
node: {
|
|
274
|
+
// node 规则
|
|
275
|
+
},
|
|
276
|
+
perfectionist: {
|
|
277
|
+
// perfectionist 规则
|
|
278
|
+
},
|
|
279
|
+
sort: {
|
|
280
|
+
// sort 规则
|
|
281
|
+
},
|
|
282
|
+
unicorn: {
|
|
283
|
+
// unicorn 规则
|
|
284
|
+
},
|
|
264
285
|
regexp: {
|
|
265
286
|
// regexp 规则
|
|
266
287
|
}
|
|
@@ -325,11 +346,14 @@ export default lincy(
|
|
|
325
346
|
import {
|
|
326
347
|
combine,
|
|
327
348
|
comments,
|
|
349
|
+
disables,
|
|
350
|
+
formatters,
|
|
328
351
|
ignores,
|
|
329
352
|
imports,
|
|
330
353
|
javascript,
|
|
331
354
|
jsdoc,
|
|
332
355
|
jsonc,
|
|
356
|
+
jsx,
|
|
333
357
|
markdown,
|
|
334
358
|
node,
|
|
335
359
|
perfectionist,
|
|
@@ -338,6 +362,7 @@ import {
|
|
|
338
362
|
sortPackageJson,
|
|
339
363
|
sortTsconfig,
|
|
340
364
|
stylistic,
|
|
365
|
+
test,
|
|
341
366
|
toml,
|
|
342
367
|
typescript,
|
|
343
368
|
unicorn,
|
|
@@ -350,6 +375,8 @@ export default combine(
|
|
|
350
375
|
ignores(),
|
|
351
376
|
javascript(/* Options */),
|
|
352
377
|
comments(),
|
|
378
|
+
disables(),
|
|
379
|
+
formatters(),
|
|
353
380
|
node(),
|
|
354
381
|
jsdoc(),
|
|
355
382
|
imports(),
|
|
@@ -361,8 +388,10 @@ export default combine(
|
|
|
361
388
|
react(/* Options */),
|
|
362
389
|
unocss(/* Options */),
|
|
363
390
|
jsonc(),
|
|
391
|
+
jsx(),
|
|
364
392
|
yaml(),
|
|
365
393
|
toml(),
|
|
394
|
+
test(),
|
|
366
395
|
markdown(),
|
|
367
396
|
regexp(),
|
|
368
397
|
)
|
package/dist/index.cjs
CHANGED
|
@@ -117,7 +117,10 @@ var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
|
117
117
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
118
118
|
|
|
119
119
|
// src/configs/comments.ts
|
|
120
|
-
async function comments() {
|
|
120
|
+
async function comments(options = {}) {
|
|
121
|
+
const {
|
|
122
|
+
overrides = {}
|
|
123
|
+
} = options;
|
|
121
124
|
return [
|
|
122
125
|
{
|
|
123
126
|
name: "eslint/comments/rules",
|
|
@@ -128,7 +131,8 @@ async function comments() {
|
|
|
128
131
|
"eslint-comments/no-aggregating-enable": "error",
|
|
129
132
|
"eslint-comments/no-duplicate-disable": "error",
|
|
130
133
|
"eslint-comments/no-unlimited-disable": "error",
|
|
131
|
-
"eslint-comments/no-unused-enable": "error"
|
|
134
|
+
"eslint-comments/no-unused-enable": "error",
|
|
135
|
+
...overrides
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
138
|
];
|
|
@@ -628,6 +632,7 @@ async function ignores(options = {}) {
|
|
|
628
632
|
// src/configs/imports.ts
|
|
629
633
|
async function imports(options = {}) {
|
|
630
634
|
const {
|
|
635
|
+
overrides = {},
|
|
631
636
|
stylistic: stylistic2 = true
|
|
632
637
|
} = options;
|
|
633
638
|
return [
|
|
@@ -649,7 +654,8 @@ async function imports(options = {}) {
|
|
|
649
654
|
"import/no-webpack-loader-syntax": "error",
|
|
650
655
|
...stylistic2 ? {
|
|
651
656
|
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
652
|
-
} : {}
|
|
657
|
+
} : {},
|
|
658
|
+
...overrides
|
|
653
659
|
}
|
|
654
660
|
}
|
|
655
661
|
];
|
|
@@ -864,6 +870,7 @@ async function javascript(options = {}) {
|
|
|
864
870
|
// src/configs/jsdoc.ts
|
|
865
871
|
async function jsdoc(options = {}) {
|
|
866
872
|
const {
|
|
873
|
+
overrides = {},
|
|
867
874
|
stylistic: stylistic2 = true
|
|
868
875
|
} = options;
|
|
869
876
|
return [
|
|
@@ -891,7 +898,8 @@ async function jsdoc(options = {}) {
|
|
|
891
898
|
...stylistic2 ? {
|
|
892
899
|
"jsdoc/check-alignment": "warn",
|
|
893
900
|
"jsdoc/multiline-blocks": "warn"
|
|
894
|
-
} : {}
|
|
901
|
+
} : {},
|
|
902
|
+
...overrides
|
|
895
903
|
}
|
|
896
904
|
}
|
|
897
905
|
];
|
|
@@ -1081,7 +1089,10 @@ async function markdown(options = {}) {
|
|
|
1081
1089
|
}
|
|
1082
1090
|
|
|
1083
1091
|
// src/configs/node.ts
|
|
1084
|
-
async function node() {
|
|
1092
|
+
async function node(options = {}) {
|
|
1093
|
+
const {
|
|
1094
|
+
overrides = {}
|
|
1095
|
+
} = options;
|
|
1085
1096
|
return [
|
|
1086
1097
|
{
|
|
1087
1098
|
name: "eslint/node/rules",
|
|
@@ -1096,14 +1107,18 @@ async function node() {
|
|
|
1096
1107
|
"node/no-path-concat": "error",
|
|
1097
1108
|
"node/prefer-global/buffer": ["error", "never"],
|
|
1098
1109
|
"node/prefer-global/process": ["error", "never"],
|
|
1099
|
-
"node/process-exit-as-throw": "error"
|
|
1110
|
+
"node/process-exit-as-throw": "error",
|
|
1111
|
+
...overrides
|
|
1100
1112
|
}
|
|
1101
1113
|
}
|
|
1102
1114
|
];
|
|
1103
1115
|
}
|
|
1104
1116
|
|
|
1105
1117
|
// src/configs/perfectionist.ts
|
|
1106
|
-
async function perfectionist() {
|
|
1118
|
+
async function perfectionist(options = {}) {
|
|
1119
|
+
const {
|
|
1120
|
+
overrides = {}
|
|
1121
|
+
} = options;
|
|
1107
1122
|
return [
|
|
1108
1123
|
{
|
|
1109
1124
|
name: "eslint/perfectionist/setup",
|
|
@@ -1115,10 +1130,10 @@ async function perfectionist() {
|
|
|
1115
1130
|
"perfectionist/sort-imports": ["error", {
|
|
1116
1131
|
groups: [
|
|
1117
1132
|
"type",
|
|
1118
|
-
["parent-type", "sibling-type", "index-type"],
|
|
1133
|
+
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
1119
1134
|
"builtin",
|
|
1120
1135
|
"external",
|
|
1121
|
-
["internal"
|
|
1136
|
+
["internal"],
|
|
1122
1137
|
["parent", "sibling", "index"],
|
|
1123
1138
|
"side-effect",
|
|
1124
1139
|
"object",
|
|
@@ -1129,7 +1144,8 @@ async function perfectionist() {
|
|
|
1129
1144
|
type: "natural"
|
|
1130
1145
|
}],
|
|
1131
1146
|
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
1132
|
-
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
1147
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }],
|
|
1148
|
+
...overrides
|
|
1133
1149
|
}
|
|
1134
1150
|
}
|
|
1135
1151
|
];
|
|
@@ -1729,6 +1745,7 @@ async function typescript(options = {}) {
|
|
|
1729
1745
|
),
|
|
1730
1746
|
"no-dupe-class-members": "off",
|
|
1731
1747
|
"no-redeclare": "off",
|
|
1748
|
+
"no-unused-expressions": "off",
|
|
1732
1749
|
"no-use-before-define": "off",
|
|
1733
1750
|
"no-useless-constructor": "off",
|
|
1734
1751
|
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
@@ -1748,6 +1765,14 @@ async function typescript(options = {}) {
|
|
|
1748
1765
|
"ts/no-non-null-assertion": "off",
|
|
1749
1766
|
"ts/no-redeclare": "error",
|
|
1750
1767
|
"ts/no-require-imports": "error",
|
|
1768
|
+
"ts/no-unused-expressions": ["error", {
|
|
1769
|
+
// allowShortCircuit 设置为 true 将允许你在表达式中使用短路计算(默认值:false)
|
|
1770
|
+
allowShortCircuit: true,
|
|
1771
|
+
// allowTaggedTemplates 设置为 true 将使你能够在表达式中使用标记模板字面量(默认值:false)
|
|
1772
|
+
allowTaggedTemplates: true,
|
|
1773
|
+
// allowTernary 设置为 true 将使你能够在表达式中使用三元运算符,类似于短路计算(默认值:false)
|
|
1774
|
+
allowTernary: true
|
|
1775
|
+
}],
|
|
1751
1776
|
"ts/no-unused-vars": "off",
|
|
1752
1777
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1753
1778
|
"ts/no-useless-constructor": "off",
|
|
@@ -1801,7 +1826,8 @@ async function unicorn(options = {}) {
|
|
|
1801
1826
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1802
1827
|
"unicorn/prefer-type-error": "error",
|
|
1803
1828
|
"unicorn/throw-new-error": "error"
|
|
1804
|
-
}
|
|
1829
|
+
},
|
|
1830
|
+
...options.overrides
|
|
1805
1831
|
}
|
|
1806
1832
|
}
|
|
1807
1833
|
];
|
|
@@ -2156,19 +2182,30 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2156
2182
|
isInEditor,
|
|
2157
2183
|
overrides: overrides.javascript
|
|
2158
2184
|
}),
|
|
2159
|
-
comments(
|
|
2160
|
-
|
|
2185
|
+
comments({
|
|
2186
|
+
overrides: overrides.comments
|
|
2187
|
+
}),
|
|
2188
|
+
node({
|
|
2189
|
+
overrides: overrides.node
|
|
2190
|
+
}),
|
|
2161
2191
|
jsdoc({
|
|
2192
|
+
overrides: overrides.jsdoc,
|
|
2162
2193
|
stylistic: stylisticOptions
|
|
2163
2194
|
}),
|
|
2164
2195
|
imports({
|
|
2196
|
+
overrides: overrides.imports,
|
|
2165
2197
|
stylistic: stylisticOptions
|
|
2166
2198
|
}),
|
|
2167
2199
|
// Optional plugins (installed but not enabled by default)
|
|
2168
|
-
perfectionist(
|
|
2200
|
+
perfectionist({
|
|
2201
|
+
overrides: overrides.perfectionist
|
|
2202
|
+
})
|
|
2169
2203
|
);
|
|
2170
2204
|
if (enableUnicorn) {
|
|
2171
|
-
configs2.push(unicorn(
|
|
2205
|
+
configs2.push(unicorn({
|
|
2206
|
+
...enableUnicorn === true ? {} : enableUnicorn,
|
|
2207
|
+
overrides: overrides.unicorn
|
|
2208
|
+
}));
|
|
2172
2209
|
}
|
|
2173
2210
|
if (enableVue) {
|
|
2174
2211
|
componentExts.push("vue");
|
package/dist/index.d.cts
CHANGED
|
@@ -14665,6 +14665,12 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
14665
14665
|
yaml?: TypedFlatConfigItem['rules'];
|
|
14666
14666
|
toml?: TypedFlatConfigItem['rules'];
|
|
14667
14667
|
unocss?: TypedFlatConfigItem['rules'];
|
|
14668
|
+
perfectionist?: TypedFlatConfigItem['rules'];
|
|
14669
|
+
unicorn?: TypedFlatConfigItem['rules'];
|
|
14670
|
+
comments?: TypedFlatConfigItem['rules'];
|
|
14671
|
+
node?: TypedFlatConfigItem['rules'];
|
|
14672
|
+
imports?: TypedFlatConfigItem['rules'];
|
|
14673
|
+
jsdoc?: TypedFlatConfigItem['rules'];
|
|
14668
14674
|
ignores?: string[];
|
|
14669
14675
|
};
|
|
14670
14676
|
}
|
|
@@ -14686,7 +14692,7 @@ declare const defaultPluginRenaming: {
|
|
|
14686
14692
|
*/
|
|
14687
14693
|
declare function lincy(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]): FlatConfigComposer<TypedFlatConfigItem>;
|
|
14688
14694
|
|
|
14689
|
-
declare function comments(): Promise<TypedFlatConfigItem[]>;
|
|
14695
|
+
declare function comments(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14690
14696
|
|
|
14691
14697
|
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
14692
14698
|
|
|
@@ -14694,11 +14700,11 @@ declare function formatters(options?: OptionsFormatters | true, stylistic?: Styl
|
|
|
14694
14700
|
|
|
14695
14701
|
declare function ignores(options?: OptionsIgnores): Promise<TypedFlatConfigItem[]>;
|
|
14696
14702
|
|
|
14697
|
-
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
14703
|
+
declare function imports(options?: OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14698
14704
|
|
|
14699
14705
|
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14700
14706
|
|
|
14701
|
-
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
14707
|
+
declare function jsdoc(options?: OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14702
14708
|
|
|
14703
14709
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14704
14710
|
|
|
@@ -14706,14 +14712,14 @@ declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
|
14706
14712
|
|
|
14707
14713
|
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14708
14714
|
|
|
14709
|
-
declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
14715
|
+
declare function node(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14710
14716
|
|
|
14711
14717
|
/**
|
|
14712
14718
|
* Optional perfectionist plugin for props and items sorting.
|
|
14713
14719
|
*
|
|
14714
14720
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
14715
14721
|
*/
|
|
14716
|
-
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
14722
|
+
declare function perfectionist(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14717
14723
|
|
|
14718
14724
|
declare function react(options?: OptionsFiles & OptionsReact & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14719
14725
|
|
|
@@ -14741,7 +14747,7 @@ declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
|
|
|
14741
14747
|
|
|
14742
14748
|
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
|
|
14743
14749
|
|
|
14744
|
-
declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
|
|
14750
|
+
declare function unicorn(options?: OptionsUnicorn & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14745
14751
|
|
|
14746
14752
|
declare function unocss(options?: OptionsUnoCSS & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14747
14753
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14665,6 +14665,12 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
14665
14665
|
yaml?: TypedFlatConfigItem['rules'];
|
|
14666
14666
|
toml?: TypedFlatConfigItem['rules'];
|
|
14667
14667
|
unocss?: TypedFlatConfigItem['rules'];
|
|
14668
|
+
perfectionist?: TypedFlatConfigItem['rules'];
|
|
14669
|
+
unicorn?: TypedFlatConfigItem['rules'];
|
|
14670
|
+
comments?: TypedFlatConfigItem['rules'];
|
|
14671
|
+
node?: TypedFlatConfigItem['rules'];
|
|
14672
|
+
imports?: TypedFlatConfigItem['rules'];
|
|
14673
|
+
jsdoc?: TypedFlatConfigItem['rules'];
|
|
14668
14674
|
ignores?: string[];
|
|
14669
14675
|
};
|
|
14670
14676
|
}
|
|
@@ -14686,7 +14692,7 @@ declare const defaultPluginRenaming: {
|
|
|
14686
14692
|
*/
|
|
14687
14693
|
declare function lincy(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[]>[]): FlatConfigComposer<TypedFlatConfigItem>;
|
|
14688
14694
|
|
|
14689
|
-
declare function comments(): Promise<TypedFlatConfigItem[]>;
|
|
14695
|
+
declare function comments(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14690
14696
|
|
|
14691
14697
|
declare function disables(): Promise<TypedFlatConfigItem[]>;
|
|
14692
14698
|
|
|
@@ -14694,11 +14700,11 @@ declare function formatters(options?: OptionsFormatters | true, stylistic?: Styl
|
|
|
14694
14700
|
|
|
14695
14701
|
declare function ignores(options?: OptionsIgnores): Promise<TypedFlatConfigItem[]>;
|
|
14696
14702
|
|
|
14697
|
-
declare function imports(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
14703
|
+
declare function imports(options?: OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14698
14704
|
|
|
14699
14705
|
declare function javascript(options?: OptionsIsInEditor & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14700
14706
|
|
|
14701
|
-
declare function jsdoc(options?: OptionsStylistic): Promise<TypedFlatConfigItem[]>;
|
|
14707
|
+
declare function jsdoc(options?: OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14702
14708
|
|
|
14703
14709
|
declare function jsonc(options?: OptionsFiles & OptionsStylistic & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14704
14710
|
|
|
@@ -14706,14 +14712,14 @@ declare function jsx(): Promise<TypedFlatConfigItem[]>;
|
|
|
14706
14712
|
|
|
14707
14713
|
declare function markdown(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14708
14714
|
|
|
14709
|
-
declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
14715
|
+
declare function node(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14710
14716
|
|
|
14711
14717
|
/**
|
|
14712
14718
|
* Optional perfectionist plugin for props and items sorting.
|
|
14713
14719
|
*
|
|
14714
14720
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
14715
14721
|
*/
|
|
14716
|
-
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
14722
|
+
declare function perfectionist(options?: OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14717
14723
|
|
|
14718
14724
|
declare function react(options?: OptionsFiles & OptionsReact & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14719
14725
|
|
|
@@ -14741,7 +14747,7 @@ declare function toml(options?: OptionsOverrides & OptionsStylistic & OptionsFil
|
|
|
14741
14747
|
|
|
14742
14748
|
declare function typescript(options?: OptionsFiles & OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsProjectType): Promise<TypedFlatConfigItem[]>;
|
|
14743
14749
|
|
|
14744
|
-
declare function unicorn(options?: OptionsUnicorn): Promise<TypedFlatConfigItem[]>;
|
|
14750
|
+
declare function unicorn(options?: OptionsUnicorn & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14745
14751
|
|
|
14746
14752
|
declare function unocss(options?: OptionsUnoCSS & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
14747
14753
|
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,10 @@ import { default as default6 } from "eslint-plugin-unicorn";
|
|
|
12
12
|
import { default as default7 } from "eslint-plugin-unused-imports";
|
|
13
13
|
|
|
14
14
|
// src/configs/comments.ts
|
|
15
|
-
async function comments() {
|
|
15
|
+
async function comments(options = {}) {
|
|
16
|
+
const {
|
|
17
|
+
overrides = {}
|
|
18
|
+
} = options;
|
|
16
19
|
return [
|
|
17
20
|
{
|
|
18
21
|
name: "eslint/comments/rules",
|
|
@@ -23,7 +26,8 @@ async function comments() {
|
|
|
23
26
|
"eslint-comments/no-aggregating-enable": "error",
|
|
24
27
|
"eslint-comments/no-duplicate-disable": "error",
|
|
25
28
|
"eslint-comments/no-unlimited-disable": "error",
|
|
26
|
-
"eslint-comments/no-unused-enable": "error"
|
|
29
|
+
"eslint-comments/no-unused-enable": "error",
|
|
30
|
+
...overrides
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
];
|
|
@@ -523,6 +527,7 @@ async function ignores(options = {}) {
|
|
|
523
527
|
// src/configs/imports.ts
|
|
524
528
|
async function imports(options = {}) {
|
|
525
529
|
const {
|
|
530
|
+
overrides = {},
|
|
526
531
|
stylistic: stylistic2 = true
|
|
527
532
|
} = options;
|
|
528
533
|
return [
|
|
@@ -544,7 +549,8 @@ async function imports(options = {}) {
|
|
|
544
549
|
"import/no-webpack-loader-syntax": "error",
|
|
545
550
|
...stylistic2 ? {
|
|
546
551
|
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
547
|
-
} : {}
|
|
552
|
+
} : {},
|
|
553
|
+
...overrides
|
|
548
554
|
}
|
|
549
555
|
}
|
|
550
556
|
];
|
|
@@ -759,6 +765,7 @@ async function javascript(options = {}) {
|
|
|
759
765
|
// src/configs/jsdoc.ts
|
|
760
766
|
async function jsdoc(options = {}) {
|
|
761
767
|
const {
|
|
768
|
+
overrides = {},
|
|
762
769
|
stylistic: stylistic2 = true
|
|
763
770
|
} = options;
|
|
764
771
|
return [
|
|
@@ -786,7 +793,8 @@ async function jsdoc(options = {}) {
|
|
|
786
793
|
...stylistic2 ? {
|
|
787
794
|
"jsdoc/check-alignment": "warn",
|
|
788
795
|
"jsdoc/multiline-blocks": "warn"
|
|
789
|
-
} : {}
|
|
796
|
+
} : {},
|
|
797
|
+
...overrides
|
|
790
798
|
}
|
|
791
799
|
}
|
|
792
800
|
];
|
|
@@ -976,7 +984,10 @@ async function markdown(options = {}) {
|
|
|
976
984
|
}
|
|
977
985
|
|
|
978
986
|
// src/configs/node.ts
|
|
979
|
-
async function node() {
|
|
987
|
+
async function node(options = {}) {
|
|
988
|
+
const {
|
|
989
|
+
overrides = {}
|
|
990
|
+
} = options;
|
|
980
991
|
return [
|
|
981
992
|
{
|
|
982
993
|
name: "eslint/node/rules",
|
|
@@ -991,14 +1002,18 @@ async function node() {
|
|
|
991
1002
|
"node/no-path-concat": "error",
|
|
992
1003
|
"node/prefer-global/buffer": ["error", "never"],
|
|
993
1004
|
"node/prefer-global/process": ["error", "never"],
|
|
994
|
-
"node/process-exit-as-throw": "error"
|
|
1005
|
+
"node/process-exit-as-throw": "error",
|
|
1006
|
+
...overrides
|
|
995
1007
|
}
|
|
996
1008
|
}
|
|
997
1009
|
];
|
|
998
1010
|
}
|
|
999
1011
|
|
|
1000
1012
|
// src/configs/perfectionist.ts
|
|
1001
|
-
async function perfectionist() {
|
|
1013
|
+
async function perfectionist(options = {}) {
|
|
1014
|
+
const {
|
|
1015
|
+
overrides = {}
|
|
1016
|
+
} = options;
|
|
1002
1017
|
return [
|
|
1003
1018
|
{
|
|
1004
1019
|
name: "eslint/perfectionist/setup",
|
|
@@ -1010,10 +1025,10 @@ async function perfectionist() {
|
|
|
1010
1025
|
"perfectionist/sort-imports": ["error", {
|
|
1011
1026
|
groups: [
|
|
1012
1027
|
"type",
|
|
1013
|
-
["parent-type", "sibling-type", "index-type"],
|
|
1028
|
+
["parent-type", "sibling-type", "index-type", "internal-type"],
|
|
1014
1029
|
"builtin",
|
|
1015
1030
|
"external",
|
|
1016
|
-
["internal"
|
|
1031
|
+
["internal"],
|
|
1017
1032
|
["parent", "sibling", "index"],
|
|
1018
1033
|
"side-effect",
|
|
1019
1034
|
"object",
|
|
@@ -1024,7 +1039,8 @@ async function perfectionist() {
|
|
|
1024
1039
|
type: "natural"
|
|
1025
1040
|
}],
|
|
1026
1041
|
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
1027
|
-
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
1042
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }],
|
|
1043
|
+
...overrides
|
|
1028
1044
|
}
|
|
1029
1045
|
}
|
|
1030
1046
|
];
|
|
@@ -1624,6 +1640,7 @@ async function typescript(options = {}) {
|
|
|
1624
1640
|
),
|
|
1625
1641
|
"no-dupe-class-members": "off",
|
|
1626
1642
|
"no-redeclare": "off",
|
|
1643
|
+
"no-unused-expressions": "off",
|
|
1627
1644
|
"no-use-before-define": "off",
|
|
1628
1645
|
"no-useless-constructor": "off",
|
|
1629
1646
|
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
@@ -1643,6 +1660,14 @@ async function typescript(options = {}) {
|
|
|
1643
1660
|
"ts/no-non-null-assertion": "off",
|
|
1644
1661
|
"ts/no-redeclare": "error",
|
|
1645
1662
|
"ts/no-require-imports": "error",
|
|
1663
|
+
"ts/no-unused-expressions": ["error", {
|
|
1664
|
+
// allowShortCircuit 设置为 true 将允许你在表达式中使用短路计算(默认值:false)
|
|
1665
|
+
allowShortCircuit: true,
|
|
1666
|
+
// allowTaggedTemplates 设置为 true 将使你能够在表达式中使用标记模板字面量(默认值:false)
|
|
1667
|
+
allowTaggedTemplates: true,
|
|
1668
|
+
// allowTernary 设置为 true 将使你能够在表达式中使用三元运算符,类似于短路计算(默认值:false)
|
|
1669
|
+
allowTernary: true
|
|
1670
|
+
}],
|
|
1646
1671
|
"ts/no-unused-vars": "off",
|
|
1647
1672
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1648
1673
|
"ts/no-useless-constructor": "off",
|
|
@@ -1696,7 +1721,8 @@ async function unicorn(options = {}) {
|
|
|
1696
1721
|
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1697
1722
|
"unicorn/prefer-type-error": "error",
|
|
1698
1723
|
"unicorn/throw-new-error": "error"
|
|
1699
|
-
}
|
|
1724
|
+
},
|
|
1725
|
+
...options.overrides
|
|
1700
1726
|
}
|
|
1701
1727
|
}
|
|
1702
1728
|
];
|
|
@@ -2051,19 +2077,30 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2051
2077
|
isInEditor,
|
|
2052
2078
|
overrides: overrides.javascript
|
|
2053
2079
|
}),
|
|
2054
|
-
comments(
|
|
2055
|
-
|
|
2080
|
+
comments({
|
|
2081
|
+
overrides: overrides.comments
|
|
2082
|
+
}),
|
|
2083
|
+
node({
|
|
2084
|
+
overrides: overrides.node
|
|
2085
|
+
}),
|
|
2056
2086
|
jsdoc({
|
|
2087
|
+
overrides: overrides.jsdoc,
|
|
2057
2088
|
stylistic: stylisticOptions
|
|
2058
2089
|
}),
|
|
2059
2090
|
imports({
|
|
2091
|
+
overrides: overrides.imports,
|
|
2060
2092
|
stylistic: stylisticOptions
|
|
2061
2093
|
}),
|
|
2062
2094
|
// Optional plugins (installed but not enabled by default)
|
|
2063
|
-
perfectionist(
|
|
2095
|
+
perfectionist({
|
|
2096
|
+
overrides: overrides.perfectionist
|
|
2097
|
+
})
|
|
2064
2098
|
);
|
|
2065
2099
|
if (enableUnicorn) {
|
|
2066
|
-
configs2.push(unicorn(
|
|
2100
|
+
configs2.push(unicorn({
|
|
2101
|
+
...enableUnicorn === true ? {} : enableUnicorn,
|
|
2102
|
+
overrides: overrides.unicorn
|
|
2103
|
+
}));
|
|
2067
2104
|
}
|
|
2068
2105
|
if (enableVue) {
|
|
2069
2106
|
componentExts.push("vue");
|
package/package.json
CHANGED