@luxass/eslint-config 4.2.9 → 4.2.11

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
@@ -29,28 +29,28 @@ With [`"type": "module"`](https://nodejs.org/api/packages.html#type) in `package
29
29
 
30
30
  ```js
31
31
  // eslint.config.js
32
- import luxass from "@luxass/eslint-config";
32
+ import { luxass } from '@luxass/eslint-config'
33
33
 
34
- export default luxass();
34
+ export default luxass()
35
35
  ```
36
36
 
37
37
  With CJS:
38
38
 
39
39
  ```js
40
40
  // eslint.config.js
41
- const luxass = require("@luxass/eslint-config").default;
41
+ const { luxass } = require('@luxass/eslint-config')
42
42
 
43
- module.exports = luxass();
43
+ module.exports = luxass()
44
44
  ```
45
45
 
46
46
  Combined with legacy config:
47
47
 
48
48
  ```js
49
49
  // eslint.config.js
50
- const luxass = require("@luxass/eslint-config").default;
51
- const { FlatCompat } = require("@eslint/eslintrc");
50
+ const { luxass } = require('@luxass/eslint-config')
51
+ const { FlatCompat } = require('@eslint/eslintrc')
52
52
 
53
- const compat = new FlatCompat();
53
+ const compat = new FlatCompat()
54
54
 
55
55
  module.exports = luxass(
56
56
  {
@@ -60,13 +60,13 @@ module.exports = luxass(
60
60
  // Legacy config
61
61
  ...compat.config({
62
62
  extends: [
63
- "eslint:recommended",
63
+ 'eslint:recommended',
64
64
  // Other extends...
65
65
  ],
66
66
  })
67
67
 
68
68
  // Other flat configs...
69
- );
69
+ )
70
70
  ```
71
71
 
72
72
  > Note that `.eslintignore` no longer works in Flat config, see [customization](#customization) for more details.
@@ -129,16 +129,16 @@ Normally you would only need to import the `luxass` preset:
129
129
 
130
130
  ```js
131
131
  // eslint.config.js
132
- import luxass from "@luxass/eslint-config";
132
+ import { luxass } from '@luxass/eslint-config'
133
133
 
134
- export default luxass();
134
+ export default luxass()
135
135
  ```
136
136
 
137
137
  you can also configure each `config` individually:
138
138
 
139
139
  ```js
140
140
  // eslint.config.js
141
- import luxass from "@luxass/eslint-config";
141
+ import { luxass } from '@luxass/eslint-config'
142
142
 
143
143
  export default luxass({
144
144
  stylistic: true,
@@ -150,16 +150,16 @@ export default luxass({
150
150
 
151
151
  // `.eslintignore` is no longer supported in Flat config, use `ignores` instead.
152
152
  ignores: [
153
- "**/fixtures"
153
+ '**/fixtures'
154
154
  ]
155
- });
155
+ })
156
156
  ```
157
157
 
158
158
  The `luxass` function accepts an arbitrary number of `flat configs` overrides:
159
159
 
160
160
  ```js
161
161
  // eslint.config.js
162
- import luxass from "@luxass/eslint-config";
162
+ import { luxass } from '@luxass/eslint-config'
163
163
 
164
164
  export default luxass({
165
165
  // configuration points for my config
@@ -167,7 +167,7 @@ export default luxass({
167
167
  rules: {}
168
168
  }, {
169
169
  rules: {}
170
- });
170
+ })
171
171
  ```
172
172
 
173
173
  <details>
@@ -194,7 +194,7 @@ import {
194
194
  unicorn,
195
195
  vue,
196
196
  yaml
197
- } from "@luxass/eslint-config";
197
+ } from '@luxass/eslint-config'
198
198
 
199
199
  export default combine(
200
200
  ignores(),
@@ -210,7 +210,7 @@ export default combine(
210
210
  jsonc(),
211
211
  yaml(),
212
212
  markdown(),
213
- );
213
+ )
214
214
  ```
215
215
 
216
216
  </details>
@@ -246,44 +246,44 @@ Certain rules would only be enabled in specific files, for example, `ts/*` rules
246
246
 
247
247
  ```js
248
248
  // eslint.config.js
249
- import luxass from "@luxass/eslint-config";
249
+ import { luxass } from '@luxass/eslint-config'
250
250
 
251
251
  export default luxass(
252
252
  { vue: true, typescript: true },
253
253
  {
254
254
  // Remember to specify the file glob here, otherwise it might cause the vue plugin to handle non-vue files
255
- files: ["**/*.vue"],
255
+ files: ['**/*.vue'],
256
256
  rules: {
257
- "vue/operator-linebreak": ["error", "before"],
257
+ 'vue/operator-linebreak': ['error', 'before'],
258
258
  },
259
259
  },
