@shayanthenerd/eslint-config 0.29.4 → 0.30.1

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
@@ -6,7 +6,7 @@ ESLint configuration for enforcing best practices and maintaining a consistent c
6
6
  - **Smart**: Context-aware linting with [automatic dependency detection](#automatic-dependency-detection) and _.gitignore_ recognition.
7
7
  - **Comprehensive**: [Supports useful plugins](#plugin-support) for TypeScript, React & Next, Vue & Nuxt, Astro, Tailwind, and more.
8
8
  - **Type-safe**: [Fully-typed and well-documented API](#api-reference) with `overrides` support for built-in configuration objects.
9
- - **Modern**: Requires ESLint ^10.6.0 and Node.js ^20.19.0 (ESM-only)
9
+ - **Modern**: Requires ESLint ^10.9.0 and Node.js ^20.19.0 (ESM-only)
10
10
 
11
11
  ## Table of Contents
12
12
  - [Plugin Support](#plugin-support)
@@ -57,7 +57,7 @@ Legend:
57
57
  | [Promises][plugin-promise] | ✅  |
58
58
  | [Imports][plugin-import-x] | ✅  |
59
59
  | [Unicorn][plugin-unicorn] | ✅  |
60
- | [Baseline][plugin-baseline] | 🔍  |
60
+ | [Baseline][plugin-baseline] ([css/use-baseline], [@html-eslint/use-baseline], [@html-eslint/react/use-baseline]) | 🔍  |
61
61
 
62
62
  ## Installation and Configuration
63
63
  1. Install the package and ESLint as dev dependencies:
@@ -78,9 +78,9 @@ Legend:
78
78
  ```json title="package.json"
79
79
  {
80
80
  "scripts": {
81
- "lint:inspect": "npx @eslint/config-inspector",
82
- "lint:check": "eslint --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'",
83
- "lint:fix": "eslint --fix --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'"
81
+ "lint": "eslint --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'",
82
+ "lint:fix": "eslint --fix --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'",
83
+ "lint:inspect": "npx @eslint/config-inspector"
84
84
  }
85
85
  }
86
86
  ```
@@ -88,8 +88,8 @@ Legend:
88
88
  ---
89
89
 
90
90
  After installation:
91
+ - Use `npm run lint` to lint files without modifying them (useful for CI).
91
92
  - Use `npm run lint:fix` to lint and fix files.
92
- - Use `npm run lint:check` to lint files without fixing them (useful for CI).
93
93
  - Use `npm run lint:inspect` to see a visual breakdown of your configuration.
94
94
  - See [IDE Support](#ide-support) for editor integration.
95
95
  - See [Customization](#customization) for advanced configuration.
@@ -110,7 +110,7 @@ export default defineConfig();
110
110
  export default defineConfig({
111
111
  autoDetectDeps: false,
112
112
  configs: {
113
- stylistic: false,
113
+ storybook: false,
114
114
  markdown: {
115
115
  language: 'commonmark',
116
116
  },
@@ -136,7 +136,7 @@ export default defineConfig(
136
136
  typeDefinitionStyle: 'type',
137
137
  overrides: {
138
138
  rules: {
139
- '@typescript-eslint/explicit-module-boundary-types': 'off',
139
+ '@typescript-eslint/explicit-module-boundary-types': 'error',
140
140
  },
141
141
  },
142
142
  },
@@ -176,7 +176,7 @@ PNPM's strict dependency resolution avoids this issue.
176
176
  > [!NOTE]
177
177
  > For example, `eslint-plugin-storybook` depends on `storybook`, which is hoisted by NPM and Bun. As a result, the integration for `storybook` will be enabled automatically, even if you haven't explicitly installed it.
178
178
 
179
- `configs.useBaseline` is automatically enabled when `autoDetectDeps: true` and `env: 'browser'` (both are the defaults).
179
+ `configs.baseline` is automatically enabled when `autoDetectDeps: true` and `env: 'browser'` (both are the defaults).
180
180
 
181
181
  To opt out of this behavior, either [globally disable automatic dependency detection](#customization) or manually disable the unwanted integrations that were enabled automatically.
182
182
 
@@ -197,7 +197,7 @@ export default defineConfig({
197
197
  });
198
198
  ```
199
199
 
200
- For editor integration, to avoid inconsistent diagnostics from the [Tailwind CSS IntelliSense VS Code extension][extension-tailwind], add the following settings to _.vscode/settings.json_:
200
+ For editor integration, to reduce noise and avoid inconsistent diagnostics from the [Tailwind CSS IntelliSense VS Code extension][extension-tailwind], add the following settings to _.vscode/settings.json_:
201
201
  ```json title=".vscode/settings.json"
202
202
  {
203
203
  "tailwindCSS.lint.cssConflict": "ignore",
@@ -222,7 +222,7 @@ Markdown linting is powered by [@eslint/markdown][plugin-md].
222
222
  By default, the plugin uses GitHub Flavored Markdown (GFM). You can [switch to CommonMark](#customization) if you prefer, but rules related to tables, label references, and other GFM syntax will be disabled because CommonMark doesn't support them.
223
223
 
224
224
  > [!NOTE]
225
- > Fenced code blocks inside Markdown files are not linted by @eslint/markdown.
225
+ > Fenced code blocks inside Markdown files are not linted.
226
226
 
227
227
  ### Node.js
228
228
  Some rules depend on the specified Node.js version. Visit the documentation for [version-resolution options and project-specific configurations](https://github.com/eslint-community/eslint-plugin-n#configured-nodejs-version-range).
@@ -243,7 +243,7 @@ You can also add the following to your _.vscode/settings.json_:
243
243
  /* Enforce Unix-like line endings (LF). */
244
244
  "files.eol": "\n",
245
245
 
246
- /* Enforce 2 spaces for indentation. */
246
+ /* Enforce 2 spaces for indentation, even when using the Tab key (`⇥`). */
247
247
  "editor.tabSize": 2,
248
248
  "editor.insertSpaces": true,
249
249
  "editor.detectIndentation": false,
@@ -274,7 +274,7 @@ You can also add the following to your _.vscode/settings.json_:
274
274
  "vue"
275
275
  ],
276
276
 
277
- /* Adjust these based on the features you're using to silently auto-fix the stylistic rules. */
277
+ /* If the Stylistic integration is enabled, use these settings to silently auto-fix the corresponding rules. */
278
278
  "eslint.rules.customizations": [
279
279
  { "rule": "*styl*", "severity": "off", "fixable": true },
280
280
  { "rule": "*sort*", "severity": "off", "fixable": true },
@@ -301,82 +301,138 @@ This configuration uses [ESLint Stylistic][plugin-stylistic] to format:
301
301
 
302
302
  HTML and Vue's `<template>` blocks are formatted with [@html-eslint/eslint-plugin][plugin-html] and [eslint-plugin-vue][plugin-vue], respectively.
303
303
 
304
- For file types not handled by ESLint Stylistic—such as CSS, JSON, Yaml, and Markdown—you can use Prettier. To simplify the setup, this package also provides a customizable [shared Prettier configuration][prettier-shared-config].
304
+ For file types that ESLint Stylistic does not handle—such as CSS, JSON, YAML, and Markdown—you can use [Prettier][prettier] instead. To make setup easier, this package also provides a customizable [shared Prettier configuration][prettier-shared-config] with the same defaults as the Stylistic integration.
305
305
 
306
- 1. Install Prettier as a dev dependency:
307
- ```shell
308
- npm i -D prettier
309
- ```
310
-
311
- 2. Create a Prettier config file in the root of your project (_prettier.config.js_):
312
- ```js title="prettier.config.js"
313
- import prettierConfig from '@shayanthenerd/eslint-config/prettier';
314
-
315
- /** @type {import('prettier').Config} */
316
- export default {
317
- ...prettierConfig,
318
- semi: false, // Override `semi` from the shared config
319
- };
320
- ```
321
-
322
- Or if you prefer using TypeScript (_prettier.config.ts_):
323
- ```ts title="prettier.config.ts"
324
- import type { Config } from 'prettier';
325
-
326
- import prettierConfig from '@shayanthenerd/eslint-config/prettier';
327
-
328
- export default {
329
- ...prettierConfig,
330
- semi: true, // Override `semi` from the shared config
331
- } satisfies Config;
332
- ```
333
-
334
- ### Using ESLint Stylistic with Prettier
335
- In this setup, Prettier formats everything that ESLint Stylistic doesn't. To prevent overlaps and potential race conditions, Prettier should only target files that ESLint Stylistic doesn't format.
336
-
337
- _package.json_:
338
- ```json title="package.json"
339
- {
340
- "scripts": {
341
- "format": "prettier --write . '!**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,html,vue,astro}' --cache"
342
- }
343
- }
344
- ```
345
- _.vscode/settings.json_:
346
- ```json title=".vscode/settings.json"
347
- {
348
- "editor.formatOnSave": true,
349
- "editor.defaultFormatter": "esbenp.prettier-vscode",
350
- "[javascript][typescript][javascriptreact][typescriptreact][html][vue][astro][{**/package.json}]": {
351
- "editor.defaultFormatter": "dbaeumer.vscode-eslint"
352
- },
353
- }
354
- ```
306
+ ### Using Prettier Alongside ESLint Stylistic
307
+ <details>
308
+ <summary>
309
+ In this setup, Prettier should only target files that ESLint Stylistic doesn't handle.
310
+ </summary>
311
+
312
+ <br />
313
+
314
+ 1. Install Prettier as a dev dependency:
315
+ ```shell
316
+ npm i -D prettier
317
+ ```
318
+
319
+ 2. Create a Prettier config file in the root of your project (_prettier.config.js_):
320
+ ```js title="prettier.config.js"
321
+ import prettierConfig from '@shayanthenerd/eslint-config/prettier';
322
+
323
+ /** @type {import('prettier').Config} */
324
+ export default {
325
+ ...prettierConfig,
326
+ semi: false, // Override `semi` from the shared config
327
+ };
328
+ ```
329
+
330
+ Or if you prefer using TypeScript (_prettier.config.ts_):
331
+ ```ts title="prettier.config.ts"
332
+ import type { Config } from 'prettier';
333
+
334
+ import prettierConfig from '@shayanthenerd/eslint-config/prettier';
335
+
336
+ export default {
337
+ ...prettierConfig,
338
+ semi: false, // Override `semi` from the shared config
339
+ } satisfies Config;
340
+ ```
341
+
342
+ 3. Add the following script to _package.json_:
343
+ ```json title="package.json"
344
+ {
345
+ "scripts": {
346
+ "format": "prettier --write . '!**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,html,vue,astro}' --cache"
347
+ }
348
+ }
349
+ ```
350
+
351
+ 4. Add the following settings to _.vscode/settings.json_:
352
+ ```json title=".vscode/settings.json"
353
+ {
354
+ "editor.formatOnSave": true,
355
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
356
+ "[javascript][typescript][javascriptreact][typescriptreact][html][vue][astro][{**/package.json}]": {
357
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
358
+ },
359
+ }
360
+ ```
361
+ </details>
355
362
 
356
363
  ### Using Prettier Alone
357
- If you prefer to use Prettier as the only formatter, [disable the stylistic configuration](#customization) and let Prettier handle all formatting. Just make sure to avoid running `lint` and `format` scripts on the same files simultaneously.
364
+ <details>
365
+ <summary>
366
+ If you prefer to use Prettier as the only formatter, disable the Stylistic integration and let Prettier handle all formatting.
367
+ </summary>
368
+
369
+ <br />
370
+
371
+ 1. Disable the Stylistic rules in _eslint.config.js_:
372
+ ```js title="eslint.config.js"
373
+ import { defineConfig } from '@shayanthenerd/eslint-config';
374
+
375
+ export default defineConfig({
376
+ configs: {
377
+ stylistic: false,
378
+
379
+ /**
380
+ * The following rules remain enabled when the Stylistic integration is disabled.
381
+ * Disable them manually if you use the corresponding Prettier plugins, such as:
382
+ * - prettier-plugin-packagejson
383
+ * - prettier-plugin-sort-imports
384
+ * - prettier-plugin-tailwindcss
385
+ */
386
+ packageJson: {
387
+ overrides: {
388
+ rules: {
389
+ 'package-json/order-properties': 'off',
390
+ },
391
+ },
392
+ },
393
+ perfectionist: {
394
+ overrides: {
395
+ rules: {
396
+ 'perfectionist/sort-imports': 'off',
397
+ 'perfectionist/sort-named-imports': 'off',
398
+ },
399
+ },
400
+ },
401
+ tailwind: {
402
+ overrides: {
403
+ rules: {
404
+ 'better-tailwindcss/enforce-consistent-class-order': 'off',
405
+ },
406
+ },
407
+ },
408
+ },
409
+ });
410
+ ```
411
+
412
+ 2. Add the following settings to _.vscode/settings.json_:
413
+ ```json title=".vscode/settings.json"
414
+ {
415
+ "editor.formatOnSave": true,
416
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
417
+
418
+ /* This runs before the formatter and doesn't cause conflicts. */
419
+ "editor.codeActionsOnSave": {
420
+ "source.fixAll.eslint": "explicit"
421
+ }
422
+ }
423
+ ```
424
+
425
+ 3. Add the following script to _package.json_:
426
+ ```json title="package.json"
427
+ {
428
+ "scripts": {
429
+ "format": "prettier --write . --cache",
430
+ }
431
+ }
432
+ ```
433
+ To avoid conflicts, do not run the `format` and the `lint:fix` scripts on the same files simultaneously.
434
+ </details>
358
435
 
359
- _package.json_:
360
- ```json title="package.json"
361
- {
362
- "scripts": {
363
- "format": "prettier --write . --cache",
364
- "lint": "eslint --fix --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'"
365
- }
366
- }
367
- ```
368
- _.vscode/settings.json_:
369
- ```json title=".vscode/settings.json"
370
- {
371
- "editor.formatOnSave": true,
372
- "editor.defaultFormatter": "esbenp.prettier-vscode",
373
-
374
- /* On file save, code actions are run before format, so the following doesn't cause conflicts. */
375
- "editor.codeActionsOnSave": {
376
- "source.fixAll.eslint": "explicit"
377
- }
378
- }
379
- ```
380
436
 
381
437
  ## API Reference
382
438
  <details>
@@ -462,9 +518,21 @@ _.vscode/settings.json_:
462
518
  astro?: boolean | {
463
519
  overrides?: Overrides,
464
520
  },
465
- base?: {
466
- maxDepth?: number,
467
- maxNestedCallbacks?: number,
521
+ baseline?: boolean | {
522
+ baseline?: number | 'newly' | 'widely',
523
+ css?: {
524
+ allowedAtRules?: AllowedAtRules,
525
+ allowedFunctions?: AllowedFunctions,
526
+ allowedMediaConditions?: AllowedMediaConditions,
527
+ allowedProperties?: AllowedProperties,
528
+ allowedPropertyValues?: AllowedPropertyValues,
529
+ allowedSelectors?: AllowedSelectors,
530
+ allowedUnits?: AllowedUnits,
531
+ },
532
+ javascript?: {
533
+ ignoredFeatures?: string[],
534
+ ignoredNodeTypes?: string[],
535
+ },
468
536
  overrides?: Overrides,
469
537
  },
470
538
  css?: boolean | {
@@ -477,6 +545,11 @@ _.vscode/settings.json_:
477
545
  importX?: boolean | {
478
546
  overrides?: Overrides,
479
547
  },
548
+ javascript?: {
549
+ maxDepth?: number,
550
+ maxNestedCallbacks?: number,
551
+ overrides?: Overrides,
552
+ },
480
553
  markdown?: boolean | {
481
554
  allowedHtmlTags?: string[],
482
555
  frontmatter?: false | 'json' | 'toml' | 'yaml',
@@ -582,23 +655,6 @@ _.vscode/settings.json_:
582
655
  },
583
656
  overrides?: Overrides,
584
657
  },
585
- useBaseline?: boolean | {
586
- baseline?: number | 'newly' | 'widely',
587
- css?: {
588
- allowedAtRules?: AllowedAtRules,
589
- allowedFunctions?: AllowedFunctions,
590
- allowedMediaConditions?: AllowedMediaConditions,
591
- allowedProperties?: AllowedProperties,
592
- allowedPropertyValues?: AllowedPropertyValues,
593
- allowedSelectors?: AllowedSelectors,
594
- allowedUnits?: AllowedUnits,
595
- },
596
- javascript?: {
597
- ignoredFeatures?: string[],
598
- ignoredNodeTypes?: string[],
599
- },
600
- overrides?: Overrides,
601
- },
602
658
  vue?: boolean | {
603
659
  accessibility?: boolean | {
604
660
  accessibleChildComponents?: string[],
@@ -718,6 +774,11 @@ This project was inspired by the work of [Anthony Fu][antfu], whose generous con
718
774
  [plugin-vue-a11y]: https://vue-a11y.github.io/eslint-plugin-vuejs-accessibility
719
775
  [plugin-zod]: https://github.com/marcalexiei/eslint-zod
720
776
 
777
+ <!-- ESLint Rules -->
778
+ [@html-eslint/react/use-baseline]: https://github.com/eslint/css/blob/main/docs/rules/use-baseline.md#options
779
+ [@html-eslint/use-baseline]: https://html-eslint.org/docs/rules/use-baseline#options
780
+ [css/use-baseline]: https://github.com/eslint/css/blob/main/docs/rules/use-baseline.md#options
781
+
721
782
  <!-- References -->
722
783
  [antfu]: https://github.com/antfu
723
784
  [contributing]: ./.github/CONTRIBUTING.md
@@ -726,6 +787,7 @@ This project was inspired by the work of [Anthony Fu][antfu], whose generous con
726
787
  [eslint-config-ts-setup]: https://eslint.org/docs/latest/use/configure/configuration-files#typescript-configuration-files
727
788
  [eslint-nuxt]: https://eslint.nuxt.com
728
789
  [local-pkg]: https://github.com/antfu-collective/local-pkg
790
+ [prettier]: https://prettier.io
729
791
  [prettier-shared-config]: https://prettier.io/docs/sharing-configurations
730
792
  [releases]: https://github.com/ShayanTheNerd/eslint-config/releases
731
793
  [semver]: https://semver.org
@@ -25,7 +25,7 @@ function getAstroConfig(options) {
25
25
  extraFileExtensions: [".astro"]
26
26
  }
27
27
  },
28
- rules: getAstroRules()
28
+ rules: getAstroRules(options)
29
29
  }, overrides);
30
30
  }
31
31
  //#endregion
@@ -5,9 +5,9 @@ import { getJavaScriptRules } from "../rules/javascript.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import { parser } from "typescript-eslint";
7
7
  import globals from "globals";
8
- //#region src/configs/base.ts
9
- function getBaseConfig(options) {
10
- const { env, configs: { vue, astro, base: { overrides } }, project: { globals: { bun, node, deno, vitest, worker, browser, commonjs, nodeBuiltin, audioWorklet, webextension, sharedWorker, serviceworker, vue: vueGlobals, astro: astroGlobals, custom: userGlobals } } } = options;
8
+ //#region src/configs/javascript.ts
9
+ function getJavascriptConfig(options) {
10
+ const { env, configs: { vue, astro, javascript: { overrides } }, project: { globals: { bun, node, deno, vitest, worker, browser, commonjs, nodeBuiltin, audioWorklet, webextension, sharedWorker, serviceworker, vue: vueGlobals, astro: astroGlobals, custom: userGlobals } } } = options;
11
11
  return mergeConfigs({
12
12
  name: "shayanthenerd/base",
13
13
  files: [
@@ -49,4 +49,4 @@ function getBaseConfig(options) {
49
49
  }, overrides);
50
50
  }
51
51
  //#endregion
52
- export { getBaseConfig };
52
+ export { getJavascriptConfig };
@@ -2,12 +2,12 @@ import { isTruthy } from "../utils/isTruthy.mjs";
2
2
  import { globs } from "../helpers/globs.mjs";
3
3
  import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
5
- import { getTypeScriptRules } from "../rules/typescript.mjs";
5
+ import { getTypescriptRules } from "../rules/typescript.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import { parser, plugin } from "typescript-eslint";
8
8
  import path from "node:path";
9
9
  //#region src/configs/typescript.ts
10
- function getTypeScriptConfig(options) {
10
+ function getTypescriptConfig(options) {
11
11
  const { tsConfig, configs: { vue, astro, typescript } } = options;
12
12
  const { allowedDefaultProjects } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
13
13
  const { overrides } = isEnabled(typescript) ? typescript : defaultOptions.configs.typescript;
@@ -31,8 +31,8 @@ function getTypeScriptConfig(options) {
31
31
  }
32
32
  }
33
33
  },
34
- rules: getTypeScriptRules(options)
34
+ rules: getTypescriptRules(options)
35
35
  }, overrides);
36
36
  }
37
37
  //#endregion
38
- export { getTypeScriptConfig };
38
+ export { getTypescriptConfig };
@@ -14,7 +14,11 @@ function getVueConfig(options) {
14
14
  const isVueAccessibilityEnabled = isEnabled(vue) && isEnabled(vue.accessibility);
15
15
  return mergeConfigs({
16
16
  name: "shayanthenerd/vue",
17
- files: [globs.vue],
17
+ files: [
18
+ globs.src,
19
+ globs.jsxTsx,
20
+ globs.vue
21
+ ],
18
22
  plugins: {
19
23
  vue: eslintPluginVue,
20
24
  ...isVueAccessibilityEnabled && { "vuejs-accessibility": eslintPluginVueAccessibility }
@@ -1,21 +1,21 @@
1
1
  //#region src/helpers/globs.ts
2
- const srcExtensions = "?([mc])[jt]s";
2
+ const sourceExtensions = "?([mc])[jt]s";
3
3
  const jsxTsxExtensions = "[jt]sx";
4
- const vueExtensions = `{vue,${srcExtensions},${jsxTsxExtensions}}`;
4
+ const vueSourceExtensions = `{vue,${sourceExtensions},${jsxTsxExtensions}}`;
5
5
  const globs = {
6
- src: `**/*.${srcExtensions}`,
6
+ src: `**/*.${sourceExtensions}`,
7
7
  jsxTsx: `**/*.${jsxTsxExtensions}`,
8
8
  packageJson: "**/package.json",
9
9
  markdown: "**/*.md",
10
10
  html: "**/*.html",
11
11
  css: "**/*.css",
12
12
  astro: "**/*.astro",
13
- vue: `**/*.${vueExtensions}`,
14
- nuxtAppErrorLayoutsPages: `**/{{app,error},{layouts,pages}/**/*}.${vueExtensions}`,
15
- nuxtServerComponents: `**/*.server.${vueExtensions}`,
16
- nuxtMiddlewares: `**/middleware?(s)/**/*.${srcExtensions}`,
17
- storybook: `**/*.(story|stories).{${srcExtensions},${jsxTsxExtensions}}`,
18
- test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${srcExtensions}`,
13
+ vue: "**/*.vue",
14
+ nuxtAppErrorLayoutsPages: `**/{{app,error},{layouts,pages}/**/*}.${vueSourceExtensions}`,
15
+ nuxtServerComponents: `**/*.server.${vueSourceExtensions}`,
16
+ nuxtMiddlewares: `**/middleware?(s)/**/*.${sourceExtensions}`,
17
+ storybook: `**/*.(story|stories).{${sourceExtensions},${jsxTsxExtensions}}`,
18
+ test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${sourceExtensions}`,
19
19
  coverage: "**/coverage/**"
20
20
  };
21
21
  //#endregion
@@ -35,9 +35,21 @@ const defaultOptions = {
35
35
  },
36
36
  configs: {
37
37
  astro: { overrides: {} },
38
- base: {
39
- maxDepth: 3,
40
- maxNestedCallbacks: 3,
38
+ baseline: {
39
+ baseline: "widely",
40
+ css: {
41
+ allowedAtRules: [],
42
+ allowedFunctions: [],
43
+ allowedMediaConditions: [],
44
+ allowedProperties: [],
45
+ allowedPropertyValues: {},
46
+ allowedSelectors: [],
47
+ allowedUnits: []
48
+ },
49
+ javascript: {
50
+ ignoredFeatures: [],
51
+ ignoredNodeTypes: []
52
+ },
41
53
  overrides: {}
42
54
  },
43
55
  css: { overrides: {} },
@@ -46,6 +58,11 @@ const defaultOptions = {
46
58
  overrides: {}
47
59
  },
48
60
  importX: { overrides: {} },
61
+ javascript: {
62
+ maxDepth: 3,
63
+ maxNestedCallbacks: 3,
64
+ overrides: {}
65
+ },
49
66
  markdown: {
50
67
  allowedHtmlTags: [],
51
68
  frontmatter: "yaml",
@@ -140,23 +157,6 @@ const defaultOptions = {
140
157
  },
141
158
  overrides: {}
142
159
  },
143
- useBaseline: {
144
- baseline: "widely",
145
- css: {
146
- allowedAtRules: [],
147
- allowedFunctions: [],
148
- allowedMediaConditions: [],
149
- allowedProperties: [],
150
- allowedPropertyValues: {},
151
- allowedSelectors: [],
152
- allowedUnits: []
153
- },
154
- javascript: {
155
- ignoredFeatures: [],
156
- ignoredNodeTypes: []
157
- },
158
- overrides: {}
159
- },
160
160
  vue: {
161
161
  accessibility: {
162
162
  accessibleChildComponents: [
@@ -206,7 +206,7 @@ const defaultOptions = {
206
206
  "docs"
207
207
  ],
208
208
  componentNameCaseInTemplate: "PascalCase",
209
- destructureProps: "always",
209
+ destructureProps: "only-when-assigned",
210
210
  ignoredUndefinedComponents: [],
211
211
  macrosOrder: [
212
212
  "definePage",
@@ -47,7 +47,7 @@ function enableDetectedConfigs(options) {
47
47
  options.configs.importX ??= true;
48
48
  options.configs.stylistic ??= true;
49
49
  options.configs.perfectionist ??= true;
50
- options.configs.useBaseline ??= options.env === "browser";
50
+ options.configs.baseline ??= options.env === "browser";
51
51
  options.configs.typescript ??= autoDetectedPackages.typescript;
52
52
  options.configs.zod ??= autoDetectedPackages.zod;
53
53
  options.configs.astro ??= autoDetectedPackages.astro;
@@ -59,8 +59,8 @@ function enableDetectedConfigs(options) {
59
59
  options.configs.test.cypress ??= autoDetectedPackages.cypress;
60
60
  options.configs.test.storybook ??= autoDetectedPackages.storybook;
61
61
  options.configs.test.playwright ??= autoDetectedPackages.playwright;
62
- const isTypeScriptEnabled = isEnabled(options.configs.typescript);
63
- if (isTypeScriptEnabled) {
62
+ const isTypescriptEnabled = isEnabled(options.configs.typescript);
63
+ if (isTypescriptEnabled) {
64
64
  const defaultTsConfigRootDir = options.packageDir ?? defaultOptions.packageDir;
65
65
  const defaultTsConfigFilename = "tsconfig.json";
66
66
  if (options.tsConfig === void 0) options.tsConfig = {
@@ -72,7 +72,7 @@ function enableDetectedConfigs(options) {
72
72
  options.tsConfig.filename ??= defaultTsConfigFilename;
73
73
  }
74
74
  }
75
- if (isTypeScriptEnabled && options.configs.vue) {
75
+ if (isTypescriptEnabled && options.configs.vue) {
76
76
  options.configs.vue = options.configs.vue === true ? {} : options.configs.vue;
77
77
  options.configs.vue.blockLang = { script: "ts" };
78
78
  }
package/dist/index.mjs CHANGED
@@ -3,7 +3,6 @@ import { isEnabled } from "./utils/isEnabled.mjs";
3
3
  import { getCssConfig } from "./configs/css.mjs";
4
4
  import { getVueConfig } from "./configs/vue.mjs";
5
5
  import { getZodConfig } from "./configs/zod.mjs";
6
- import { getBaseConfig } from "./configs/base.mjs";
7
6
  import { getHtmlConfig } from "./configs/html.mjs";
8
7
  import { getNextConfig } from "./configs/next.mjs";
9
8
  import { getNodeConfig } from "./configs/node.mjs";
@@ -20,8 +19,9 @@ import { getMarkdownConfig } from "./configs/markdown.mjs";
20
19
  import { getTailwindConfig } from "./configs/tailwind.mjs";
21
20
  import { getStorybookConfig } from "./configs/storybook.mjs";
22
21
  import { getStylisticConfig } from "./configs/stylistic.mjs";
22
+ import { getJavascriptConfig } from "./configs/javascript.mjs";
23
23
  import { getPlaywrightConfig } from "./configs/playwright.mjs";
24
- import { getTypeScriptConfig } from "./configs/typescript.mjs";
24
+ import { getTypescriptConfig } from "./configs/typescript.mjs";
25
25
  import { getPackageJsonConfig } from "./configs/packageJson.mjs";
26
26
  import { getPerfectionistConfig } from "./configs/perfectionist.mjs";
27
27
  import { getIgnorePatterns } from "./helpers/ignores/getIgnorePatterns.mjs";
@@ -64,15 +64,15 @@ import { defineConfig as defineConfig$1, globalIgnores } from "eslint/config";
64
64
  */
65
65
  function defineConfig(...args) {
66
66
  let options = {};
67
- let configs = [];
67
+ let userConfigs = [];
68
68
  const [firstArgument, secondArgument] = args;
69
- if (Array.isArray(firstArgument)) configs = firstArgument;
69
+ if (Array.isArray(firstArgument)) userConfigs = firstArgument;
70
70
  else if (firstArgument) {
71
71
  options = firstArgument;
72
- configs = secondArgument ?? [];
72
+ userConfigs = secondArgument ?? [];
73
73
  }
74
74
  const mergedOptions = mergeWithDefaults(options);
75
- const { gitignore, project: { rules, ignores, settings, linterOptions }, configs: { css, vue, zod, html, next, node, nuxt, react, astro, unicorn, importX, promise, markdown, tailwind, stylistic, typescript, useBaseline, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
75
+ const { gitignore, project: { rules, ignores, settings, linterOptions }, configs: { css, vue, zod, html, next, node, nuxt, react, astro, unicorn, importX, promise, baseline, markdown, tailwind, stylistic, typescript, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
76
76
  const ignorePatterns = getIgnorePatterns({
77
77
  gitignore,
78
78
  patterns: ignores
@@ -85,14 +85,14 @@ function defineConfig(...args) {
85
85
  rules
86
86
  },
87
87
  globalIgnores(ignorePatterns, "shayanthenerd/ignores"),
88
- getBaseConfig(mergedOptions),
89
- isEnabled(typescript) && getTypeScriptConfig(mergedOptions),
88
+ getJavascriptConfig(mergedOptions),
89
+ isEnabled(typescript) && getTypescriptConfig(mergedOptions),
90
90
  isEnabled(unicorn) && getUnicornConfig(mergedOptions),
91
91
  isEnabled(promise) && getPromiseConfig(mergedOptions),
92
92
  isEnabled(importX) && getImportXConfig(mergedOptions),
93
93
  isEnabled(stylistic) && getStylisticConfig(mergedOptions),
94
94
  isEnabled(perfectionist) && getPerfectionistConfig(mergedOptions),
95
- isEnabled(useBaseline) && getBaselineConfig(mergedOptions),
95
+ isEnabled(baseline) && getBaselineConfig(mergedOptions),
96
96
  isEnabled(node) && getNodeConfig(mergedOptions),
97
97
  isEnabled(packageJson) && getPackageJsonConfig(mergedOptions),
98
98
  isEnabled(markdown) && getMarkdownConfig(mergedOptions),
@@ -109,7 +109,7 @@ function defineConfig(...args) {
109
109
  isEnabled(vitest) && getVitestConfig(mergedOptions),
110
110
  isEnabled(cypress) && getCypressConfig(mergedOptions),
111
111
  isEnabled(playwright) && getPlaywrightConfig(mergedOptions),
112
- ...configs
112
+ ...userConfigs
113
113
  ].filter(isTruthy));
114
114
  }
115
115
  //#endregion