@ivanmaxlogiudice/eslint-config 1.0.16 → 1.0.18

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022-PRESENT Iván M. Lo Giudice<https://github.com/ivanmaxlogiudice>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2022-PRESENT Iván M. Lo Giudice<https://github.com/ivanmaxlogiudice>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -311,8 +311,8 @@ import config from '@ivanmaxlogiudice/eslint-config'
311
311
 
312
312
  export default config(
313
313
  {
314
- typescript: true,
315
- vue: true
314
+ vue: true,
315
+ typescript: true
316
316
  },
317
317
  {
318
318
  // Remember to specify the file glob here, otherwise it might cause the vue plugin to handle non-vue files
@@ -330,23 +330,28 @@ export default config(
330
330
  )
331
331
  ```
332
332
 
333
- We also provided a `overrides` options to make it easier:
333
+ We also provided a `overrides` options in each integration to make it easier:
334
334
 
335
335
  ```js
336
336
  // eslint.config.js
337
- import config from '@ivanmaxlogiudice/eslint-config'
337
+ import antfu from '@antfu/eslint-config'
338
338
 
339
- export default config({
340
- overrides: {
341
- typescript: {
339
+ export default antfu({
340
+ vue: {
341
+ overrides: {
342
+ 'vue/operator-linebreak': ['error', 'before'],
343
+ },
344
+ },
345
+ typescript: {
346
+ overrides: {
342
347
  'ts/consistent-type-definitions': ['error', 'interface'],
343
348
  },
344
- vue: {
345
- 'vue/operator-linebreak': ['error', 'before'],
349
+ },
350
+ yaml: {
351
+ overrides: {
352
+ // ...
346
353
  },
347
- yaml: {},
348
- // ...
349
- }
354
+ },
350
355
  })
351
356
  ```
352
357
 
@@ -425,7 +430,7 @@ pnpm add -D @unocss/eslint-plugin
425
430
 
426
431
  ### Optional Rules
427
432
 
428
- This config also provides some optional plugins/rules for extended usages.
433
+ This config also provides some optional plugins/rules for extended usage.
429
434
 
430
435
  #### `perfectionist` (sorting)
431
436
 
package/bin/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import '../dist/cli.js'
package/dist/cli.cjs CHANGED
@@ -35,12 +35,12 @@ var import_picocolors4 = __toESM(require("picocolors"), 1);
35
35
  var import_picocolors = __toESM(require("picocolors"), 1);
36
36
 
37
37
  // package.json
38
- var version = "1.0.16";
38
+ var version = "1.0.18";
39
39
  var devDependencies = {
40
40
  "@stylistic/eslint-plugin-migrate": "^1.5.1",
41
- "@types/eslint": "^8.44.9",
41
+ "@types/eslint": "^8.56.0",
42
42
  "@types/fs-extra": "^11.0.4",
43
- "@types/node": "^20.10.4",
43
+ "@types/node": "^20.10.5",
44
44
  "@types/prompts": "^2.4.9",
45
45
  "@unocss/eslint-plugin": "^0.58.0",
46
46
  bumpp: "^9.2.1",
@@ -54,8 +54,8 @@ var devDependencies = {
54
54
  "simple-git-hooks": "^2.9.0",
55
55
  tsup: "^8.0.1",
56
56
  typescript: "^5.3.3",
57
- vitest: "^1.0.4",
58
- vue: "^3.3.11"
57
+ vitest: "^1.1.0",
58
+ vue: "^3.3.13"
59
59
  };
60
60
 
61
61
  // src/cli/constants.ts
@@ -137,7 +137,6 @@ function isGitClean() {
137
137
 
138
138
  // src/cli/run.ts
139
139
  async function run(options = {}) {
140
- console.log(options);
141
140
  const SKIP_PROMPT = !!import_node_process2.default.env.SKIP_PROMPT || options.yes;
142
141
  const SKIP_GIT_CHECK = !!import_node_process2.default.env.SKIP_GIT_CHECK || options.ignoreGit;
143
142
  const cwd = import_node_process2.default.cwd();
package/dist/cli.js CHANGED
@@ -6,12 +6,12 @@ import c4 from "picocolors";
6
6
  import c from "picocolors";
7
7
 
8
8
  // package.json
9
- var version = "1.0.16";
9
+ var version = "1.0.18";
10
10
  var devDependencies = {
11
11
  "@stylistic/eslint-plugin-migrate": "^1.5.1",
12
- "@types/eslint": "^8.44.9",
12
+ "@types/eslint": "^8.56.0",
13
13
  "@types/fs-extra": "^11.0.4",
14
- "@types/node": "^20.10.4",
14
+ "@types/node": "^20.10.5",
15
15
  "@types/prompts": "^2.4.9",
16
16
  "@unocss/eslint-plugin": "^0.58.0",
17
17
  bumpp: "^9.2.1",
@@ -25,8 +25,8 @@ var devDependencies = {
25
25
  "simple-git-hooks": "^2.9.0",
26
26
  tsup: "^8.0.1",
27
27
  typescript: "^5.3.3",
28
- vitest: "^1.0.4",
29
- vue: "^3.3.11"
28
+ vitest: "^1.1.0",
29
+ vue: "^3.3.13"
30
30
  };
31
31
 
32
32
  // src/cli/constants.ts
@@ -78,18 +78,18 @@ var vscodeSettingsString = `
78
78
  `;
79
79
 
80
80
  // src/cli/run.ts
81
- import fs from "node:fs";
82
- import fsp from "node:fs/promises";
83
- import path from "node:path";
84
- import process2 from "node:process";
81
+ import fs from "fs";
82
+ import fsp from "fs/promises";
83
+ import path from "path";
84
+ import process2 from "process";
85
85
  import detectIndent from "detect-indent";
86
86
  import parse from "parse-gitignore";
87
87
  import c3 from "picocolors";
88
88
  import prompts from "prompts";
89
89
 
90
90
  // src/cli/utils.ts
91
- import { execSync } from "node:child_process";
92
- import process from "node:process";
91
+ import { execSync } from "child_process";
92
+ import process from "process";
93
93
  import c2 from "picocolors";
94
94
  function throwError(level, message) {
95
95
  console.error(`
@@ -108,7 +108,6 @@ function isGitClean() {
108
108
 
109
109
  // src/cli/run.ts
110
110
  async function run(options = {}) {
111
- console.log(options);
112
111
  const SKIP_PROMPT = !!process2.env.SKIP_PROMPT || options.yes;
113
112
  const SKIP_GIT_CHECK = !!process2.env.SKIP_GIT_CHECK || options.ignoreGit;
114
113
  const cwd = process2.cwd();
package/dist/index.cjs CHANGED
@@ -63,6 +63,7 @@ __export(src_exports, {
63
63
  default: () => src_default,
64
64
  ensurePackages: () => ensurePackages,
65
65
  formatters: () => formatters,
66
+ getOverrides: () => getOverrides,
66
67
  ignores: () => ignores,
67
68
  imports: () => imports,
68
69
  interopDefault: () => interopDefault,
@@ -74,6 +75,7 @@ __export(src_exports, {
74
75
  parserPlain: () => parserPlain,
75
76
  perfectionist: () => perfectionist,
76
77
  renameRules: () => renameRules,
78
+ resolveSubOptions: () => resolveSubOptions,
77
79
  sortPackageJson: () => sortPackageJson,
78
80
  sortTsconfig: () => sortTsconfig,
79
81
  stylistic: () => stylistic,
@@ -263,6 +265,7 @@ async function stylistic(options = {}) {
263
265
  const {
264
266
  indent,
265
267
  jsx,
268
+ overrides = {},
266
269
  quotes,
267
270
  semi
268
271
  } = {
@@ -298,7 +301,8 @@ async function stylistic(options = {}) {
298
301
  "style/quotes": ["error", quotes, {
299
302
  allowTemplateLiterals: true,
300
303
  avoidEscape: true
301
- }]
304
+ }],
305
+ ...overrides
302
306
  }
303
307
  }
304
308
  ];
@@ -433,6 +437,7 @@ async function formatters(options = {}, stylistic2 = {}) {
433
437
  [`format/${formater}`]: [
434
438
  "error",
435
439
  formater === "prettier" ? {
440
+ printWidth: 120,
436
441
  ...prettierOptions,
437
442
  embeddedLanguageFormatting: "off",
438
443
  parser: "markdown"
@@ -485,6 +490,7 @@ function imports(options = {}) {
485
490
  },
486
491
  rules: {
487
492
  "antfu/import-dedupe": "error",
493
+ "antfu/no-import-dist": "error",
488
494
  "antfu/no-import-node-modules-by-path": "error",
489
495
  "import/first": "error",
490
496
  "import/no-duplicates": "error",
@@ -499,6 +505,14 @@ function imports(options = {}) {
499
505
  }]
500
506
  } : {}
501
507
  }
508
+ },
509
+ {
510
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
511
+ name: "config:imports:bin",
512
+ rules: {
513
+ "antfu/no-import-dist": "off",
514
+ "antfu/no-import-node-modules-by-path": "off"
515
+ }
502
516
  }
503
517
  ];
504
518
  }
@@ -1044,7 +1058,7 @@ async function perfectionist(options = {}) {
1044
1058
  "unknown"
1045
1059
  ],
1046
1060
  "internal-pattern": ["{{@,~}/,#}**"],
1047
- "newlines-between": "never",
1061
+ "newlines-between": "ignore",
1048
1062
  "order": "asc",
1049
1063
  "type": "natural"
1050
1064
  }],
@@ -1328,6 +1342,7 @@ async function typescript(options = {}) {
1328
1342
  GLOB_SRC,
1329
1343
  ...componentExts.map((ext) => `**/*.${ext}`)
1330
1344
  ];
1345
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1331
1346
  const typeAwareRules = {
1332
1347
  "dot-notation": "off",
1333
1348
  "no-implied-eval": "off",
@@ -1428,9 +1443,19 @@ async function typescript(options = {}) {
1428
1443
  variables: true
1429
1444
  }],
1430
1445
  "ts/no-useless-constructor": "off",
1446
+ "ts/prefer-literal-enum-member": ["error", {
1447
+ allowBitwiseExpressions: true
1448
+ }],
1431
1449
  "ts/prefer-ts-expect-error": "error",
1432
1450
  "ts/triple-slash-reference": "off",
1433
1451
  "ts/unified-signatures": "off",
1452
+ ...overrides
1453
+ }
1454
+ },
1455
+ {
1456
+ files: filesTypeAware,
1457
+ name: "config:typescript:rules-type-aware",
1458
+ rules: {
1434
1459
  ...tsconfigPath ? typeAwareRules : {},
1435
1460
  ...overrides
1436
1461
  }
@@ -1515,7 +1540,8 @@ async function unicorn() {
1515
1540
  "unicorn/prefer-dom-node-text-content": "error",
1516
1541
  "unicorn/prefer-includes": "error",
1517
1542
  "unicorn/prefer-keyboard-event-key": "error",
1518
- "unicorn/prefer-math-trunc": "error",
1543
+ "unicorn/prefer-math-trunc": "off",
1544
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1863
1519
1545
  "unicorn/prefer-modern-dom-apis": "error",
1520
1546
  "unicorn/prefer-modern-math-apis": "error",
1521
1547
  "unicorn/prefer-negative-index": "error",
@@ -1815,8 +1841,7 @@ async function config(options = {}, ...userConfigs) {
1815
1841
  const {
1816
1842
  componentExts = [],
1817
1843
  gitignore: enableGitignore = true,
1818
- isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE) && !import_node_process3.default.env.CI),
1819
- overrides = {},
1844
+ isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
1820
1845
  typescript: enableTypeScript = (0, import_local_pkg2.isPackageExists)("typescript"),
1821
1846
  unocss: enableUnoCSS = UnocssPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i)),
1822
1847
  vue: enableVue = VuePackages.some((i) => (0, import_local_pkg2.isPackageExists)(i))
@@ -1839,13 +1864,10 @@ async function config(options = {}, ...userConfigs) {
1839
1864
  ignores(),
1840
1865
  javascript({
1841
1866
  isInEditor,
1842
- overrides: overrides.javascript
1867
+ overrides: getOverrides(options, "javascript")
1843
1868
  }),
1844
1869
  comments(),
1845
1870
  node(),
1846
- perfectionist({
1847
- overrides: overrides.perfectionist
1848
- }),
1849
1871
  jsdoc({
1850
1872
  stylistic: stylisticOptions
1851
1873
  }),
@@ -1858,28 +1880,31 @@ async function config(options = {}, ...userConfigs) {
1858
1880
  componentExts.push("vue");
1859
1881
  if (enableTypeScript) {
1860
1882
  configs.push(typescript({
1861
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
1862
- componentExts,
1863
- overrides: overrides.typescript
1883
+ ...resolveSubOptions(options, "typescript"),
1884
+ componentExts
1885
+ }));
1886
+ }
1887
+ if (stylisticOptions) {
1888
+ configs.push(stylistic({
1889
+ ...stylisticOptions,
1890
+ overrides: getOverrides(options, "stylistic")
1864
1891
  }));
1865
1892
  }
1866
- if (stylisticOptions)
1867
- configs.push(stylistic(stylisticOptions));
1868
1893
  if (enableUnoCSS) {
1869
- configs.push(unocss(
1870
- typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS
1871
- ));
1894
+ configs.push(unocss({
1895
+ ...resolveSubOptions(options, "unocss"),
1896
+ overrides: getOverrides(options, "unocss")
1897
+ }));
1872
1898
  }
1873
1899
  if (options.test ?? true) {
1874
1900
  configs.push(test({
1875
1901
  isInEditor,
1876
- overrides: overrides.test
1902
+ overrides: getOverrides(options, "test")
1877
1903
  }));
1878
1904
  }
1879
1905
  if (enableVue) {
1880
1906
  configs.push(vue({
1881
- ...typeof enableVue !== "boolean" ? enableVue : {},
1882
- overrides: overrides.vue,
1907
+ ...resolveSubOptions(options, "vue"),
1883
1908
  stylistic: stylisticOptions,
1884
1909
  typescript: !!enableTypeScript
1885
1910
  }));
@@ -1887,7 +1912,7 @@ async function config(options = {}, ...userConfigs) {
1887
1912
  if (options.jsonc ?? true) {
1888
1913
  configs.push(
1889
1914
  jsonc({
1890
- overrides: overrides.jsonc,
1915
+ overrides: getOverrides(options, "jsonc"),
1891
1916
  stylistic: stylisticOptions
1892
1917
  }),
1893
1918
  sortPackageJson(),
@@ -1896,14 +1921,14 @@ async function config(options = {}, ...userConfigs) {
1896
1921
  }
1897
1922
  if (options.yaml ?? true) {
1898
1923
  configs.push(yaml({
1899
- overrides: overrides.yaml,
1924
+ overrides: getOverrides(options, "yaml"),
1900
1925
  stylistic: stylisticOptions
1901
1926
  }));
1902
1927
  }
1903
1928
  if (options.markdown ?? true) {
1904
1929
  configs.push(markdown({
1905
1930
  componentExts,
1906
- overrides: overrides.markdown
1931
+ overrides: getOverrides(options, "markdown")
1907
1932
  }));
1908
1933
  }
1909
1934
  if (options.formatters) {
@@ -1912,6 +1937,11 @@ async function config(options = {}, ...userConfigs) {
1912
1937
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
1913
1938
  ));
1914
1939
  }
1940
+ if (options.perfectionist ?? true) {
1941
+ configs.push(perfectionist({
1942
+ overrides: getOverrides(options, "perfectionist")
1943
+ }));
1944
+ }
1915
1945
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1916
1946
  if (key in options)
1917
1947
  acc[key] = options[key];
@@ -1925,6 +1955,16 @@ async function config(options = {}, ...userConfigs) {
1925
1955
  );
1926
1956
  return merged;
1927
1957
  }
1958
+ function resolveSubOptions(options, key) {
1959
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1960
+ }
1961
+ function getOverrides(options, key) {
1962
+ const sub = resolveSubOptions(options, key);
1963
+ return {
1964
+ ...options.overrides?.[key],
1965
+ ..."overrides" in sub ? sub.overrides : {}
1966
+ };
1967
+ }
1928
1968
 
1929
1969
  // src/index.ts
1930
1970
  var src_default = config;
@@ -1962,6 +2002,7 @@ var src_default = config;
1962
2002
  config,
1963
2003
  ensurePackages,
1964
2004
  formatters,
2005
+ getOverrides,
1965
2006
  ignores,
1966
2007
  imports,
1967
2008
  interopDefault,
@@ -1973,6 +2014,7 @@ var src_default = config;
1973
2014
  parserPlain,
1974
2015
  perfectionist,
1975
2016
  renameRules,
2017
+ resolveSubOptions,
1976
2018
  sortPackageJson,
1977
2019
  sortTsconfig,
1978
2020
  stylistic,
package/dist/index.d.cts CHANGED
@@ -14,6 +14,11 @@ import { Options } from 'eslint-processor-vue-blocks';
14
14
  */
15
15
  type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
16
16
  interface VendoredPrettierOptionsRequired {
17
+ /**
18
+ * Specify the line length that the printer will wrap on.
19
+ * @default 120
20
+ */
21
+ printWidth: number;
17
22
  /**
18
23
  * Specify the number of spaces per indentation-level.
19
24
  */
@@ -131,7 +136,7 @@ interface OptionsFiles {
131
136
  */
132
137
  files?: string[];
133
138
  }
134
- interface OptionsVue {
139
+ interface OptionsVue extends OptionsOverrides {
135
140
  /**
136
141
  * Create virtual files for Vue SFC blocks to enable linting.
137
142
  *
@@ -140,6 +145,7 @@ interface OptionsVue {
140
145
  */
141
146
  sfcBlocks?: boolean | Options;
142
147
  }
148
+ type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides) | (OptionsTypeScriptParserOptions & OptionsOverrides);
143
149
  interface OptionsFormatters {
144
150
  /**
145
151
  * Enable formatting support for CSS, Less, Sass, and SCSS.
@@ -198,6 +204,11 @@ interface OptionsTypeScriptParserOptions {
198
204
  * Additional parser options for TypeScript.
199
205
  */
200
206
  parserOptions?: Partial<ParserOptions>;
207
+ /**
208
+ * Glob patterns for files that should be type aware.
209
+ * @default ['**\/*.{ts,tsx}']
210
+ */
211
+ filesTypeAware?: string[];
201
212
  }
202
213
  interface OptionsTypeScriptWithTypes {
203
214
  /**
@@ -220,7 +231,7 @@ interface OptionsOverrides {
220
231
  interface OptionsIsInEditor {
221
232
  isInEditor?: boolean;
222
233
  }
223
- interface OptionsUnoCSS {
234
+ interface OptionsUnoCSS extends OptionsOverrides {
224
235
  /**
225
236
  * Enable attributify support.
226
237
  * @default true
@@ -242,6 +253,10 @@ interface OptionsConfig extends OptionsComponentExts {
242
253
  * @default true
243
254
  */
244
255
  gitignore?: boolean | FlatGitignoreOptions;
256
+ /**
257
+ * Core rules. Can't be disabled.
258
+ */
259
+ javascript?: OptionsOverrides;
245
260
  /**
246
261
  * Enable TypeScript support.
247
262
  *
@@ -249,7 +264,7 @@ interface OptionsConfig extends OptionsComponentExts {
249
264
  *
250
265
  * @default auto-detect based on the dependencies
251
266
  */
252
- typescript?: boolean | OptionsTypeScriptParserOptions | OptionsTypeScriptWithTypes;
267
+ typescript?: boolean | OptionsTypescript;
253
268
  /**
254
269
  * Enable JSX related rules.
255
270
  *
@@ -263,7 +278,7 @@ interface OptionsConfig extends OptionsComponentExts {
263
278
  *
264
279
  * @default true
265
280
  */
266
- test?: boolean;
281
+ test?: boolean | OptionsTypescript;
267
282
  /**
268
283
  * Enable Vue support.
269
284
  *
@@ -275,13 +290,13 @@ interface OptionsConfig extends OptionsComponentExts {
275
290
  *
276
291
  * @default true
277
292
  */
278
- jsonc?: boolean;
293
+ jsonc?: boolean | OptionsTypescript;
279
294
  /**
280
295
  * Enable YAML support.
281
296
  *
282
297
  * @default true
283
298
  */
284
- yaml?: boolean;
299
+ yaml?: boolean | OptionsTypescript;
285
300
  /**
286
301
  * Enable linting for **code snippets** in Markdown.
287
302
  *
@@ -289,7 +304,7 @@ interface OptionsConfig extends OptionsComponentExts {
289
304
  *
290
305
  * @default true
291
306
  */
292
- markdown?: boolean;
307
+ markdown?: boolean | OptionsTypescript;
293
308
  /**
294
309
  * Enable stylistic rules.
295
310
  *
@@ -305,6 +320,12 @@ interface OptionsConfig extends OptionsComponentExts {
305
320
  * @default auto-detect based on the dependencies
306
321
  */
307
322
  unocss?: boolean | OptionsUnoCSS;
323
+ /**
324
+ * Enable perfectionist rules.
325
+ *
326
+ * @default true
327
+ */
328
+ perfectionist?: boolean | OptionsOverrides;
308
329
  /**
309
330
  * Use external formatters to format files.
310
331
  *
@@ -323,8 +344,11 @@ interface OptionsConfig extends OptionsComponentExts {
323
344
  isInEditor?: boolean;
324
345
  /**
325
346
  * Provide overrides for rules for each integration.
347
+ *
348
+ * @deprecated use `overrides` option in each integration key instead
326
349
  */
327
350
  overrides?: {
351
+ stylistic?: FlatConfigItem['rules'];
328
352
  javascript?: FlatConfigItem['rules'];
329
353
  typescript?: FlatConfigItem['rules'];
330
354
  test?: FlatConfigItem['rules'];
@@ -340,6 +364,9 @@ interface OptionsConfig extends OptionsComponentExts {
340
364
  * Construct an array of ESLint flat config items.
341
365
  */
342
366
  declare function config(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
367
+ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
368
+ declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
369
+ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): any;
343
370
 
344
371
  declare function comments(): Promise<FlatConfigItem[]>;
345
372
 
@@ -375,7 +402,7 @@ declare function sortPackageJson(): FlatConfigItem[];
375
402
  declare function sortTsconfig(): FlatConfigItem[];
376
403
 
377
404
  declare const StylisticConfigDefaults: StylisticConfig;
378
- declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
405
+ declare function stylistic(options?: StylisticConfig & OptionsOverrides): Promise<FlatConfigItem[]>;
379
406
 
380
407
  declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
381
408
 
@@ -454,4 +481,4 @@ declare const parserPlain: {
454
481
  };
455
482
  };
456
483
 
457
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
484
+ export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,11 @@ import { Options } from 'eslint-processor-vue-blocks';
14
14
  */
15
15
  type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
16
16
  interface VendoredPrettierOptionsRequired {
17
+ /**
18
+ * Specify the line length that the printer will wrap on.
19
+ * @default 120
20
+ */
21
+ printWidth: number;
17
22
  /**
18
23
  * Specify the number of spaces per indentation-level.
19
24
  */
@@ -131,7 +136,7 @@ interface OptionsFiles {
131
136
  */
132
137
  files?: string[];
133
138
  }
134
- interface OptionsVue {
139
+ interface OptionsVue extends OptionsOverrides {
135
140
  /**
136
141
  * Create virtual files for Vue SFC blocks to enable linting.
137
142
  *
@@ -140,6 +145,7 @@ interface OptionsVue {
140
145
  */
141
146
  sfcBlocks?: boolean | Options;
142
147
  }
148
+ type OptionsTypescript = (OptionsTypeScriptWithTypes & OptionsOverrides) | (OptionsTypeScriptParserOptions & OptionsOverrides);
143
149
  interface OptionsFormatters {
144
150
  /**
145
151
  * Enable formatting support for CSS, Less, Sass, and SCSS.
@@ -198,6 +204,11 @@ interface OptionsTypeScriptParserOptions {
198
204
  * Additional parser options for TypeScript.
199
205
  */
200
206
  parserOptions?: Partial<ParserOptions>;
207
+ /**
208
+ * Glob patterns for files that should be type aware.
209
+ * @default ['**\/*.{ts,tsx}']
210
+ */
211
+ filesTypeAware?: string[];
201
212
  }
202
213
  interface OptionsTypeScriptWithTypes {
203
214
  /**
@@ -220,7 +231,7 @@ interface OptionsOverrides {
220
231
  interface OptionsIsInEditor {
221
232
  isInEditor?: boolean;
222
233
  }
223
- interface OptionsUnoCSS {
234
+ interface OptionsUnoCSS extends OptionsOverrides {
224
235
  /**
225
236
  * Enable attributify support.
226
237
  * @default true
@@ -242,6 +253,10 @@ interface OptionsConfig extends OptionsComponentExts {
242
253
  * @default true
243
254
  */
244
255
  gitignore?: boolean | FlatGitignoreOptions;
256
+ /**
257
+ * Core rules. Can't be disabled.
258
+ */
259
+ javascript?: OptionsOverrides;
245
260
  /**
246
261
  * Enable TypeScript support.
247
262
  *
@@ -249,7 +264,7 @@ interface OptionsConfig extends OptionsComponentExts {
249
264
  *
250
265
  * @default auto-detect based on the dependencies
251
266
  */
252
- typescript?: boolean | OptionsTypeScriptParserOptions | OptionsTypeScriptWithTypes;
267
+ typescript?: boolean | OptionsTypescript;
253
268
  /**
254
269
  * Enable JSX related rules.
255
270
  *
@@ -263,7 +278,7 @@ interface OptionsConfig extends OptionsComponentExts {
263
278
  *
264
279
  * @default true
265
280
  */
266
- test?: boolean;
281
+ test?: boolean | OptionsTypescript;
267
282
  /**
268
283
  * Enable Vue support.
269
284
  *
@@ -275,13 +290,13 @@ interface OptionsConfig extends OptionsComponentExts {
275
290
  *
276
291
  * @default true
277
292
  */
278
- jsonc?: boolean;
293
+ jsonc?: boolean | OptionsTypescript;
279
294
  /**
280
295
  * Enable YAML support.
281
296
  *
282
297
  * @default true
283
298
  */
284
- yaml?: boolean;
299
+ yaml?: boolean | OptionsTypescript;
285
300
  /**
286
301
  * Enable linting for **code snippets** in Markdown.
287
302
  *
@@ -289,7 +304,7 @@ interface OptionsConfig extends OptionsComponentExts {
289
304
  *
290
305
  * @default true
291
306
  */
292
- markdown?: boolean;
307
+ markdown?: boolean | OptionsTypescript;
293
308
  /**
294
309
  * Enable stylistic rules.
295
310
  *
@@ -305,6 +320,12 @@ interface OptionsConfig extends OptionsComponentExts {
305
320
  * @default auto-detect based on the dependencies
306
321
  */
307
322
  unocss?: boolean | OptionsUnoCSS;
323
+ /**
324
+ * Enable perfectionist rules.
325
+ *
326
+ * @default true
327
+ */
328
+ perfectionist?: boolean | OptionsOverrides;
308
329
  /**
309
330
  * Use external formatters to format files.
310
331
  *
@@ -323,8 +344,11 @@ interface OptionsConfig extends OptionsComponentExts {
323
344
  isInEditor?: boolean;
324
345
  /**
325
346
  * Provide overrides for rules for each integration.
347
+ *
348
+ * @deprecated use `overrides` option in each integration key instead
326
349
  */
327
350
  overrides?: {
351
+ stylistic?: FlatConfigItem['rules'];
328
352
  javascript?: FlatConfigItem['rules'];
329
353
  typescript?: FlatConfigItem['rules'];
330
354
  test?: FlatConfigItem['rules'];
@@ -340,6 +364,9 @@ interface OptionsConfig extends OptionsComponentExts {
340
364
  * Construct an array of ESLint flat config items.
341
365
  */
342
366
  declare function config(options?: OptionsConfig & FlatConfigItem, ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]): Promise<UserConfigItem[]>;
367
+ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
368
+ declare function resolveSubOptions<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): ResolvedOptions<OptionsConfig[K]>;
369
+ declare function getOverrides<K extends keyof OptionsConfig>(options: OptionsConfig, key: K): any;
343
370
 
344
371
  declare function comments(): Promise<FlatConfigItem[]>;
345
372
 
@@ -375,7 +402,7 @@ declare function sortPackageJson(): FlatConfigItem[];
375
402
  declare function sortTsconfig(): FlatConfigItem[];
376
403
 
377
404
  declare const StylisticConfigDefaults: StylisticConfig;
378
- declare function stylistic(options?: StylisticConfig): Promise<FlatConfigItem[]>;
405
+ declare function stylistic(options?: StylisticConfig & OptionsOverrides): Promise<FlatConfigItem[]>;
379
406
 
380
407
  declare function test(options?: OptionsFiles & OptionsIsInEditor & OptionsOverrides): Promise<FlatConfigItem[]>;
381
408
 
@@ -454,4 +481,4 @@ declare const parserPlain: {
454
481
  };
455
482
  };
456
483
 
457
- export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsUnoCSS, type OptionsVue, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, renameRules, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
484
+ export { type Awaitable, type FlatConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NODE_MODULES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnoCSS, type OptionsVue, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type UserConfigItem, type WrapRuleConfig, combine, comments, config, config as default, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, test, toArray, typescript, unicorn, unocss, vue, yaml };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  // src/factory.ts
2
- import fs from "node:fs";
3
- import process3 from "node:process";
2
+ import fs from "fs";
3
+ import process3 from "process";
4
4
  import { isPackageExists as isPackageExists2 } from "local-pkg";
5
5
 
6
6
  // src/utils.ts
7
- import process from "node:process";
7
+ import process from "process";
8
8
  import { isPackageExists } from "local-pkg";
9
9
  import c from "picocolors";
10
10
  async function combine(...configs) {
@@ -174,6 +174,7 @@ async function stylistic(options = {}) {
174
174
  const {
175
175
  indent,
176
176
  jsx,
177
+ overrides = {},
177
178
  quotes,
178
179
  semi
179
180
  } = {
@@ -209,7 +210,8 @@ async function stylistic(options = {}) {
209
210
  "style/quotes": ["error", quotes, {
210
211
  allowTemplateLiterals: true,
211
212
  avoidEscape: true
212
- }]
213
+ }],
214
+ ...overrides
213
215
  }
214
216
  }
215
217
  ];
@@ -344,6 +346,7 @@ async function formatters(options = {}, stylistic2 = {}) {
344
346
  [`format/${formater}`]: [
345
347
  "error",
346
348
  formater === "prettier" ? {
349
+ printWidth: 120,
347
350
  ...prettierOptions,
348
351
  embeddedLanguageFormatting: "off",
349
352
  parser: "markdown"
@@ -396,6 +399,7 @@ function imports(options = {}) {
396
399
  },
397
400
  rules: {
398
401
  "antfu/import-dedupe": "error",
402
+ "antfu/no-import-dist": "error",
399
403
  "antfu/no-import-node-modules-by-path": "error",
400
404
  "import/first": "error",
401
405
  "import/no-duplicates": "error",
@@ -410,6 +414,14 @@ function imports(options = {}) {
410
414
  }]
411
415
  } : {}
412
416
  }
417
+ },
418
+ {
419
+ files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
420
+ name: "config:imports:bin",
421
+ rules: {
422
+ "antfu/no-import-dist": "off",
423
+ "antfu/no-import-node-modules-by-path": "off"
424
+ }
413
425
  }
414
426
  ];
415
427
  }
@@ -955,7 +967,7 @@ async function perfectionist(options = {}) {
955
967
  "unknown"
956
968
  ],
957
969
  "internal-pattern": ["{{@,~}/,#}**"],
958
- "newlines-between": "never",
970
+ "newlines-between": "ignore",
959
971
  "order": "asc",
960
972
  "type": "natural"
961
973
  }],
@@ -1228,7 +1240,7 @@ async function test(options = {}) {
1228
1240
  }
1229
1241
 
1230
1242
  // src/configs/typescript.ts
1231
- import process2 from "node:process";
1243
+ import process2 from "process";
1232
1244
  async function typescript(options = {}) {
1233
1245
  const {
1234
1246
  componentExts = [],
@@ -1239,6 +1251,7 @@ async function typescript(options = {}) {
1239
1251
  GLOB_SRC,
1240
1252
  ...componentExts.map((ext) => `**/*.${ext}`)
1241
1253
  ];
1254
+ const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1242
1255
  const typeAwareRules = {
1243
1256
  "dot-notation": "off",
1244
1257
  "no-implied-eval": "off",
@@ -1339,9 +1352,19 @@ async function typescript(options = {}) {
1339
1352
  variables: true
1340
1353
  }],
1341
1354
  "ts/no-useless-constructor": "off",
1355
+ "ts/prefer-literal-enum-member": ["error", {
1356
+ allowBitwiseExpressions: true
1357
+ }],
1342
1358
  "ts/prefer-ts-expect-error": "error",
1343
1359
  "ts/triple-slash-reference": "off",
1344
1360
  "ts/unified-signatures": "off",
1361
+ ...overrides
1362
+ }
1363
+ },
1364
+ {
1365
+ files: filesTypeAware,
1366
+ name: "config:typescript:rules-type-aware",
1367
+ rules: {
1345
1368
  ...tsconfigPath ? typeAwareRules : {},
1346
1369
  ...overrides
1347
1370
  }
@@ -1426,7 +1449,8 @@ async function unicorn() {
1426
1449
  "unicorn/prefer-dom-node-text-content": "error",
1427
1450
  "unicorn/prefer-includes": "error",
1428
1451
  "unicorn/prefer-keyboard-event-key": "error",
1429
- "unicorn/prefer-math-trunc": "error",
1452
+ "unicorn/prefer-math-trunc": "off",
1453
+ // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/1863
1430
1454
  "unicorn/prefer-modern-dom-apis": "error",
1431
1455
  "unicorn/prefer-modern-math-apis": "error",
1432
1456
  "unicorn/prefer-negative-index": "error",
@@ -1726,8 +1750,7 @@ async function config(options = {}, ...userConfigs) {
1726
1750
  const {
1727
1751
  componentExts = [],
1728
1752
  gitignore: enableGitignore = true,
1729
- isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
1730
- overrides = {},
1753
+ isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
1731
1754
  typescript: enableTypeScript = isPackageExists2("typescript"),
1732
1755
  unocss: enableUnoCSS = UnocssPackages.some((i) => isPackageExists2(i)),
1733
1756
  vue: enableVue = VuePackages.some((i) => isPackageExists2(i))
@@ -1750,13 +1773,10 @@ async function config(options = {}, ...userConfigs) {
1750
1773
  ignores(),
1751
1774
  javascript({
1752
1775
  isInEditor,
1753
- overrides: overrides.javascript
1776
+ overrides: getOverrides(options, "javascript")
1754
1777
  }),
1755
1778
  comments(),
1756
1779
  node(),
1757
- perfectionist({
1758
- overrides: overrides.perfectionist
1759
- }),
1760
1780
  jsdoc({
1761
1781
  stylistic: stylisticOptions
1762
1782
  }),
@@ -1769,28 +1789,31 @@ async function config(options = {}, ...userConfigs) {
1769
1789
  componentExts.push("vue");
1770
1790
  if (enableTypeScript) {
1771
1791
  configs.push(typescript({
1772
- ...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
1773
- componentExts,
1774
- overrides: overrides.typescript
1792
+ ...resolveSubOptions(options, "typescript"),
1793
+ componentExts
1794
+ }));
1795
+ }
1796
+ if (stylisticOptions) {
1797
+ configs.push(stylistic({
1798
+ ...stylisticOptions,
1799
+ overrides: getOverrides(options, "stylistic")
1775
1800
  }));
1776
1801
  }
1777
- if (stylisticOptions)
1778
- configs.push(stylistic(stylisticOptions));
1779
1802
  if (enableUnoCSS) {
1780
- configs.push(unocss(
1781
- typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS
1782
- ));
1803
+ configs.push(unocss({
1804
+ ...resolveSubOptions(options, "unocss"),
1805
+ overrides: getOverrides(options, "unocss")
1806
+ }));
1783
1807
  }
1784
1808
  if (options.test ?? true) {
1785
1809
  configs.push(test({
1786
1810
  isInEditor,
1787
- overrides: overrides.test
1811
+ overrides: getOverrides(options, "test")
1788
1812
  }));
1789
1813
  }
1790
1814
  if (enableVue) {
1791
1815
  configs.push(vue({
1792
- ...typeof enableVue !== "boolean" ? enableVue : {},
1793
- overrides: overrides.vue,
1816
+ ...resolveSubOptions(options, "vue"),
1794
1817
  stylistic: stylisticOptions,
1795
1818
  typescript: !!enableTypeScript
1796
1819
  }));
@@ -1798,7 +1821,7 @@ async function config(options = {}, ...userConfigs) {
1798
1821
  if (options.jsonc ?? true) {
1799
1822
  configs.push(
1800
1823
  jsonc({
1801
- overrides: overrides.jsonc,
1824
+ overrides: getOverrides(options, "jsonc"),
1802
1825
  stylistic: stylisticOptions
1803
1826
  }),
1804
1827
  sortPackageJson(),
@@ -1807,14 +1830,14 @@ async function config(options = {}, ...userConfigs) {
1807
1830
  }
1808
1831
  if (options.yaml ?? true) {
1809
1832
  configs.push(yaml({
1810
- overrides: overrides.yaml,
1833
+ overrides: getOverrides(options, "yaml"),
1811
1834
  stylistic: stylisticOptions
1812
1835
  }));
1813
1836
  }
1814
1837
  if (options.markdown ?? true) {
1815
1838
  configs.push(markdown({
1816
1839
  componentExts,
1817
- overrides: overrides.markdown
1840
+ overrides: getOverrides(options, "markdown")
1818
1841
  }));
1819
1842
  }
1820
1843
  if (options.formatters) {
@@ -1823,6 +1846,11 @@ async function config(options = {}, ...userConfigs) {
1823
1846
  typeof stylisticOptions === "boolean" ? {} : stylisticOptions
1824
1847
  ));
1825
1848
  }
1849
+ if (options.perfectionist ?? true) {
1850
+ configs.push(perfectionist({
1851
+ overrides: getOverrides(options, "perfectionist")
1852
+ }));
1853
+ }
1826
1854
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1827
1855
  if (key in options)
1828
1856
  acc[key] = options[key];
@@ -1836,6 +1864,16 @@ async function config(options = {}, ...userConfigs) {
1836
1864
  );
1837
1865
  return merged;
1838
1866
  }
1867
+ function resolveSubOptions(options, key) {
1868
+ return typeof options[key] === "boolean" ? {} : options[key] || {};
1869
+ }
1870
+ function getOverrides(options, key) {
1871
+ const sub = resolveSubOptions(options, key);
1872
+ return {
1873
+ ...options.overrides?.[key],
1874
+ ..."overrides" in sub ? sub.overrides : {}
1875
+ };
1876
+ }
1839
1877
 
1840
1878
  // src/index.ts
1841
1879
  var src_default = config;
@@ -1873,6 +1911,7 @@ export {
1873
1911
  src_default as default,
1874
1912
  ensurePackages,
1875
1913
  formatters,
1914
+ getOverrides,
1876
1915
  ignores,
1877
1916
  imports,
1878
1917
  interopDefault,
@@ -1884,6 +1923,7 @@ export {
1884
1923
  parserPlain,
1885
1924
  perfectionist,
1886
1925
  renameRules,
1926
+ resolveSubOptions,
1887
1927
  sortPackageJson,
1888
1928
  sortTsconfig,
1889
1929
  stylistic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ivanmaxlogiudice/eslint-config",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "packageManager": "pnpm@8.12.1",
5
5
  "description": "Personal ESLint config",
6
6
  "type": "module",
@@ -35,7 +35,7 @@
35
35
  "peerDependencies": {
36
36
  "@unocss/eslint-plugin": ">=0.57.0",
37
37
  "eslint": ">=8.40.0",
38
- "eslint-plugin-format": "^0.0.1"
38
+ "eslint-plugin-format": ">=0.1.0"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "@unocss/eslint-plugin": {
@@ -52,25 +52,25 @@
52
52
  "@eslint-types/typescript-eslint": "^6.12.0",
53
53
  "@eslint-types/unicorn": "^49.0.0",
54
54
  "@stylistic/eslint-plugin": "^1.5.1",
55
- "@typescript-eslint/eslint-plugin": "^6.14.0",
56
- "@typescript-eslint/parser": "^6.14.0",
55
+ "@typescript-eslint/eslint-plugin": "^6.16.0",
56
+ "@typescript-eslint/parser": "^6.16.0",
57
57
  "cac": "^6.7.14",
58
58
  "detect-indent": "^7.0.1",
59
59
  "eslint-config-flat-gitignore": "^0.1.2",
60
60
  "eslint-merge-processors": "^0.1.0",
61
- "eslint-plugin-antfu": "^2.0.0",
61
+ "eslint-plugin-antfu": "^2.1.1",
62
62
  "eslint-plugin-eslint-comments": "^3.2.0",
63
- "eslint-plugin-i": "^2.29.0",
63
+ "eslint-plugin-i": "^2.29.1",
64
64
  "eslint-plugin-jsdoc": "^46.9.1",
65
- "eslint-plugin-jsonc": "^2.11.1",
65
+ "eslint-plugin-jsonc": "^2.11.2",
66
66
  "eslint-plugin-markdown": "^3.0.1",
67
- "eslint-plugin-n": "^16.4.0",
67
+ "eslint-plugin-n": "^16.5.0",
68
68
  "eslint-plugin-no-only-tests": "^3.1.0",
69
69
  "eslint-plugin-perfectionist": "^2.5.0",
70
70
  "eslint-plugin-promise": "^6.1.1",
71
- "eslint-plugin-unicorn": "^49.0.0",
71
+ "eslint-plugin-unicorn": "^50.0.1",
72
72
  "eslint-plugin-unused-imports": "^3.0.0",
73
- "eslint-plugin-vitest": "^0.3.17",
73
+ "eslint-plugin-vitest": "^0.3.20",
74
74
  "eslint-plugin-vue": "^9.19.2",
75
75
  "eslint-plugin-yml": "^1.11.0",
76
76
  "eslint-processor-vue-blocks": "^0.1.1",
@@ -85,9 +85,9 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@stylistic/eslint-plugin-migrate": "^1.5.1",
88
- "@types/eslint": "^8.44.9",
88
+ "@types/eslint": "^8.56.0",
89
89
  "@types/fs-extra": "^11.0.4",
90
- "@types/node": "^20.10.4",
90
+ "@types/node": "^20.10.5",
91
91
  "@types/prompts": "^2.4.9",
92
92
  "@unocss/eslint-plugin": "^0.58.0",
93
93
  "bumpp": "^9.2.1",
@@ -101,8 +101,8 @@
101
101
  "simple-git-hooks": "^2.9.0",
102
102
  "tsup": "^8.0.1",
103
103
  "typescript": "^5.3.3",
104
- "vitest": "^1.0.4",
105
- "vue": "^3.3.11"
104
+ "vitest": "^1.1.0",
105
+ "vue": "^3.3.13"
106
106
  },
107
107
  "engines": {
108
108
  "node": ">=18.12.0"