260
260
  {
261
261
  // Without `files`, they are general rules for all files
262
262
  rules: {
263
- "style/semi": ["error", "never"],
263
+ 'style/semi': ['error', 'never'],
264
264
  },
265
265
  }
266
- );
266
+ )
267
267
  ```
268
268
 
269
269
  We also provided a `overrides` options to make it easier:
270
270
 
271
271
  ```js
272
272
  // eslint.config.js
273
- import luxass from "@luxass/eslint-config";
273
+ import { luxass } from '@luxass/eslint-config'
274
274
 
275
275
  export default luxass({
276
276
  overrides: {
277
277
  vue: {
278
- "vue/operator-linebreak": ["error", "before"],
278
+ 'vue/operator-linebreak': ['error', 'before'],
279
279
  },
280
280
  typescript: {
281
- "ts/consistent-type-definitions": ["error", "interface"],
281
+ 'ts/consistent-type-definitions': ['error', 'interface'],
282
282
  },
283
283
  yaml: {},
284
284
  // ...
285
285
  }
286
- });
286
+ })
287
287
  ```
288
288
 
289
289
  ### Optional Configs
@@ -299,7 +299,7 @@ Use external formatters to format files that ESLint cannot handle yet (`.css`, `
299
299
 
300
300
  ```js
301
301
  // eslint.config.js
302
- import luxass from "@luxass/eslint-config";
302
+ import { luxass } from '@luxass/eslint-config'
303
303
 
304
304
  export default luxass({
305
305
  formatters: {
@@ -317,15 +317,15 @@ export default luxass({
317
317
  * Format TOML files
318
318
  * Currently only supports dprint
319
319
  */
320
- toml: "dprint",
320
+ toml: 'dprint',
321
321
  /**
322
322
  * Format Markdown files
323
323
  * Supports Prettier and dprint
324
324
  * By default uses Prettier
325
325
  */
326
- markdown: "prettier"
326
+ markdown: 'prettier'
327
327
  }
328
- });
328
+ })
329
329
  ```
330
330
 
331
331
  Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
@@ -340,11 +340,11 @@ To enable React support, need to explicitly turn it on:
340
340
 
341
341
  ```js
342
342
  // eslint.config.js
343
- import luxass from "@luxass/eslint-config";
343
+ import { luxass } from '@luxass/eslint-config'
344
344
 
345
345
  export default luxass({
346
346
  react: true,
347
- });
347
+ })
348
348
  ```
349
349
 
350
350
  Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
@@ -361,11 +361,11 @@ Next.JS also enables React support.
361
361
 
362
362
  ```js
363
363
  // eslint.config.js
364
- import luxass from "@luxass/eslint-config";
364
+ import { luxass } from '@luxass/eslint-config'
365
365
 
366
366
  export default luxass({
367
367
  nextjs: true,
368
- });
368
+ })
369
369
  ```
370
370
 
371
371
  Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
@@ -380,11 +380,11 @@ To enable UnoCSS support, need to explicitly turn it on:
380
380
 
381
381
  ```js
382
382
  // eslint.config.js
383
- import luxass from "@luxass/eslint-config";
383
+ import { luxass } from '@luxass/eslint-config'
384
384
 
385
385
  export default luxass({
386
386
  unocss: true,
387
- });
387
+ })
388
388
  ```
389
389
 
390
390
  Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
@@ -399,11 +399,11 @@ To enable TailwindCSS support, need to explicitly turn it on:
399
399
 
400
400
  ```js
401
401
  // eslint.config.js
402
- import luxass from "@luxass/eslint-config";
402
+ import { luxass } from '@luxass/eslint-config'
403
403
 
404
404
  export default luxass({
405
405
  tailwindcss: true,
406
- });
406
+ })
407
407
  ```
408
408
 
409
409
  Running `npx eslint` should prompt you to install the required dependencies, otherwise, you can install them manually:
