@lincy/eslint-config 3.5.0 → 3.5.2
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 +15 -3
- package/dist/index.cjs +46 -14
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +53 -23
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -136,6 +136,8 @@ export default lincy({
|
|
|
136
136
|
typescript: true, // 默认值: 检测是否安装typescript依赖, 可选: false
|
|
137
137
|
// 是否启用 vue 规则
|
|
138
138
|
vue: true, // 默认值: 检测是否安装vue依赖, 可选: false
|
|
139
|
+
// 是否启用 jsx 规则
|
|
140
|
+
jsx: true, // 默认值: true, 可选: false
|
|
139
141
|
// 是否启用 jsonc 规则
|
|
140
142
|
jsonc: false, // 默认值: true, 可选: false
|
|
141
143
|
// 是否启用 yaml 规则
|
|
@@ -146,6 +148,8 @@ export default lincy({
|
|
|
146
148
|
test: false, // 默认值: true, 可选: false
|
|
147
149
|
// 是否启用 markdown 规则
|
|
148
150
|
markdown: false, // 默认值: true, 可选: false
|
|
151
|
+
// 是否启用 eslint-plugin-sort-keys 规则
|
|
152
|
+
sortKeys: true, // 默认值: false, 可选: true
|
|
149
153
|
// 覆盖规则
|
|
150
154
|
overrides: {},
|
|
151
155
|
|
|
@@ -217,6 +221,7 @@ import {
|
|
|
217
221
|
jsonc,
|
|
218
222
|
markdown,
|
|
219
223
|
node,
|
|
224
|
+
sortKeys,
|
|
220
225
|
sortPackageJson,
|
|
221
226
|
sortTsconfig,
|
|
222
227
|
stylistic,
|
|
@@ -227,12 +232,15 @@ import {
|
|
|
227
232
|
} from '@lincy/eslint-config'
|
|
228
233
|
|
|
229
234
|
export default [
|
|
235
|
+
...comments(),
|
|
230
236
|
...ignores(),
|
|
237
|
+
...imports(),
|
|
231
238
|
...javascript(),
|
|
232
|
-
...comments(),
|
|
233
|
-
...node(),
|
|
234
239
|
...jsdoc(),
|
|
235
|
-
...
|
|
240
|
+
...node(),
|
|
241
|
+
...sortKeys(),
|
|
242
|
+
...sortPackageJson(),
|
|
243
|
+
...sortTsconfig(),
|
|
236
244
|
...unicorn(),
|
|
237
245
|
|
|
238
246
|
...typescript(),
|
|
@@ -280,6 +288,7 @@ export default lincy(
|
|
|
280
288
|
{
|
|
281
289
|
isInEditor: true,
|
|
282
290
|
vue: true,
|
|
291
|
+
jsx: true,
|
|
283
292
|
typescript: true,
|
|
284
293
|
stylistic: true,
|
|
285
294
|
gitignore: true,
|
|
@@ -287,6 +296,7 @@ export default lincy(
|
|
|
287
296
|
jsonc: true,
|
|
288
297
|
yaml: true,
|
|
289
298
|
markdown: true,
|
|
299
|
+
sortKeys: true,
|
|
290
300
|
overrides: {}
|
|
291
301
|
},
|
|
292
302
|
{
|
|
@@ -377,6 +387,8 @@ import pluginReactHooks from 'eslint-plugin-react-hooks'
|
|
|
377
387
|
export default lincy(
|
|
378
388
|
{
|
|
379
389
|
vue: false,
|
|
390
|
+
// 关闭stylistic提供的jsx规则, 直接使用eslint-plugin-react
|
|
391
|
+
jsx: false,
|
|
380
392
|
},
|
|
381
393
|
// react 相关规则
|
|
382
394
|
{
|
package/dist/index.cjs
CHANGED
|
@@ -74,6 +74,7 @@ __export(src_exports, {
|
|
|
74
74
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
75
75
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
76
76
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
77
|
+
pluginSortKeys: () => import_eslint_plugin_sort_keys.default,
|
|
77
78
|
pluginStylistic: () => import_eslint_plugin.default,
|
|
78
79
|
pluginTs: () => import_eslint_plugin2.default,
|
|
79
80
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
@@ -81,6 +82,7 @@ __export(src_exports, {
|
|
|
81
82
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
82
83
|
pluginYaml: () => pluginYaml,
|
|
83
84
|
renameRules: () => renameRules,
|
|
85
|
+
sortKeys: () => sortKeys,
|
|
84
86
|
sortPackageJson: () => sortPackageJson,
|
|
85
87
|
sortTsconfig: () => sortTsconfig,
|
|
86
88
|
stylistic: () => stylistic,
|
|
@@ -113,6 +115,7 @@ var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-
|
|
|
113
115
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
114
116
|
var pluginYaml = __toESM(require("eslint-plugin-yml"), 1);
|
|
115
117
|
var import_eslint_plugin_no_only_tests = __toESM(require("eslint-plugin-no-only-tests"), 1);
|
|
118
|
+
var import_eslint_plugin_sort_keys = __toESM(require("eslint-plugin-sort-keys"), 1);
|
|
116
119
|
var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
|
|
117
120
|
var import_vue_eslint_parser = __toESM(require("vue-eslint-parser"), 1);
|
|
118
121
|
var import_yaml_eslint_parser = __toESM(require("yaml-eslint-parser"), 1);
|
|
@@ -990,17 +993,33 @@ function stylistic(options = {}) {
|
|
|
990
993
|
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
991
994
|
"style/yield-star-spacing": ["error", "both"],
|
|
992
995
|
...jsx ? {
|
|
993
|
-
"style/jsx-
|
|
994
|
-
"style/jsx-closing-
|
|
996
|
+
"style/jsx-closing-bracket-location": "error",
|
|
997
|
+
"style/jsx-closing-tag-location": "error",
|
|
998
|
+
"style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
|
|
995
999
|
"style/jsx-curly-newline": "error",
|
|
996
|
-
"style/jsx-curly-spacing": ["error", "never"
|
|
1000
|
+
"style/jsx-curly-spacing": ["error", "never"],
|
|
997
1001
|
"style/jsx-equals-spacing": "error",
|
|
998
1002
|
"style/jsx-first-prop-new-line": "error",
|
|
999
|
-
"style/jsx-indent": ["error", indent],
|
|
1003
|
+
"style/jsx-indent": ["error", indent, { checkAttributes: true, indentLogicalExpressions: true }],
|
|
1000
1004
|
"style/jsx-indent-props": ["error", indent],
|
|
1005
|
+
"style/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
1006
|
+
"style/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
|
|
1001
1007
|
"style/jsx-quotes": "error",
|
|
1002
|
-
"style/jsx-tag-spacing": "error",
|
|
1003
|
-
|
|
1008
|
+
"style/jsx-tag-spacing": ["error", {
|
|
1009
|
+
afterOpening: "never",
|
|
1010
|
+
beforeClosing: "never",
|
|
1011
|
+
beforeSelfClosing: "always",
|
|
1012
|
+
closingSlash: "never"
|
|
1013
|
+
}],
|
|
1014
|
+
"style/jsx-wrap-multilines": ["error", {
|
|
1015
|
+
arrow: "parens-new-line",
|
|
1016
|
+
assignment: "parens-new-line",
|
|
1017
|
+
condition: "parens-new-line",
|
|
1018
|
+
declaration: "parens-new-line",
|
|
1019
|
+
logical: "parens-new-line",
|
|
1020
|
+
prop: "parens-new-line",
|
|
1021
|
+
return: "parens-new-line"
|
|
1022
|
+
}]
|
|
1004
1023
|
} : {},
|
|
1005
1024
|
...overrides
|
|
1006
1025
|
}
|
|
@@ -1071,6 +1090,7 @@ function typescript(options) {
|
|
|
1071
1090
|
languageOptions: {
|
|
1072
1091
|
parser: parserTs,
|
|
1073
1092
|
parserOptions: {
|
|
1093
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1074
1094
|
sourceType: "module",
|
|
1075
1095
|
...tsconfigPath ? {
|
|
1076
1096
|
project: [tsconfigPath],
|
|
@@ -1290,14 +1310,10 @@ function vue(options = {}) {
|
|
|
1290
1310
|
"vue/no-useless-v-bind": "error",
|
|
1291
1311
|
"vue/no-v-html": "off",
|
|
1292
1312
|
"vue/no-v-text-v-html-on-component": "off",
|
|
1293
|
-
"vue/object-shorthand": [
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
avoidQuotes: true,
|
|
1298
|
-
ignoreConstructors: false
|
|
1299
|
-
}
|
|
1300
|
-
],
|
|
1313
|
+
"vue/object-shorthand": ["error", "always", {
|
|
1314
|
+
avoidQuotes: true,
|
|
1315
|
+
ignoreConstructors: false
|
|
1316
|
+
}],
|
|
1301
1317
|
"vue/prefer-separate-static-class": "error",
|
|
1302
1318
|
"vue/prefer-template": "error",
|
|
1303
1319
|
"vue/require-default-prop": "off",
|
|
@@ -1399,6 +1415,17 @@ function test(options = {}) {
|
|
|
1399
1415
|
];
|
|
1400
1416
|
}
|
|
1401
1417
|
|
|
1418
|
+
// src/configs/sort-keys.ts
|
|
1419
|
+
function sortKeys() {
|
|
1420
|
+
return [
|
|
1421
|
+
{
|
|
1422
|
+
plugins: {
|
|
1423
|
+
"sort-keys": import_eslint_plugin_sort_keys.default
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
];
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1402
1429
|
// src/factory.ts
|
|
1403
1430
|
var flatConfigProps = [
|
|
1404
1431
|
"files",
|
|
@@ -1422,6 +1449,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1422
1449
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
|
|
1423
1450
|
typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
|
|
1424
1451
|
gitignore: enableGitignore = true,
|
|
1452
|
+
sortKeys: enableSortKeys = false,
|
|
1425
1453
|
overrides = {},
|
|
1426
1454
|
componentExts = []
|
|
1427
1455
|
} = options;
|
|
@@ -1455,6 +1483,8 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1455
1483
|
}),
|
|
1456
1484
|
unicorn()
|
|
1457
1485
|
);
|
|
1486
|
+
if (enableSortKeys)
|
|
1487
|
+
configs.push(sortKeys());
|
|
1458
1488
|
if (enableVue)
|
|
1459
1489
|
componentExts.push("vue");
|
|
1460
1490
|
if (enableTypeScript) {
|
|
@@ -1566,6 +1596,7 @@ var src_default = lincy;
|
|
|
1566
1596
|
pluginMarkdown,
|
|
1567
1597
|
pluginNoOnlyTests,
|
|
1568
1598
|
pluginNode,
|
|
1599
|
+
pluginSortKeys,
|
|
1569
1600
|
pluginStylistic,
|
|
1570
1601
|
pluginTs,
|
|
1571
1602
|
pluginUnicorn,
|
|
@@ -1573,6 +1604,7 @@ var src_default = lincy;
|
|
|
1573
1604
|
pluginVue,
|
|
1574
1605
|
pluginYaml,
|
|
1575
1606
|
renameRules,
|
|
1607
|
+
sortKeys,
|
|
1576
1608
|
sortPackageJson,
|
|
1577
1609
|
sortTsconfig,
|
|
1578
1610
|
stylistic,
|
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as pluginVue } from 'eslint-plugin-vue';
|
|
|
21
21
|
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
22
22
|
export { eslintPluginYml as pluginYaml };
|
|
23
23
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
24
|
+
export { default as pluginSortKeys } from 'eslint-plugin-sort-keys';
|
|
24
25
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
25
26
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
26
27
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
@@ -105,7 +106,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
105
106
|
*
|
|
106
107
|
* @default auto-detect based on the dependencies
|
|
107
108
|
*/
|
|
108
|
-
typescript?: boolean | OptionsTypeScriptWithTypes;
|
|
109
|
+
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
|
|
109
110
|
/**
|
|
110
111
|
* Enable JSX related rules.
|
|
111
112
|
*
|
|
@@ -144,6 +145,12 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
144
145
|
* @default true
|
|
145
146
|
*/
|
|
146
147
|
markdown?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Enable SortKeys support.
|
|
150
|
+
*
|
|
151
|
+
* @default false
|
|
152
|
+
*/
|
|
153
|
+
sortKeys?: boolean;
|
|
147
154
|
/**
|
|
148
155
|
* Enable stylistic rules.
|
|
149
156
|
*
|
|
@@ -217,6 +224,13 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic): ConfigItem
|
|
|
217
224
|
|
|
218
225
|
declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
219
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Optional sort-keys plugin
|
|
229
|
+
*
|
|
230
|
+
* @see https://github.com/namnm/eslint-plugin-sort-keys
|
|
231
|
+
*/
|
|
232
|
+
declare function sortKeys(): ConfigItem[];
|
|
233
|
+
|
|
220
234
|
/**
|
|
221
235
|
* Combine array and non-array configs into a single array.
|
|
222
236
|
*/
|
|
@@ -247,4 +261,4 @@ declare const GLOB_TESTS: string[];
|
|
|
247
261
|
declare const GLOB_ALL_SRC: string[];
|
|
248
262
|
declare const GLOB_EXCLUDE: string[];
|
|
249
263
|
|
|
250
|
-
export { ConfigItem, 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, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
|
|
264
|
+
export { ConfigItem, 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, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortKeys, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as pluginVue } from 'eslint-plugin-vue';
|
|
|
21
21
|
import * as eslintPluginYml from 'eslint-plugin-yml';
|
|
22
22
|
export { eslintPluginYml as pluginYaml };
|
|
23
23
|
export { default as pluginNoOnlyTests } from 'eslint-plugin-no-only-tests';
|
|
24
|
+
export { default as pluginSortKeys } from 'eslint-plugin-sort-keys';
|
|
24
25
|
export { default as parserVue } from 'vue-eslint-parser';
|
|
25
26
|
export { default as parserYaml } from 'yaml-eslint-parser';
|
|
26
27
|
export { default as parserJsonc } from 'jsonc-eslint-parser';
|
|
@@ -105,7 +106,7 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
105
106
|
*
|
|
106
107
|
* @default auto-detect based on the dependencies
|
|
107
108
|
*/
|
|
108
|
-
typescript?: boolean | OptionsTypeScriptWithTypes;
|
|
109
|
+
typescript?: boolean | OptionsTypeScriptWithTypes | OptionsTypeScriptParserOptions;
|
|
109
110
|
/**
|
|
110
111
|
* Enable JSX related rules.
|
|
111
112
|
*
|
|
@@ -144,6 +145,12 @@ interface OptionsConfig extends OptionsComponentExts {
|
|
|
144
145
|
* @default true
|
|
145
146
|
*/
|
|
146
147
|
markdown?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Enable SortKeys support.
|
|
150
|
+
*
|
|
151
|
+
* @default false
|
|
152
|
+
*/
|
|
153
|
+
sortKeys?: boolean;
|
|
147
154
|
/**
|
|
148
155
|
* Enable stylistic rules.
|
|
149
156
|
*
|
|
@@ -217,6 +224,13 @@ declare function yaml(options?: OptionsOverrides & OptionsStylistic): ConfigItem
|
|
|
217
224
|
|
|
218
225
|
declare function test(options?: OptionsIsInEditor & OptionsOverrides): ConfigItem[];
|
|
219
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Optional sort-keys plugin
|
|
229
|
+
*
|
|
230
|
+
* @see https://github.com/namnm/eslint-plugin-sort-keys
|
|
231
|
+
*/
|
|
232
|
+
declare function sortKeys(): ConfigItem[];
|
|
233
|
+
|
|
220
234
|
/**
|
|
221
235
|
* Combine array and non-array configs into a single array.
|
|
222
236
|
*/
|
|
@@ -247,4 +261,4 @@ declare const GLOB_TESTS: string[];
|
|
|
247
261
|
declare const GLOB_ALL_SRC: string[];
|
|
248
262
|
declare const GLOB_EXCLUDE: string[];
|
|
249
263
|
|
|
250
|
-
export { ConfigItem, 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, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
|
|
264
|
+
export { ConfigItem, 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, OptionsIgnores, OptionsIsInEditor, OptionsOverrides, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, Rules, StylisticConfig, StylisticOverridesConfig, combine, comments, lincy as default, ignores, imports, javascript, jsdoc, jsonc, lincy, markdown, node, renameRules, sortKeys, sortPackageJson, sortTsconfig, stylistic, test, typescript, unicorn, vue, yaml };
|
package/dist/index.js
CHANGED
|
@@ -19,10 +19,11 @@ import { default as default10 } from "eslint-plugin-unused-imports";
|
|
|
19
19
|
import { default as default11 } from "eslint-plugin-vue";
|
|
20
20
|
import * as pluginYaml from "eslint-plugin-yml";
|
|
21
21
|
import { default as default12 } from "eslint-plugin-no-only-tests";
|
|
22
|
+
import { default as default13 } from "eslint-plugin-sort-keys";
|
|
22
23
|
import * as parserTs from "@typescript-eslint/parser";
|
|
23
|
-
import { default as
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
24
|
+
import { default as default14 } from "vue-eslint-parser";
|
|
25
|
+
import { default as default15 } from "yaml-eslint-parser";
|
|
26
|
+
import { default as default16 } from "jsonc-eslint-parser";
|
|
26
27
|
|
|
27
28
|
// src/configs/comments.ts
|
|
28
29
|
function comments() {
|
|
@@ -415,7 +416,7 @@ function jsonc(options = {}) {
|
|
|
415
416
|
{
|
|
416
417
|
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
417
418
|
languageOptions: {
|
|
418
|
-
parser:
|
|
419
|
+
parser: default16
|
|
419
420
|
},
|
|
420
421
|
rules: {
|
|
421
422
|
"jsonc/no-bigint-literals": "error",
|
|
@@ -896,17 +897,33 @@ function stylistic(options = {}) {
|
|
|
896
897
|
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
897
898
|
"style/yield-star-spacing": ["error", "both"],
|
|
898
899
|
...jsx ? {
|
|
899
|
-
"style/jsx-
|
|
900
|
-
"style/jsx-closing-
|
|
900
|
+
"style/jsx-closing-bracket-location": "error",
|
|
901
|
+
"style/jsx-closing-tag-location": "error",
|
|
902
|
+
"style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
|
|
901
903
|
"style/jsx-curly-newline": "error",
|
|
902
|
-
"style/jsx-curly-spacing": ["error", "never"
|
|
904
|
+
"style/jsx-curly-spacing": ["error", "never"],
|
|
903
905
|
"style/jsx-equals-spacing": "error",
|
|
904
906
|
"style/jsx-first-prop-new-line": "error",
|
|
905
|
-
"style/jsx-indent": ["error", indent],
|
|
907
|
+
"style/jsx-indent": ["error", indent, { checkAttributes: true, indentLogicalExpressions: true }],
|
|
906
908
|
"style/jsx-indent-props": ["error", indent],
|
|
909
|
+
"style/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
910
|
+
"style/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
|
|
907
911
|
"style/jsx-quotes": "error",
|
|
908
|
-
"style/jsx-tag-spacing": "error",
|
|
909
|
-
|
|
912
|
+
"style/jsx-tag-spacing": ["error", {
|
|
913
|
+
afterOpening: "never",
|
|
914
|
+
beforeClosing: "never",
|
|
915
|
+
beforeSelfClosing: "always",
|
|
916
|
+
closingSlash: "never"
|
|
917
|
+
}],
|
|
918
|
+
"style/jsx-wrap-multilines": ["error", {
|
|
919
|
+
arrow: "parens-new-line",
|
|
920
|
+
assignment: "parens-new-line",
|
|
921
|
+
condition: "parens-new-line",
|
|
922
|
+
declaration: "parens-new-line",
|
|
923
|
+
logical: "parens-new-line",
|
|
924
|
+
prop: "parens-new-line",
|
|
925
|
+
return: "parens-new-line"
|
|
926
|
+
}]
|
|
910
927
|
} : {},
|
|
911
928
|
...overrides
|
|
912
929
|
}
|
|
@@ -977,6 +994,7 @@ function typescript(options) {
|
|
|
977
994
|
languageOptions: {
|
|
978
995
|
parser: parserTs,
|
|
979
996
|
parserOptions: {
|
|
997
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
980
998
|
sourceType: "module",
|
|
981
999
|
...tsconfigPath ? {
|
|
982
1000
|
project: [tsconfigPath],
|
|
@@ -1121,7 +1139,7 @@ function vue(options = {}) {
|
|
|
1121
1139
|
{
|
|
1122
1140
|
files: [GLOB_VUE],
|
|
1123
1141
|
languageOptions: {
|
|
1124
|
-
parser:
|
|
1142
|
+
parser: default14,
|
|
1125
1143
|
parserOptions: {
|
|
1126
1144
|
ecmaFeatures: {
|
|
1127
1145
|
jsx: true
|
|
@@ -1196,14 +1214,10 @@ function vue(options = {}) {
|
|
|
1196
1214
|
"vue/no-useless-v-bind": "error",
|
|
1197
1215
|
"vue/no-v-html": "off",
|
|
1198
1216
|
"vue/no-v-text-v-html-on-component": "off",
|
|
1199
|
-
"vue/object-shorthand": [
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
avoidQuotes: true,
|
|
1204
|
-
ignoreConstructors: false
|
|
1205
|
-
}
|
|
1206
|
-
],
|
|
1217
|
+
"vue/object-shorthand": ["error", "always", {
|
|
1218
|
+
avoidQuotes: true,
|
|
1219
|
+
ignoreConstructors: false
|
|
1220
|
+
}],
|
|
1207
1221
|
"vue/prefer-separate-static-class": "error",
|
|
1208
1222
|
"vue/prefer-template": "error",
|
|
1209
1223
|
"vue/require-default-prop": "off",
|
|
@@ -1253,7 +1267,7 @@ function yaml(options = {}) {
|
|
|
1253
1267
|
{
|
|
1254
1268
|
files: [GLOB_YAML],
|
|
1255
1269
|
languageOptions: {
|
|
1256
|
-
parser:
|
|
1270
|
+
parser: default15
|
|
1257
1271
|
},
|
|
1258
1272
|
rules: {
|
|
1259
1273
|
"style/spaced-comment": "off",
|
|
@@ -1305,6 +1319,17 @@ function test(options = {}) {
|
|
|
1305
1319
|
];
|
|
1306
1320
|
}
|
|
1307
1321
|
|
|
1322
|
+
// src/configs/sort-keys.ts
|
|
1323
|
+
function sortKeys() {
|
|
1324
|
+
return [
|
|
1325
|
+
{
|
|
1326
|
+
plugins: {
|
|
1327
|
+
"sort-keys": default13
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
];
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1308
1333
|
// src/factory.ts
|
|
1309
1334
|
var flatConfigProps = [
|
|
1310
1335
|
"files",
|
|
@@ -1328,6 +1353,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1328
1353
|
vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
|
|
1329
1354
|
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1330
1355
|
gitignore: enableGitignore = true,
|
|
1356
|
+
sortKeys: enableSortKeys = false,
|
|
1331
1357
|
overrides = {},
|
|
1332
1358
|
componentExts = []
|
|
1333
1359
|
} = options;
|
|
@@ -1361,6 +1387,8 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1361
1387
|
}),
|
|
1362
1388
|
unicorn()
|
|
1363
1389
|
);
|
|
1390
|
+
if (enableSortKeys)
|
|
1391
|
+
configs.push(sortKeys());
|
|
1364
1392
|
if (enableVue)
|
|
1365
1393
|
componentExts.push("vue");
|
|
1366
1394
|
if (enableTypeScript) {
|
|
@@ -1460,10 +1488,10 @@ export {
|
|
|
1460
1488
|
lincy,
|
|
1461
1489
|
markdown,
|
|
1462
1490
|
node,
|
|
1463
|
-
|
|
1491
|
+
default16 as parserJsonc,
|
|
1464
1492
|
parserTs,
|
|
1465
|
-
|
|
1466
|
-
|
|
1493
|
+
default14 as parserVue,
|
|
1494
|
+
default15 as parserYaml,
|
|
1467
1495
|
default2 as pluginAntfu,
|
|
1468
1496
|
default3 as pluginComments,
|
|
1469
1497
|
pluginImport,
|
|
@@ -1472,6 +1500,7 @@ export {
|
|
|
1472
1500
|
default5 as pluginMarkdown,
|
|
1473
1501
|
default12 as pluginNoOnlyTests,
|
|
1474
1502
|
default6 as pluginNode,
|
|
1503
|
+
default13 as pluginSortKeys,
|
|
1475
1504
|
default7 as pluginStylistic,
|
|
1476
1505
|
default8 as pluginTs,
|
|
1477
1506
|
default9 as pluginUnicorn,
|
|
@@ -1479,6 +1508,7 @@ export {
|
|
|
1479
1508
|
default11 as pluginVue,
|
|
1480
1509
|
pluginYaml,
|
|
1481
1510
|
renameRules,
|
|
1511
|
+
sortKeys,
|
|
1482
1512
|
sortPackageJson,
|
|
1483
1513
|
sortTsconfig,
|
|
1484
1514
|
stylistic,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lincy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.5.
|
|
4
|
+
"version": "3.5.2",
|
|
5
5
|
"packageManager": "pnpm@8.7.6",
|
|
6
6
|
"description": "LinCenYing's ESLint config",
|
|
7
7
|
"author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",
|
|
@@ -39,26 +39,27 @@
|
|
|
39
39
|
"eslint": ">=8.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@antfu/eslint-define-config": "
|
|
43
|
-
"@stylistic/eslint-plugin": "0.
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
45
|
-
"@typescript-eslint/parser": "^6.
|
|
46
|
-
"eslint-config-flat-gitignore": "^0.1.
|
|
47
|
-
"eslint-plugin-antfu": "^1.0.
|
|
42
|
+
"@antfu/eslint-define-config": "1.23.0-2",
|
|
43
|
+
"@stylistic/eslint-plugin": "0.1.2",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
|
45
|
+
"@typescript-eslint/parser": "^6.9.0",
|
|
46
|
+
"eslint-config-flat-gitignore": "^0.1.1",
|
|
47
|
+
"eslint-plugin-antfu": "^1.0.1",
|
|
48
48
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
49
|
-
"eslint-plugin-i": "^2.
|
|
49
|
+
"eslint-plugin-i": "^2.29.0",
|
|
50
50
|
"eslint-plugin-jsdoc": "^46.8.2",
|
|
51
51
|
"eslint-plugin-jsonc": "^2.10.0",
|
|
52
52
|
"eslint-plugin-markdown": "^3.0.1",
|
|
53
|
-
"eslint-plugin-n": "^16.
|
|
53
|
+
"eslint-plugin-n": "^16.2.0",
|
|
54
54
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
55
|
-
"eslint-plugin-
|
|
55
|
+
"eslint-plugin-sort-keys": "^2.3.5",
|
|
56
|
+
"eslint-plugin-unicorn": "^49.0.0",
|
|
56
57
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
57
|
-
"eslint-plugin-vitest": "^0.3.
|
|
58
|
-
"eslint-plugin-vue": "^9.
|
|
58
|
+
"eslint-plugin-vitest": "^0.3.8",
|
|
59
|
+
"eslint-plugin-vue": "^9.18.1",
|
|
59
60
|
"eslint-plugin-yml": "^1.10.0",
|
|
60
61
|
"globals": "^13.23.0",
|
|
61
|
-
"jsonc-eslint-parser": "^2.
|
|
62
|
+
"jsonc-eslint-parser": "^2.4.0",
|
|
62
63
|
"local-pkg": "^0.5.0",
|
|
63
64
|
"vue-eslint-parser": "^9.3.2",
|
|
64
65
|
"yaml-eslint-parser": "^1.2.2"
|
|
@@ -66,15 +67,14 @@
|
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@antfu/ni": "^0.21.8",
|
|
68
69
|
"@lincy/eslint-config": "workspace:*",
|
|
69
|
-
"@stylistic/eslint-plugin-migrate": "^0.
|
|
70
|
-
"@types/eslint": "^8.44.
|
|
71
|
-
"@types/node": "^20.8.
|
|
70
|
+
"@stylistic/eslint-plugin-migrate": "^0.1.2",
|
|
71
|
+
"@types/eslint": "^8.44.6",
|
|
72
|
+
"@types/node": "^20.8.9",
|
|
72
73
|
"bumpp": "^9.2.0",
|
|
73
|
-
"eslint": "^8.
|
|
74
|
+
"eslint": "^8.52.0",
|
|
74
75
|
"eslint-flat-config-viewer": "^0.1.0",
|
|
75
|
-
"eslint-plugin-sort-keys": "^2.3.5",
|
|
76
76
|
"esno": "^0.17.0",
|
|
77
|
-
"lint-staged": "^
|
|
77
|
+
"lint-staged": "^15.0.2",
|
|
78
78
|
"rimraf": "^5.0.5",
|
|
79
79
|
"simple-git-hooks": "^2.9.0",
|
|
80
80
|
"simple-open-url": "^3.0.1",
|