@lincy/eslint-config 5.1.1 → 5.2.0

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
@@ -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", "internal-type"],
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
  ];
@@ -1801,7 +1817,8 @@ async function unicorn(options = {}) {
1801
1817
  "unicorn/prefer-string-starts-ends-with": "error",
1802
1818
  "unicorn/prefer-type-error": "error",
1803
1819
  "unicorn/throw-new-error": "error"
1804
- }
1820
+ },
1821
+ ...options.overrides
1805
1822
  }
1806
1823
  }
1807
1824
  ];
@@ -2156,19 +2173,30 @@ function lincy(options = {}, ...userConfigs) {
2156
2173
  isInEditor,
2157
2174
  overrides: overrides.javascript
2158
2175
  }),
2159
- comments(),
2160
- node(),
2176
+ comments({
2177
+ overrides: overrides.comments
2178
+ }),
2179
+ node({
2180
+ overrides: overrides.node
2181
+ }),
2161
2182
  jsdoc({
2183
+ overrides: overrides.jsdoc,
2162
2184
  stylistic: stylisticOptions
2163
2185
  }),
2164
2186
  imports({
2187
+ overrides: overrides.imports,
2165
2188
  stylistic: stylisticOptions
2166
2189
  }),
2167
2190
  // Optional plugins (installed but not enabled by default)
2168
- perfectionist()
2191
+ perfectionist({
2192
+ overrides: overrides.perfectionist
2193
+ })
2169
2194
  );
2170
2195
  if (enableUnicorn) {
2171
- configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2196
+ configs2.push(unicorn({
2197
+ ...enableUnicorn === true ? {} : enableUnicorn,
2198
+ overrides: overrides.unicorn
2199
+ }));
2172
2200
  }
2173
2201
  if (enableVue) {
2174
2202
  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", "internal-type"],
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
  ];
@@ -1696,7 +1712,8 @@ async function unicorn(options = {}) {
1696
1712
  "unicorn/prefer-string-starts-ends-with": "error",
1697
1713
  "unicorn/prefer-type-error": "error",
1698
1714
  "unicorn/throw-new-error": "error"
1699
- }
1715
+ },
1716
+ ...options.overrides
1700
1717
  }
1701
1718
  }
1702
1719
  ];
@@ -2051,19 +2068,30 @@ function lincy(options = {}, ...userConfigs) {
2051
2068
  isInEditor,
2052
2069
  overrides: overrides.javascript
2053
2070
  }),
2054
- comments(),
2055
- node(),
2071
+ comments({
2072
+ overrides: overrides.comments
2073
+ }),
2074
+ node({
2075
+ overrides: overrides.node
2076
+ }),
2056
2077
  jsdoc({
2078
+ overrides: overrides.jsdoc,
2057
2079
  stylistic: stylisticOptions
2058
2080
  }),
2059
2081
  imports({
2082
+ overrides: overrides.imports,
2060
2083
  stylistic: stylisticOptions
2061
2084
  }),
2062
2085
  // Optional plugins (installed but not enabled by default)
2063
- perfectionist()
2086
+ perfectionist({
2087
+ overrides: overrides.perfectionist
2088
+ })
2064
2089
  );
2065
2090
  if (enableUnicorn) {
2066
- configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2091
+ configs2.push(unicorn({
2092
+ ...enableUnicorn === true ? {} : enableUnicorn,
2093
+ overrides: overrides.unicorn
2094
+ }));
2067
2095
  }
2068
2096
  if (enableVue) {
2069
2097
  componentExts.push("vue");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lincy/eslint-config",
3
3
  "type": "module",
4
- "version": "5.1.1",
4
+ "version": "5.2.0",
5
5
  "packageManager": "pnpm@9.1.0",
6
6
  "description": "LinCenYing's ESLint config",
7
7
  "author": "LinCenYing <lincenying@gmail.com> (https://github.com/lincenying/)",