@@ -422,13 +422,13 @@ You can optionally enable the [type aware rules](https://typescript-eslint.io/li
422
422
 
423
423
  ```js
424
424
  // eslint.config.js
425
- import luxass from "@luxass/eslint-config";
425
+ import { luxass } from '@luxass/eslint-config'
426
426
 
427
427
  export default luxass({
428
428
  typescript: {
429
- tsconfigPath: "tsconfig.json",
429
+ tsconfigPath: 'tsconfig.json',
430
430
  },
431
- });
431
+ })
432
432
  ```
433
433
 
434
434
  ## Versioning Policy
package/dist/index.cjs CHANGED
@@ -105,8 +105,6 @@ async function comments() {
105
105
  "eslint-comments": import_eslint_plugin_eslint_comments.default
106
106
  },
107
107
  rules: {
108
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/disable-enable-pair.md
109
- "eslint-comments/disable-enable-pair": "error",
110
108
  // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-aggregating-enable.md
111
109
  "eslint-comments/no-aggregating-enable": "error",
112
110
  // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-duplicate-disable.md
@@ -525,7 +523,7 @@ async function imports(options = {}) {
525
523
  "import/no-webpack-loader-syntax": "error",
526
524
  "import/order": "error",
527
525
  ...stylistic2 ? {
528
- "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
526
+ "import/newline-after-import": ["error", { count: 1 }]
529
527
  } : {}
530
528
  }
531
529
  },
@@ -834,14 +832,10 @@ async function ensure(packages) {
834
832
  if (nonExistingPackages.length === 0) {
835
833
  return;
836
834
  }
837
- const { default: prompts } = await import("prompts");
838
- const { result } = await prompts([
839
- {
840
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
841
- name: "result",
842
- type: "confirm"
843
- }
844
- ]);
835
+ const p = await import("@clack/prompts");
836
+ const result = await p.confirm({
837
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
838
+ });
845
839
  if (result) {
846
840
  await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
847
841
  }
@@ -1072,8 +1066,8 @@ var import_eslint_plugin_antfu3 = __toESM(require("eslint-plugin-antfu"), 1);
1072
1066
  var StylisticConfigDefaults = {
1073
1067
  indent: 2,
1074
1068
  jsx: true,
1075
- quotes: "double",
1076
- semi: true
1069
+ quotes: "single",
1070
+ semi: false
1077
1071
  };
1078
1072
  async function stylistic(options = {}) {
1079
1073
  const {
@@ -1255,6 +1249,8 @@ async function typescript(options = {}) {
1255
1249
  "error",
1256
1250
  { disallowTypeAnnotations: false, prefer: "type-imports" }
1257
1251
  ],
1252
+ "ts/method-signature-style": ["error", "property"],
1253
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
1258
1254
  "ts/no-dupe-class-members": "error",
1259
1255
  "ts/no-dynamic-delete": "off",
1260
1256
  "ts/no-explicit-any": "off",
@@ -1524,7 +1520,7 @@ async function yaml(options = {}) {
1524
1520
  ]);
1525
1521
  const {
1526
1522
  indent = 2,
1527
- quotes = "double"
1523
+ quotes = "single"
1528
1524
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1529
1525
  return [
1530
1526
  {
@@ -1731,7 +1727,11 @@ async function nextjs(options = {}) {
1731
1727
  "@next/next/no-img-element": "off",
1732
1728
  "react/no-unknown-property": ["error", {
1733
1729
  ignore: ["tw"]
1734
- }]
1730
+ }],
1731
+ "react-refresh/only-export-components": [
1732
+ "warn",
1733
+ { allowConstantExport: true }
1734
+ ]
1735
1735
  }
1736
1736
  }
1737
1737
  ];
package/dist/index.d.cts CHANGED
@@ -30,7 +30,7 @@ declare function sortPackageJson(): FlatConfigItem[];
30
30
  */
31
31
  declare function sortTsconfig(): FlatConfigItem[];
32
32
 
33
- type StylisticConfig = Pick<StylisticCustomizeOptions, "jsx" | "indent" | "quotes" | "semi">;
33
+ type StylisticConfig = Pick<StylisticCustomizeOptions, 'jsx' | 'indent' | 'quotes' | 'semi'>;
34
34
  interface StylisticOptions {
35
35
  /**
36
36
  * Enable stylistic rules.
@@ -41,7 +41,7 @@ interface StylisticOptions {
41
41
  /**
42
42
  * Overrides for the config.
43
43
  */
44
- overrides?: FlatConfigItem["rules"];
44
+ overrides?: FlatConfigItem['rules'];
45
45
  }
46
46
  declare function stylistic(options?: StylisticOptions): Promise<FlatConfigItem[]>;
47
47
 
@@ -64,7 +64,7 @@ interface JavaScriptOptions {
64
64
  /**
65
65
  * Overrides for the config.
66
66
  */
67
- overrides?: FlatConfigItem["rules"];
67
+ overrides?: FlatConfigItem['rules'];
68
68
  }
69
69
  declare function javascript(options?: JavaScriptOptions): Promise<FlatConfigItem[]>;
70
70
 
@@ -78,7 +78,7 @@ interface JSDOCOptions {
78
78
  /**
79
79
  * Overrides for the config.
80
80
  */
81
- overrides?: FlatConfigItem["rules"];
81
+ overrides?: FlatConfigItem['rules'];
82
82
  }
83
83
  declare function jsdoc(options?: JSDOCOptions): Promise<FlatConfigItem[]>;
84
84
 
@@ -86,7 +86,7 @@ interface JSONOptions {
86
86
  /**
87
87
  * Override rules.
88
88
  */
89
- overrides?: FlatConfigItem["rules"];
89
+ overrides?: FlatConfigItem['rules'];
90
90
  /**
91
91
  * Enable stylistic rules.
92
92
  *
@@ -107,7 +107,7 @@ interface MarkdownOptions {
107
107
  /**
108
108
  * Override rules.
109
109
  */
110
- overrides?: FlatConfigItem["rules"];
110
+ overrides?: FlatConfigItem['rules'];
111
111
  /**
112
112
  * Additional extensions for components.
113
113
  *
@@ -157,7 +157,7 @@ interface TypeScriptOptions {
157
157
  /**
158
158
  * Overrides for the config.
159
159
  */
160
- overrides?: FlatConfigItem["rules"];
160
+ overrides?: FlatConfigItem['rules'];
161
161
  }
162
162
  declare function typescript(options?: TypeScriptOptions): Promise<FlatConfigItem[]>;
163
163
 
@@ -165,7 +165,7 @@ interface VueOptions {
165
165
  /**
166
166
  * Override rules.
167
167
  */
168
- overrides?: FlatConfigItem["rules"];
168
+ overrides?: FlatConfigItem['rules'];
169
169
  /**
170
170
  * Enable stylistic rules.
171
171
  *
@@ -199,7 +199,7 @@ interface YAMLOptions {
199
199
  /**
200
200
  * Override rules.
201
201
  */
202
- overrides?: FlatConfigItem["rules"];
202
+ overrides?: FlatConfigItem['rules'];
203
203
  /**
204
204
  * Enable stylistic rules.
205
205
  *
@@ -233,7 +233,7 @@ interface TestOptions {
233
233
  /**
234
234
  * Override rules for for test files.
235
235
  */
236
- overrides?: FlatConfigItem["rules"];
236
+ overrides?: FlatConfigItem['rules'];
237
237
  }
238
238
  declare function test(options?: TestOptions): Promise<FlatConfigItem[]>;
239
239
 
@@ -260,7 +260,7 @@ interface UnoCSSOptions {
260
260
  /**
261
261
  * Override rules for for files with unocss classes.
262
262
  */
263
- overrides?: FlatConfigItem["rules"];
263
+ overrides?: FlatConfigItem['rules'];
264
264
  }
265
265
  declare function unocss(options?: UnoCSSOptions): Promise<FlatConfigItem[]>;
266
266
 
@@ -275,7 +275,7 @@ interface NextJSOptions {
275
275
  /**
276
276
  * Override rules.
277
277
  */
278
- overrides?: FlatConfigItem["rules"];
278
+ overrides?: FlatConfigItem['rules'];
279
279
  /**
280
280
  * Glob patterns for Next.js files.
281
281
  *
@@ -290,7 +290,7 @@ interface ReactOptions {
290
290
  /**
291
291
  * Override rules.
292
292
  */
293
- overrides?: FlatConfigItem["rules"];
293
+ overrides?: FlatConfigItem['rules'];
294
294
  /**
295
295
  * Enable TypeScript support.
296
296
  *
@@ -317,7 +317,7 @@ interface AstroOptions {
317
317
  /**
318
318
  * Override rules.
319
319
  */
320
- overrides?: FlatConfigItem["rules"];
320
+ overrides?: FlatConfigItem['rules'];
321
321
  /**
322
322
  * Enable TypeScript support.
323
323
  *
@@ -351,7 +351,7 @@ interface TailwindCSSOptions {
351
351
  /**
352
352
  * Override rules for for files with tailwind classes.
353
353
  */
354
- overrides?: FlatConfigItem["rules"];
354
+ overrides?: FlatConfigItem['rules'];
355
355
  }
356
356
  declare function tailwindcss(options?: TailwindCSSOptions): Promise<FlatConfigItem[]>;
357
357
 
@@ -388,7 +388,7 @@ interface VendoredPrettierOptionsRequired {
388
388
  /**
389
389
  * Print trailing commas wherever possible.
390
390
  */
391
- trailingComma: "none" | "es5" | "all";
391
+ trailingComma: 'none' | 'es5' | 'all';
392
392
  /**
393
393
  * Print spaces between brackets in object literals.
394
394
  */
@@ -417,12 +417,12 @@ interface VendoredPrettierOptionsRequired {
417
417
  * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
418
418
  * @default "preserve"
419
419
  */
420
- proseWrap: "always" | "never" | "preserve";
420
+ proseWrap: 'always' | 'never' | 'preserve';
421
421
  /**
422
422
  * Include parentheses around a sole arrow function parameter.
423
423
  * @default "always"
424
424
  */
425
- arrowParens: "avoid" | "always";
425
+ arrowParens: 'avoid' | 'always';
426
426
  /**
427
427
  * Provide ability to support new languages to prettier.
428
428
  */
@@ -431,17 +431,17 @@ interface VendoredPrettierOptionsRequired {
431
431
  * How to handle whitespaces in HTML.
432
432
  * @default "css"
433
433
  */
434
- htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
434
+ htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
435
435
  /**
436
436
  * Which end of line characters to apply.
437
437
  * @default "lf"
438
438
  */
439
- endOfLine: "auto" | "lf" | "crlf" | "cr";
439
+ endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
440
440
  /**
441
441
  * Change when properties in objects are quoted.
442
442
  * @default "as-needed"
443
443
  */
444
- quoteProps: "as-needed" | "consistent" | "preserve";
444
+ quoteProps: 'as-needed' | 'consistent' | 'preserve';
445
445
  /**
446
446
  * Whether or not to indent the code inside <script> and <style> tags in Vue files.
447
447
  * @default false
@@ -460,13 +460,13 @@ interface FormattersOptions {
460
460
  *
461
461
  * Currently only support Prettier.
462
462
  */
463
- css?: "prettier" | boolean;
463
+ css?: 'prettier' | boolean;
464
464
  /**
465
465
  * Enable formatting support for HTML.
466
466
  *
467
467
  * Currently only support Prettier.
468
468
  */
469
- html?: "prettier" | boolean;
469
+ html?: 'prettier' | boolean;
470
470
  /**
471
471
  * Enable formatting support for Markdown.
472
472
  *
@@ -474,17 +474,17 @@ interface FormattersOptions {
474
474
  *
475
475
  * When set to `true`, it will use Prettier.
476
476
  */
477
- markdown?: "prettier" | "dprint" | boolean;
477
+ markdown?: 'prettier' | 'dprint' | boolean;
478
478
  /**
479
479
  * Enable formatting support for Astro.
480
480
  *
481
481
  * Currently only support Prettier.
482
482
  */
483
- astro?: "prettier" | boolean;
483
+ astro?: 'prettier' | boolean;
484
484
  /**
485
485
  * Enable formatting support for GraphQL.
486
486
  */
487
- graphql?: "prettier" | boolean;
487
+ graphql?: 'prettier' | boolean;
488
488
  /**
489
489
  * Custom options for Prettier.
490
490
  *
@@ -504,7 +504,7 @@ interface TOMLOptions {
504
504
  /**
505
505
  * Override rules.
506
506
  */
507
- overrides?: FlatConfigItem["rules"];
507
+ overrides?: FlatConfigItem['rules'];
508
508
  /**
509
509
  * Enable stylistic rules.
510
510
  *
@@ -527,8 +527,8 @@ type WrapRuleConfig<T extends {
527
527
  [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
528
528
  };
529
529
  type Awaitable<T> = T | Promise<T>;
530
- type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, "@typescript-eslint/", "ts/"> & RenamePrefix<VitestRules, "vitest/", "test/"> & RenamePrefix<YmlRules, "yml/", "yaml/"> & RenamePrefix<NRules, "n/", "node/"> & Prefix<UnprefixedRuleOptions, "style/"> & Prefix<Rules$1, "antfu/"> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules>>;
531
- type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, "plugins"> & {
530
+ type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules>>;
531
+ type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
532
532
  /**
533
533
  * Custom name of each config item
534
534
  */
package/dist/index.d.ts CHANGED
@@ -30,7 +30,7 @@ declare function sortPackageJson(): FlatConfigItem[];
30
30
  */
31
31
  declare function sortTsconfig(): FlatConfigItem[];
32
32
 
33
- type StylisticConfig = Pick<StylisticCustomizeOptions, "jsx" | "indent" | "quotes" | "semi">;
33
+ type StylisticConfig = Pick<StylisticCustomizeOptions, 'jsx' | 'indent' | 'quotes' | 'semi'>;
34
34
  interface StylisticOptions {
35
35
  /**
36
36
  * Enable stylistic rules.
@@ -41,7 +41,7 @@ interface StylisticOptions {
41
41
  /**
42
42
  * Overrides for the config.
43
43
  */
44
- overrides?: FlatConfigItem["rules"];
44
+ overrides?: FlatConfigItem['rules'];
45
45
  }
46
46
  declare function stylistic(options?: StylisticOptions): Promise<FlatConfigItem[]>;
47
47
 
@@ -64,7 +64,7 @@ interface JavaScriptOptions {
64
64
  /**
65
65
  * Overrides for the config.
66
66
  */
67
- overrides?: FlatConfigItem["rules"];
67
+ overrides?: FlatConfigItem['rules'];
68
68
  }
69
69
  declare function javascript(options?: JavaScriptOptions): Promise<FlatConfigItem[]>;
70
70
 
@@ -78,7 +78,7 @@ interface JSDOCOptions {
78
78
  /**
79
79
  * Overrides for the config.
80
80
  */
81
- overrides?: FlatConfigItem["rules"];
81
+ overrides?: FlatConfigItem['rules'];
82
82
  }
83
83
  declare function jsdoc(options?: JSDOCOptions): Promise<FlatConfigItem[]>;
84
84
 
@@ -86,7 +86,7 @@ interface JSONOptions {
86
86
  /**
87
87
  * Override rules.
88
88
  */
89
- overrides?: FlatConfigItem["rules"];
89
+ overrides?: FlatConfigItem['rules'];
90
90
  /**
91
91
  * Enable stylistic rules.
92
92
  *
@@ -107,7 +107,7 @@ interface MarkdownOptions {
107
107
  /**
108
108
  * Override rules.
109
109
  */
110
- overrides?: FlatConfigItem["rules"];
110
+ overrides?: FlatConfigItem['rules'];
111
111
  /**
112
112
  * Additional extensions for components.
113
113
  *
@@ -157,7 +157,7 @@ interface TypeScriptOptions {
157
157
  /**
158
158
  * Overrides for the config.
159
159
  */
160
- overrides?: FlatConfigItem["rules"];
160
+ overrides?: FlatConfigItem['rules'];
161
161
  }
162
162
  declare function typescript(options?: TypeScriptOptions): Promise<FlatConfigItem[]>;
163
163
 
@@ -165,7 +165,7 @@ interface VueOptions {
165
165
  /**
166
166
  * Override rules.
167
167
  */
168
- overrides?: FlatConfigItem["rules"];
168
+ overrides?: FlatConfigItem['rules'];
169
169
  /**
170
170
  * Enable stylistic rules.
171
171
  *
@@ -199,7 +199,7 @@ interface YAMLOptions {
199
199
  /**
200
200
  * Override rules.
201
201
  */
202
- overrides?: FlatConfigItem["rules"];
202
+ overrides?: FlatConfigItem['rules'];
203
203
  /**
204
204
  * Enable stylistic rules.
205
205
  *
@@ -233,7 +233,7 @@ interface TestOptions {
233
233
  /**
234
234
  * Override rules for for test files.
235
235
  */
236
- overrides?: FlatConfigItem["rules"];
236
+ overrides?: FlatConfigItem['rules'];
237
237
  }
238
238
  declare function test(options?: TestOptions): Promise<FlatConfigItem[]>;
239
239
 
@@ -260,7 +260,7 @@ interface UnoCSSOptions {
260
260
  /**
261
261
  * Override rules for for files with unocss classes.
262
262
  */
263
- overrides?: FlatConfigItem["rules"];
263
+ overrides?: FlatConfigItem['rules'];
264
264
  }
265
265
  declare function unocss(options?: UnoCSSOptions): Promise<FlatConfigItem[]>;
266
266
 
@@ -275,7 +275,7 @@ interface NextJSOptions {
275
275
  /**
276
276
  * Override rules.
277
277
  */
278
- overrides?: FlatConfigItem["rules"];
278
+ overrides?: FlatConfigItem['rules'];
279
279
  /**
280
280
  * Glob patterns for Next.js files.
281
281
  *
@@ -290,7 +290,7 @@ interface ReactOptions {
290
290
  /**
291
291
  * Override rules.
292
292
  */
293
- overrides?: FlatConfigItem["rules"];
293
+ overrides?: FlatConfigItem['rules'];
294
294
  /**
295
295
  * Enable TypeScript support.
296
296
  *
@@ -317,7 +317,7 @@ interface AstroOptions {
317
317
  /**
318
318
  * Override rules.
319
319
  */
320
- overrides?: FlatConfigItem["rules"];
320
+ overrides?: FlatConfigItem['rules'];
321
321
  /**
322
322
  * Enable TypeScript support.
323
323
  *
@@ -351,7 +351,7 @@ interface TailwindCSSOptions {
351
351
  /**
352
352
  * Override rules for for files with tailwind classes.
353
353
  */
354
- overrides?: FlatConfigItem["rules"];
354
+ overrides?: FlatConfigItem['rules'];
355
355
  }
356
356
  declare function tailwindcss(options?: TailwindCSSOptions): Promise<FlatConfigItem[]>;
357
357
 
@@ -388,7 +388,7 @@ interface VendoredPrettierOptionsRequired {
388
388
  /**
389
389
  * Print trailing commas wherever possible.
390
390
  */
391
- trailingComma: "none" | "es5" | "all";
391
+ trailingComma: 'none' | 'es5' | 'all';
392
392
  /**
393
393
  * Print spaces between brackets in object literals.
394
394
  */
@@ -417,12 +417,12 @@ interface VendoredPrettierOptionsRequired {
417
417
  * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
418
418
  * @default "preserve"
419
419
  */
420
- proseWrap: "always" | "never" | "preserve";
420
+ proseWrap: 'always' | 'never' | 'preserve';
421
421
  /**
422
422
  * Include parentheses around a sole arrow function parameter.
423
423
  * @default "always"
424
424
  */
425
- arrowParens: "avoid" | "always";
425
+ arrowParens: 'avoid' | 'always';
426
426
  /**
427
427
  * Provide ability to support new languages to prettier.
428
428
  */
@@ -431,17 +431,17 @@ interface VendoredPrettierOptionsRequired {
431
431
  * How to handle whitespaces in HTML.
432
432
  * @default "css"
433
433
  */
434
- htmlWhitespaceSensitivity: "css" | "strict" | "ignore";
434
+ htmlWhitespaceSensitivity: 'css' | 'strict' | 'ignore';
435
435
  /**
436
436
  * Which end of line characters to apply.
437
437
  * @default "lf"
438
438
  */
439
- endOfLine: "auto" | "lf" | "crlf" | "cr";
439
+ endOfLine: 'auto' | 'lf' | 'crlf' | 'cr';
440
440
  /**
441
441
  * Change when properties in objects are quoted.
442
442
  * @default "as-needed"
443
443
  */
444
- quoteProps: "as-needed" | "consistent" | "preserve";
444
+ quoteProps: 'as-needed' | 'consistent' | 'preserve';
445
445
  /**
446
446
  * Whether or not to indent the code inside <script> and <style> tags in Vue files.
447
447
  * @default false
@@ -460,13 +460,13 @@ interface FormattersOptions {
460
460
  *
461
461
  * Currently only support Prettier.
462
462
  */
463
- css?: "prettier" | boolean;
463
+ css?: 'prettier' | boolean;
464
464
  /**
465
465
  * Enable formatting support for HTML.
466
466
  *
467
467
  * Currently only support Prettier.
468
468
  */
469
- html?: "prettier" | boolean;
469
+ html?: 'prettier' | boolean;
470
470
  /**
471
471
  * Enable formatting support for Markdown.
472
472
  *
@@ -474,17 +474,17 @@ interface FormattersOptions {
474
474
  *
475
475
  * When set to `true`, it will use Prettier.
476
476
  */
477
- markdown?: "prettier" | "dprint" | boolean;
477
+ markdown?: 'prettier' | 'dprint' | boolean;
478
478
  /**
479
479
  * Enable formatting support for Astro.
480
480
  *
481
481
  * Currently only support Prettier.
482
482
  */
483
- astro?: "prettier" | boolean;
483
+ astro?: 'prettier' | boolean;
484
484
  /**
485
485
  * Enable formatting support for GraphQL.
486
486
  */
487
- graphql?: "prettier" | boolean;
487
+ graphql?: 'prettier' | boolean;
488
488
  /**
489
489
  * Custom options for Prettier.
490
490
  *
@@ -504,7 +504,7 @@ interface TOMLOptions {
504
504
  /**
505
505
  * Override rules.
506
506
  */
507
- overrides?: FlatConfigItem["rules"];
507
+ overrides?: FlatConfigItem['rules'];
508
508
  /**
509
509
  * Enable stylistic rules.
510
510
  *
@@ -527,8 +527,8 @@ type WrapRuleConfig<T extends {
527
527
  [K in keyof T]: T[K] extends RuleConfig ? T[K] : RuleConfig<T[K]>;
528
528
  };
529
529
  type Awaitable<T> = T | Promise<T>;
530
- type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, "@typescript-eslint/", "ts/"> & RenamePrefix<VitestRules, "vitest/", "test/"> & RenamePrefix<YmlRules, "yml/", "yaml/"> & RenamePrefix<NRules, "n/", "node/"> & Prefix<UnprefixedRuleOptions, "style/"> & Prefix<Rules$1, "antfu/"> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules>>;
531
- type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, "plugins"> & {
530
+ type Rules = WrapRuleConfig<MergeIntersection<RenamePrefix<RuleOptions, '@typescript-eslint/', 'ts/'> & RenamePrefix<VitestRules, 'vitest/', 'test/'> & RenamePrefix<YmlRules, 'yml/', 'yaml/'> & RenamePrefix<NRules, 'n/', 'node/'> & Prefix<UnprefixedRuleOptions, 'style/'> & Prefix<Rules$1, 'antfu/'> & ReactHooksRules & ReactRules & RuleOptions$1 & ImportRules & EslintRules & JsoncRules & VueRules & RuleOptions$2 & EslintCommentsRules>>;
531
+ type FlatConfigItem = Omit<FlatESLintConfigItem<Rules, false>, 'plugins'> & {
532
532
  /**
533
533
  * Custom name of each config item
534
534
  */
package/dist/index.js CHANGED
@@ -13,8 +13,6 @@ async function comments() {
13
13
  "eslint-comments": eslintCommentsPlugin
14
14
  },
15
15
  rules: {
16
- // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/disable-enable-pair.md
17
- "eslint-comments/disable-enable-pair": "error",
18
16
  // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-aggregating-enable.md
19
17
  "eslint-comments/no-aggregating-enable": "error",
20
18
  // https://github.com/eslint-community/eslint-plugin-eslint-comments/blob/main/docs/rules/no-duplicate-disable.md
@@ -433,7 +431,7 @@ async function imports(options = {}) {
433
431
  "import/no-webpack-loader-syntax": "error",
434
432
  "import/order": "error",
435
433
  ...stylistic2 ? {
436
- "import/newline-after-import": ["error", { considerComments: true, count: 1 }]
434
+ "import/newline-after-import": ["error", { count: 1 }]
437
435
  } : {}
438
436
  }
439
437
  },
@@ -742,14 +740,10 @@ async function ensure(packages) {
742
740
  if (nonExistingPackages.length === 0) {
743
741
  return;
744
742
  }
745
- const { default: prompts } = await import("prompts");
746
- const { result } = await prompts([
747
- {
748
- message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
749
- name: "result",
750
- type: "confirm"
751
- }
752
- ]);
743
+ const p = await import("@clack/prompts");
744
+ const result = await p.confirm({
745
+ message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
746
+ });
753
747
  if (result) {
754
748
  await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
755
749
  }
@@ -980,8 +974,8 @@ import pluginAntfu3 from "eslint-plugin-antfu";
980
974
  var StylisticConfigDefaults = {
981
975
  indent: 2,
982
976
  jsx: true,
983
- quotes: "double",
984
- semi: true
977
+ quotes: "single",
978
+ semi: false
985
979
  };
986
980
  async function stylistic(options = {}) {
987
981
  const {
@@ -1163,6 +1157,8 @@ async function typescript(options = {}) {
1163
1157
  "error",
1164
1158
  { disallowTypeAnnotations: false, prefer: "type-imports" }
1165
1159
  ],
1160
+ "ts/method-signature-style": ["error", "property"],
1161
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
1166
1162
  "ts/no-dupe-class-members": "error",
1167
1163
  "ts/no-dynamic-delete": "off",
1168
1164
  "ts/no-explicit-any": "off",
@@ -1432,7 +1428,7 @@ async function yaml(options = {}) {
1432
1428
  ]);
1433
1429
  const {
1434
1430
  indent = 2,
1435
- quotes = "double"
1431
+ quotes = "single"
1436
1432
  } = typeof stylistic2 === "boolean" ? {} : stylistic2;
1437
1433
  return [
1438
1434
  {
@@ -1639,7 +1635,11 @@ async function nextjs(options = {}) {
1639
1635
  "@next/next/no-img-element": "off",
1640
1636
  "react/no-unknown-property": ["error", {
1641
1637
  ignore: ["tw"]
1642
- }]
1638
+ }],
1639
+ "react-refresh/only-export-components": [
1640
+ "warn",
1641
+ { allowConstantExport: true }
1642
+ ]
1643
1643
  }
1644
1644
  }
1645
1645
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/eslint-config",
3
- "version": "4.2.9",
3
+ "version": "4.2.11",
4
4
  "description": "ESLint config for @luxass",
5
5
  "type": "module",
6
6
  "author": {
@@ -92,6 +92,7 @@
92
92
  "dependencies": {
93
93
  "@antfu/eslint-define-config": "^1.23.0-2",
94
94
  "@antfu/install-pkg": "^0.3.1",
95
+ "@clack/prompts": "^0.7.0",
95
96
  "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0",
96
97
  "@eslint-types/jsdoc": "^48.2.0",
97
98
  "@eslint-types/typescript-eslint": "^7.0.2",
@@ -121,7 +122,6 @@
121
122
  "jsonc-eslint-parser": "^2.4.0",
122
123
  "local-pkg": "^0.5.0",
123
124
  "parse-gitignore": "^2.0.0",
124
- "prompts": "^2.4.2",
125
125
  "toml-eslint-parser": "^0.9.3",
126
126
  "vue-eslint-parser": "^9.4.2",
127
127
  "yaml-eslint-parser": "^1.2.2"
@@ -133,7 +133,6 @@
133
133
  "@types/eslint": "^8.56.5",
134
134
  "@types/estree": "^1.0.5",
135
135
  "@types/node": "^18.17.19",
136
- "@types/prompts": "^2.4.9",
137
136
  "@typescript-eslint/rule-tester": "^7.2.0",
138
137
  "@unocss/eslint-plugin": "^0.58.5",
139
138
  "astro-eslint-parser": "^0.16.3",