@lincy/eslint-config 3.5.1 → 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 CHANGED
@@ -148,6 +148,8 @@ export default lincy({
148
148
  test: false, // 默认值: true, 可选: false
149
149
  // 是否启用 markdown 规则
150
150
  markdown: false, // 默认值: true, 可选: false
151
+ // 是否启用 eslint-plugin-sort-keys 规则
152
+ sortKeys: true, // 默认值: false, 可选: true
151
153
  // 覆盖规则
152
154
  overrides: {},
153
155
 
@@ -219,6 +221,7 @@ import {
219
221
  jsonc,
220
222
  markdown,
221
223
  node,
224
+ sortKeys,
222
225
  sortPackageJson,
223
226
  sortTsconfig,
224
227
  stylistic,
@@ -229,12 +232,15 @@ import {
229
232
  } from '@lincy/eslint-config'
230
233
 
231
234
  export default [
235
+ ...comments(),
232
236
  ...ignores(),
237
+ ...imports(),
233
238
  ...javascript(),
234
- ...comments(),
235
- ...node(),
236
239
  ...jsdoc(),
237
- ...imports(),
240
+ ...node(),
241
+ ...sortKeys(),
242
+ ...sortPackageJson(),
243
+ ...sortTsconfig(),
238
244
  ...unicorn(),
239
245
 
240
246
  ...typescript(),
@@ -290,6 +296,7 @@ export default lincy(
290
296
  jsonc: true,
291
297
  yaml: true,
292
298
  markdown: true,
299
+ sortKeys: true,
293
300
  overrides: {}
294
301
  },
295
302
  {
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);
@@ -1087,6 +1090,7 @@ function typescript(options) {
1087
1090
  languageOptions: {
1088
1091
  parser: parserTs,
1089
1092
  parserOptions: {
1093
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
1090
1094
  sourceType: "module",
1091
1095
  ...tsconfigPath ? {
1092
1096
  project: [tsconfigPath],
@@ -1411,6 +1415,17 @@ function test(options = {}) {
1411
1415
  ];
1412
1416
  }
1413
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
+
1414
1429
  // src/factory.ts
1415
1430
  var flatConfigProps = [
1416
1431
  "files",
@@ -1434,6 +1449,7 @@ function lincy(options = {}, ...userConfigs) {
1434
1449
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
1435
1450
  typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
1436
1451
  gitignore: enableGitignore = true,
1452
+ sortKeys: enableSortKeys = false,
1437
1453
  overrides = {},
1438
1454
  componentExts = []
1439
1455
  } = options;
@@ -1467,6 +1483,8 @@ function lincy(options = {}, ...userConfigs) {
1467
1483
  }),
1468
1484
  unicorn()
1469
1485
  );
1486
+ if (enableSortKeys)
1487
+ configs.push(sortKeys());
1470
1488
  if (enableVue)
1471
1489
  componentExts.push("vue");
1472
1490
  if (enableTypeScript) {
@@ -1578,6 +1596,7 @@ var src_default = lincy;
1578
1596
  pluginMarkdown,
1579
1597
  pluginNoOnlyTests,
1580
1598
  pluginNode,
1599
+ pluginSortKeys,
1581
1600
  pluginStylistic,
1582
1601
  pluginTs,
1583
1602
  pluginUnicorn,
@@ -1585,6 +1604,7 @@ var src_default = lincy;
1585
1604
  pluginVue,
1586
1605
  pluginYaml,
1587
1606
  renameRules,
1607
+ sortKeys,
1588
1608
  sortPackageJson,
1589
1609
  sortTsconfig,
1590
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 default13 } from "vue-eslint-parser";
24
- import { default as default14 } from "yaml-eslint-parser";
25
- import { default as default15 } from "jsonc-eslint-parser";
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: default15
419
+ parser: default16
419
420
  },
420
421
  rules: {
421
422
  "jsonc/no-bigint-literals": "error",
@@ -993,6 +994,7 @@ function typescript(options) {
993
994
  languageOptions: {
994
995
  parser: parserTs,
995
996
  parserOptions: {
997
+ extraFileExtensions: componentExts.map((ext) => `.${ext}`),
996
998
  sourceType: "module",
997
999
  ...tsconfigPath ? {
998
1000
  project: [tsconfigPath],
@@ -1137,7 +1139,7 @@ function vue(options = {}) {
1137
1139
  {
1138
1140
  files: [GLOB_VUE],
1139
1141
  languageOptions: {
1140
- parser: default13,
1142
+ parser: default14,
1141
1143
  parserOptions: {
1142
1144
  ecmaFeatures: {
1143
1145
  jsx: true
@@ -1265,7 +1267,7 @@ function yaml(options = {}) {
1265
1267
  {
1266
1268
  files: [GLOB_YAML],
1267
1269
  languageOptions: {
1268
- parser: default14
1270
+ parser: default15
1269
1271
  },
1270
1272
  rules: {
1271
1273
  "style/spaced-comment": "off",
@@ -1317,6 +1319,17 @@ function test(options = {}) {
1317
1319
  ];
1318
1320
  }
1319
1321
 
1322
+ // src/configs/sort-keys.ts
1323
+ function sortKeys() {
1324
+ return [
1325
+ {
1326
+ plugins: {
1327
+ "sort-keys": default13
1328
+ }
1329
+ }
1330
+ ];
1331
+ }
1332
+
1320
1333
  // src/factory.ts
1321
1334
  var flatConfigProps = [
1322
1335
  "files",
@@ -1340,6 +1353,7 @@ function lincy(options = {}, ...userConfigs) {
1340
1353
  vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
1341
1354
  typescript: enableTypeScript = isPackageExists("typescript"),
1342
1355
  gitignore: enableGitignore = true,
1356
+ sortKeys: enableSortKeys = false,
1343
1357
  overrides = {},
1344
1358
  componentExts = []
1345
1359
  } = options;
@@ -1373,6 +1387,8 @@ function lincy(options = {}, ...userConfigs) {
1373
1387
  }),
1374
1388
  unicorn()
1375
1389
  );
1390
+ if (enableSortKeys)
1391
+ configs.push(sortKeys());
1376
1392
  if (enableVue)
1377
1393
  componentExts.push("vue");
1378
1394
  if (enableTypeScript) {
@@ -1472,10 +1488,10 @@ export {
1472
1488
  lincy,
1473
1489
  markdown,
1474
1490
  node,
1475
- default15 as parserJsonc,
1491
+ default16 as parserJsonc,
1476
1492
  parserTs,
1477
- default13 as parserVue,
1478
- default14 as parserYaml,
1493
+ default14 as parserVue,
1494
+ default15 as parserYaml,
1479
1495
  default2 as pluginAntfu,
1480
1496
  default3 as pluginComments,
1481
1497
  pluginImport,
@@ -1484,6 +1500,7 @@ export {
1484
1500
  default5 as pluginMarkdown,
1485
1501
  default12 as pluginNoOnlyTests,
1486
1502
  default6 as pluginNode,
1503
+ default13 as pluginSortKeys,
1487
1504
  default7 as pluginStylistic,
1488
1505
  default8 as pluginTs,
1489
1506
  default9 as pluginUnicorn,
@@ -1491,6 +1508,7 @@ export {
1491
1508
  default11 as pluginVue,
1492
1509
  pluginYaml,
1493
1510
  renameRules,
1511
+ sortKeys,
1494
1512
  sortPackageJson,
1495
1513
  sortTsconfig,
1496
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.1",
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": "^1.23.0-1",
43
- "@stylistic/eslint-plugin": "0.0.8",
44
- "@typescript-eslint/eslint-plugin": "^6.7.5",
45
- "@typescript-eslint/parser": "^6.7.5",
46
- "eslint-config-flat-gitignore": "^0.1.0",
47
- "eslint-plugin-antfu": "^1.0.0-beta.12",
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.28.1",
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
53
  "eslint-plugin-n": "^16.2.0",
54
54
  "eslint-plugin-no-only-tests": "^3.1.0",
55
- "eslint-plugin-unicorn": "^48.0.1",
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.2",
58
- "eslint-plugin-vue": "^9.17.0",
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.3.0",
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.0.8",
70
- "@types/eslint": "^8.44.4",
71
- "@types/node": "^20.8.4",
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.51.0",
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": "^14.0.1",
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",