@shayanthenerd/eslint-config 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,8 +4,8 @@ ESLint configuration for enforcing best practices and maintaining a consistent c
4
4
 
5
5
  - **Flexible**: [Highly-customizable options](#customization) and configurations with sensible defaults.
6
6
  - **Smart**: Context-aware linting with [automatic dependency detection](#automatic-dependency-detection) and _.gitignore_ recognition.
7
- - **Comprehensive**: [Supports popular plugins](#plugin-support) for TypeScript, Astro, Vue & Nuxt, Tailwind, Zod, Vitest, Markdown, and more.
8
- - **Type-safe**: [Fully-typed and well-documented API](#api-reference) with `overrides` support for every built-in configuration object.
7
+ - **Comprehensive**: [Supports useful plugins](#plugin-support) for TypeScript, React & Next, Vue & Nuxt, Astro, Tailwind, and more.
8
+ - **Type-safe**: [Fully-typed and well-documented API](#api-reference) with `overrides` support for built-in configuration objects.
9
9
  - **Modern**: Requires ESLint ^10.4.0 and Node.js ^20.19.0 (ESM-only)
10
10
 
11
11
  ## Table of Contents
@@ -25,41 +25,40 @@ ESLint configuration for enforcing best practices and maintaining a consistent c
25
25
 
26
26
  ## Plugin Support
27
27
  Legend:
28
- - ✅ Supported
29
- - ⌛️ In progress
30
- - ◻️ Enabled by default
31
- - ⬛ Disabled by default
32
- - 🔎 [Automatically detected](#automatic-dependency-detection) (`autoDetectDeps: true`)
33
-
34
- | Category | Support | Activation |
35
- | :----------------------------------------------------------- | :-----: | :----: |
36
- | **Languages** | | |
37
- | [JavaScript][eslint] | | ◻️  |
38
- | [TypeScript][plugin-ts] | ✅  | 🔎  |
39
- | [Markdown][plugin-md] | ✅  | ◻️  |
40
- | [HTML][plugin-html] | ✅  | ⬛  |
41
- | [CSS][plugin-css] | | ⬛  |
42
- | **Formatting** | | |
43
- | [Stylistic][plugin-stylistic] | ✅  | ◻️  |
44
- | [Perfectionist][plugin-perfectionist] | ✅  | ◻️  |
45
- | **Frameworks** | | |
46
- | [Astro][plugin-astro] ([JSX accessibility][plugin-jsx-a11y]) | ✅  | 🔎|
47
- | [React][plugin-react] ([hooks][plugin-react-hooks]) | ⌛️  | N/A |
48
- | [Next][plugin-next] | ⌛️  | N/A |
49
- | [Vue & Nuxt][plugin-vue] ([accessibility][plugin-vue-a11y]) | ✅  | 🔎|
50
- | [Tailwind][plugin-tailwind] | ✅  | ⬛  |
51
- | **Testing Tools** | | |
52
- | [Storybook][plugin-storybook] | ✅  | 🔎|
53
- | [Vitest][plugin-vitest] | ✅  | 🔎|
54
- | [Cypress][plugin-cypress] | ✅  | 🔎|
55
- | [Playwright][plugin-playwright] | ✅  | 🔎  |
56
- | **Miscellaneous** | | |
57
- | [_package.json_][plugin-package-json] | | ◻️  |
58
- | [promises][plugin-promise] | | ◻️  |
59
- | [Imports][plugin-import-x] | | ◻️  |
60
- | [Zod][plugin-zod] | | 🔎  |
61
- | [Node][plugin-n] | ✅  | ◻️  |
62
- | [Unicorn][plugin-unicorn] | ⌛️  | N/A |
28
+ - ✅ Enabled by default
29
+ - Disabled by default
30
+ - 🔎 [Automatically detected](#automatic-dependency-detection) (`autoDetectDeps: true`, `env: 'browser'` for Baseline)
31
+
32
+ | Category | Activation |
33
+ | :---------------------------------------------------------------------------------------------------- | :--------: |
34
+ | **Languages** | |
35
+ | [JavaScript][eslint] | ✅  |
36
+ | [TypeScript][plugin-ts] | 🔎  |
37
+ | [Markdown][plugin-md] | |
38
+ | [HTML][plugin-html] | ❌  |
39
+ | [CSS][plugin-css] | ❌  |
40
+ | **Formatting** | |
41
+ | [Stylistic][plugin-stylistic] | |
42
+ | [Perfectionist][plugin-perfectionist] | ✅  |
43
+ | **Frameworks & Libraries** | |
44
+ | [Astro][plugin-astro] ([jsx-accessibility][plugin-jsx-a11y]) | 🔎  |
45
+ | [React][plugin-react] ([jsx-accessibility][plugin-jsx-a11y], [@html-eslint/react][plugin-html-react]) | 🔎  |
46
+ | [Next][plugin-next] | 🔎|
47
+ | [Vue & Nuxt][plugin-vue] ([vue-accessibility][plugin-vue-a11y]) | 🔎  |
48
+ | [Tailwind][plugin-tailwind] | ❌  |
49
+ | [Zod & Zod Mini][plugin-zod] | 🔎|
50
+ | **Testing Tools** | |
51
+ | [Storybook][plugin-storybook] | 🔎  |
52
+ | [Vitest][plugin-vitest] | 🔎|
53
+ | [Cypress][plugin-cypress] | 🔎|
54
+ | [Playwright][plugin-playwright] | 🔎|
55
+ | **Miscellaneous** | |
56
+ | [_package.json_][plugin-package-json] | ✅  |
57
+ | [Node][plugin-n] | |
58
+ | [Promises][plugin-promise] | |
59
+ | [Imports][plugin-import-x] | |
60
+ | [Unicorn][plugin-unicorn] | |
61
+ | [Baseline][plugin-baseline] | 🔎  |
63
62
 
64
63
  ## Installation and Configuration
65
64
  1. Install the package and ESLint as dev dependencies:
@@ -464,27 +463,10 @@ _.vscode/settings.json_:
464
463
  overrides?: Overrides,
465
464
  },
466
465
  css?: boolean | {
467
- allowedRelativeFontUnits?: (
468
- | '%'
469
- | 'ch'
470
- | 'em'
471
- | 'ex'
472
- | 'ic'
473
- | 'lh'
474
- | 'cap'
475
- | 'rch'
476
- | 'rem'
477
- | 'rex'
478
- | 'ric'
479
- | 'rlh'
480
- | 'rcap'
481
- )[],
482
- useBaseline?: false | number | 'newly' | 'widely',
483
466
  overrides?: Overrides,
484
467
  },
485
468
  html?: boolean | {
486
469
  idNamingConvention?: 'camelCase' | 'kebab-case' | 'PascalCase' | 'snake_case',
487
- useBaseline?: false | number | 'newly' | 'widely',
488
470
  overrides?: Overrides,
489
471
  },
490
472
  importX?: boolean | {
@@ -496,6 +478,9 @@ _.vscode/settings.json_:
496
478
  language?: 'gfm' | 'commonmark',
497
479
  overrides?: Overrides,
498
480
  },
481
+ next?: boolean | {
482
+ overrides?: Overrides,
483
+ },
499
484
  node?: boolean | {
500
485
  overrides?: Overrides,
501
486
  },
@@ -518,6 +503,14 @@ _.vscode/settings.json_:
518
503
  promise?: boolean | {
519
504
  overrides?: Overrides,
520
505
  },
506
+ react?: boolean | {
507
+ accessibility?: boolean | {
508
+ anchorComponents?: string[],
509
+ headingComponents?: string[],
510
+ imageComponents?: string[],
511
+ },
512
+ overrides?: Overrides,
513
+ },
521
514
  stylistic?: boolean | {
522
515
  arrowParens?: 'always' | 'as-needed',
523
516
  indent?: number,
@@ -527,7 +520,7 @@ _.vscode/settings.json_:
527
520
  maxLineLength?: number,
528
521
  memberDelimiterStyle?: 'semi' | 'comma',
529
522
  quotes?: 'double' | 'single' | 'backtick',
530
- selfCloseVoidHTMLElements?: 'never' | 'always',
523
+ selfCloseVoidHtmlElements?: 'never' | 'always',
531
524
  semi?: 'never' | 'always',
532
525
  trailingComma?: 'never' | 'always' | 'only-multiline' | 'always-multiline',
533
526
  overrides?: Overrides,
@@ -573,6 +566,23 @@ _.vscode/settings.json_:
573
566
  unicorn?: boolean | {
574
567
  overrides?: Overrides,
575
568
  },
569
+ useBaseline?: boolean | {
570
+ baseline?: number | 'newly' | 'widely',
571
+ css?: {
572
+ allowedAtRules?: AllowedAtRules,
573
+ allowedFunctions?: AllowedFunctions,
574
+ allowedMediaConditions?: AllowedMediaConditions,
575
+ allowedProperties?: AllowedProperties,
576
+ allowedPropertyValues?: AllowedPropertyValues,
577
+ allowedSelectors?: AllowedSelectors,
578
+ allowedUnits?: AllowedUnits,
579
+ },
580
+ javascript?: {
581
+ ignoredFeatures?: string[],
582
+ ignoredNodeTypes?: string[],
583
+ },
584
+ overrides?: Overrides,
585
+ },
576
586
  vue?: boolean | {
577
587
  accessibility?: boolean | {
578
588
  accessibleChildComponents?: string[],
@@ -646,7 +656,7 @@ You can find a list of all available versions and their changelogs on the [relea
646
656
 
647
657
  ## Roadmap to v1.0.0
648
658
  - [x] Add integration for ESLint plugins such as [eslint-plugin-n][plugin-n], [eslint-plugin-unicorn][plugin-unicorn], and more.
649
- - [ ] Add support for other React, Next, Astro, and Markdown.
659
+ - [x] Add support for React, Next, Astro, and Markdown.
650
660
  - [ ] Develop an interactive starter wizard to quickly scaffold the configurations for ESLint, Prettier, etc.
651
661
 
652
662
  ## Contribution Guide
@@ -671,20 +681,21 @@ This project was inspired by the work of [Anthony Fu][antfu], whose generous con
671
681
 
672
682
  <!-- ESLint Plugins -->
673
683
  [plugin-astro]: https://ota-meshi.github.io/eslint-plugin-astro
684
+ [plugin-baseline]: https://baselinejs.vercel.app
674
685
  [plugin-css]: https://github.com/eslint/css
675
686
  [plugin-cypress]: https://github.com/cypress-io/eslint-plugin-cypress
676
687
  [plugin-html]: https://html-eslint.org
688
+ [plugin-html-react]: https://html-eslint.org/docs/react/getting-started
677
689
  [plugin-import-x]: https://github.com/un-ts/eslint-plugin-import-x
678
690
  [plugin-jsx-a11y]: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
679
691
  [plugin-md]: https://github.com/eslint/markdown
680
692
  [plugin-n]: https://github.com/eslint-community/eslint-plugin-n
681
- [plugin-next]: https://nextjs.org/docs/app/api-reference/config/eslint#eslint-plugin
693
+ [plugin-next]: https://github.com/vercel/next.js/tree/HEAD/packages/eslint-plugin-next
682
694
  [plugin-package-json]: https://github.com/JoshuaKGoldberg/eslint-plugin-package-json
683
695
  [plugin-perfectionist]: https://perfectionist.dev
684
696
  [plugin-playwright]: https://github.com/mskelton/eslint-plugin-playwright
685
697
  [plugin-promise]: https://github.com/eslint-community/eslint-plugin-promise
686
698
  [plugin-react]: https://eslint-react.xyz
687
- [plugin-react-hooks]: https://react.dev/reference/eslint-plugin-react-hooks
688
699
  [plugin-storybook]: https://storybook.js.org/docs/configure/integration/eslint-plugin
689
700
  [plugin-stylistic]: https://eslint.style
690
701
  [plugin-tailwind]: https://github.com/schoero/eslint-plugin-better-tailwindcss
@@ -26,7 +26,7 @@ function getBaseConfig(options) {
26
26
  },
27
27
  globals: {
28
28
  ...globals.builtin,
29
- ...globals.es2026,
29
+ ...globals.es2027,
30
30
  ...worker && globals.worker,
31
31
  ...commonjs && globals.commonjs,
32
32
  ...bun && env === "bun" && globals.bunBuiltin,
@@ -0,0 +1,22 @@
1
+ import { isTruthy } from "../utils/isTruthy.mjs";
2
+ import { globs } from "../helpers/globs.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { getBaselineRules } from "../rules/baseline.mjs";
5
+ import eslintPluginBaselineJs from "eslint-plugin-baseline-js";
6
+ //#region src/configs/baseline.ts
7
+ function getBaselineConfig(options) {
8
+ const { vue, astro } = options.configs;
9
+ return {
10
+ name: "shayanthenerd/baseline",
11
+ files: [
12
+ globs.src,
13
+ isEnabled(vue) ? globs.vue : "",
14
+ isEnabled(astro) ? globs.astro : ""
15
+ ].filter(isTruthy),
16
+ ignores: [globs.test, globs.coverage],
17
+ plugins: { "baseline-js": eslintPluginBaselineJs },
18
+ rules: getBaselineRules(options)
19
+ };
20
+ }
21
+ //#endregion
22
+ export { getBaselineConfig };
@@ -1,26 +1,26 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
2
  import { isEnabled } from "../utils/isEnabled.mjs";
3
3
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
4
- import { getCSSRules } from "../rules/css.mjs";
5
- import eslintPluginCSS from "@eslint/css";
4
+ import { getCssRules } from "../rules/css.mjs";
5
+ import eslintPluginCss from "@eslint/css";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import { tailwind3, tailwind4 } from "tailwind-csstree";
8
8
  //#region src/configs/css.ts
9
- function getCSSConfig(options) {
9
+ function getCssConfig(options) {
10
10
  const { css, tailwind } = options.configs;
11
11
  const { overrides } = isEnabled(css) ? css : defaultOptions.configs.css;
12
12
  const tailwindSyntax = isEnabled(tailwind) && tailwind.entryPoint ? tailwind4 : tailwind3;
13
13
  return mergeConfigs({
14
14
  name: "shayanthenerd/css",
15
15
  files: [globs.css],
16
- plugins: { css: eslintPluginCSS },
16
+ plugins: { css: eslintPluginCss },
17
17
  language: "css/css",
18
18
  languageOptions: {
19
19
  tolerant: true,
20
20
  customSyntax: isEnabled(tailwind) ? tailwindSyntax : void 0
21
21
  },
22
- rules: getCSSRules(options)
22
+ rules: getCssRules(options)
23
23
  }, overrides);
24
24
  }
25
25
  //#endregion
26
- export { getCSSConfig };
26
+ export { getCssConfig };
@@ -1,24 +1,24 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
2
  import { isEnabled } from "../utils/isEnabled.mjs";
3
3
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
4
- import { getHTMLRules } from "../rules/html.mjs";
4
+ import { getHtmlRules } from "../rules/html.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginUnicorn from "eslint-plugin-unicorn";
7
- import eslintPluginHTML from "@html-eslint/eslint-plugin";
7
+ import eslintPluginHtml from "@html-eslint/eslint-plugin";
8
8
  //#region src/configs/html.ts
9
- function getHTMLConfig(options) {
9
+ function getHtmlConfig(options) {
10
10
  const { html, unicorn } = options.configs;
11
11
  const { overrides } = isEnabled(html) ? html : defaultOptions.configs.html;
12
12
  return mergeConfigs({
13
13
  name: "shayanthenerd/html",
14
- files: [globs.html],
14
+ files: [globs.src, globs.html],
15
15
  plugins: {
16
- "@html-eslint": eslintPluginHTML,
16
+ "@html-eslint": eslintPluginHtml,
17
17
  ...isEnabled(unicorn) && { unicorn: eslintPluginUnicorn }
18
18
  },
19
- languageOptions: { parser: eslintPluginHTML.configs["flat/recommended"].languageOptions.parser },
20
- rules: getHTMLRules(options)
19
+ languageOptions: { parser: eslintPluginHtml.configs["flat/recommended"].languageOptions.parser },
20
+ rules: getHtmlRules(options)
21
21
  }, overrides);
22
22
  }
23
23
  //#endregion
24
- export { getHTMLConfig };
24
+ export { getHtmlConfig };
@@ -0,0 +1,20 @@
1
+ import { globs } from "../helpers/globs.mjs";
2
+ import { isEnabled } from "../utils/isEnabled.mjs";
3
+ import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
4
+ import { getNextRules } from "../rules/next.mjs";
5
+ import { mergeConfigs } from "eslint-flat-config-utils";
6
+ import eslintPluginNext from "@next/eslint-plugin-next";
7
+ //#region src/configs/next.ts
8
+ function getNextConfig(options) {
9
+ const { packageDir, configs: { next } } = options;
10
+ const { overrides } = isEnabled(next) ? next : defaultOptions.configs.next;
11
+ return mergeConfigs({
12
+ name: "shayanthenerd/next",
13
+ files: [globs.src],
14
+ plugins: { next: eslintPluginNext },
15
+ settings: { next: { rootDir: packageDir } },
16
+ rules: getNextRules()
17
+ }, overrides);
18
+ }
19
+ //#endregion
20
+ export { getNextConfig };
@@ -0,0 +1,29 @@
1
+ import { globs } from "../helpers/globs.mjs";
2
+ import { isEnabled } from "../utils/isEnabled.mjs";
3
+ import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
4
+ import { getReactRules } from "../rules/react.mjs";
5
+ import { mergeConfigs } from "eslint-flat-config-utils";
6
+ import eslintPluginUnicorn from "eslint-plugin-unicorn";
7
+ import eslintPluginJsxA11y from "eslint-plugin-jsx-a11y";
8
+ import eslintPluginReact from "@eslint-react/eslint-plugin";
9
+ import eslintPluginHtmlReact from "@html-eslint/eslint-plugin-react";
10
+ //#region src/configs/react.ts
11
+ function getReactConfig(options) {
12
+ const { react, unicorn } = options.configs;
13
+ const { overrides, accessibility } = isEnabled(react) ? react : defaultOptions.configs.react;
14
+ return mergeConfigs({
15
+ name: "shayanthenerd/react",
16
+ files: [globs.src],
17
+ plugins: {
18
+ "@eslint-react": eslintPluginReact,
19
+ ...isEnabled(unicorn) && { unicorn: eslintPluginUnicorn },
20
+ ...isEnabled(accessibility) && {
21
+ "jsx-a11y": eslintPluginJsxA11y,
22
+ "@html-eslint/react": eslintPluginHtmlReact
23
+ }
24
+ },
25
+ rules: getReactRules(options)
26
+ }, overrides);
27
+ }
28
+ //#endregion
29
+ export { getReactConfig };
@@ -12,7 +12,8 @@ const globs = {
12
12
  vueServerComponents: `**/*.server.${vueExtensions}`,
13
13
  vueAppErrorLayoutsPages: `**/{{app,error},{layouts,pages}/**/*}.${vueExtensions}`,
14
14
  storybook: `**/*.(story|stories).${srcExtensions}`,
15
- test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${srcExtensions}`
15
+ test: `**/{__tests__/*,*.{test,spec,cy,bench?(mark)}.${srcExtensions}`,
16
+ coverage: "**/coverage/**"
16
17
  };
17
18
  //#endregion
18
19
  export { globs };
@@ -6,6 +6,7 @@ const defaultIgnorePatterns = [
6
6
  "**/bower_components",
7
7
  "**/package-lock.json",
8
8
  "**/typegen.d.ts",
9
+ "**/next-env.d.ts",
9
10
  "**/components.d.ts",
10
11
  "**/auto-import?(s).d.ts",
11
12
  "**/out",
@@ -1,7 +1,7 @@
1
1
  //#region src/helpers/options/defaultOptions.ts
2
2
  const defaultOptions = {
3
3
  autoDetectDeps: true,
4
- env: "node",
4
+ env: "browser",
5
5
  gitignore: ".gitignore",
6
6
  packageDir: ".",
7
7
  project: {
@@ -40,14 +40,9 @@ const defaultOptions = {
40
40
  maxNestedCallbacks: 3,
41
41
  overrides: {}
42
42
  },
43
- css: {
44
- allowedRelativeFontUnits: ["rem", "em"],
45
- useBaseline: false,
46
- overrides: {}
47
- },
43
+ css: { overrides: {} },
48
44
  html: {
49
45
  idNamingConvention: "snake_case",
50
- useBaseline: false,
51
46
  overrides: {}
52
47
  },
53
48
  importX: { overrides: {} },
@@ -57,6 +52,7 @@ const defaultOptions = {
57
52
  language: "gfm",
58
53
  overrides: {}
59
54
  },
55
+ next: { overrides: {} },
60
56
  node: { overrides: {} },
61
57
  nuxt: {
62
58
  icon: { component: "Icon" },
@@ -69,6 +65,32 @@ const defaultOptions = {
69
65
  overrides: {}
70
66
  },
71
67
  promise: { overrides: {} },
68
+ react: {
69
+ accessibility: {
70
+ anchorComponents: [
71
+ "Link",
72
+ "NextLink",
73
+ "NavLink"
74
+ ],
75
+ headingComponents: [
76
+ "H1",
77
+ "H2",
78
+ "H3",
79
+ "H4",
80
+ "H5",
81
+ "H6"
82
+ ],
83
+ imageComponents: [
84
+ "Img",
85
+ "LazyImg",
86
+ "Image",
87
+ "LazyImage",
88
+ "NextImage",
89
+ "LazyNextImage"
90
+ ]
91
+ },
92
+ overrides: {}
93
+ },
72
94
  stylistic: {
73
95
  arrowParens: "always",
74
96
  indent: 2,
@@ -79,7 +101,7 @@ const defaultOptions = {
79
101
  memberDelimiterStyle: "comma",
80
102
  quotes: "single",
81
103
  semi: "always",
82
- selfCloseVoidHTMLElements: "always",
104
+ selfCloseVoidHtmlElements: "always",
83
105
  trailingComma: "always-multiline",
84
106
  overrides: {}
85
107
  },
@@ -107,6 +129,23 @@ const defaultOptions = {
107
129
  overrides: {}
108
130
  },
109
131
  unicorn: { overrides: {} },
132
+ useBaseline: {
133
+ baseline: "widely",
134
+ css: {
135
+ allowedAtRules: [],
136
+ allowedFunctions: [],
137
+ allowedMediaConditions: [],
138
+ allowedProperties: [],
139
+ allowedPropertyValues: {},
140
+ allowedSelectors: [],
141
+ allowedUnits: []
142
+ },
143
+ javascript: {
144
+ ignoredFeatures: [],
145
+ ignoredNodeTypes: []
146
+ },
147
+ overrides: {}
148
+ },
110
149
  vue: {
111
150
  accessibility: {
112
151
  accessibleChildComponents: [
@@ -5,6 +5,8 @@ function enableDetectedConfigs(options) {
5
5
  typescript: isPackageDetected("typescript", options),
6
6
  zod: isPackageDetected("zod", options),
7
7
  astro: isPackageDetected("astro", options),
8
+ react: isPackageDetected("react", options),
9
+ next: isPackageDetected("next", options),
8
10
  vue: isPackageDetected("vue", options),
9
11
  nuxt: isPackageDetected("nuxt", options),
10
12
  nuxtUI: isPackageDetected("@nuxt/ui", options),
@@ -27,11 +29,14 @@ function enableDetectedConfigs(options) {
27
29
  options.configs.importX ??= true;
28
30
  options.configs.stylistic ??= true;
29
31
  options.configs.perfectionist ??= true;
32
+ options.configs.useBaseline ??= options.env === "browser";
30
33
  options.configs.typescript ??= autoDetectedDeps.typescript;
31
34
  options.configs.zod ??= autoDetectedDeps.zod;
35
+ options.configs.astro ??= autoDetectedDeps.astro;
32
36
  options.configs.vue ??= autoDetectedDeps.vue;
33
37
  options.configs.nuxt ??= autoDetectedDeps.nuxt;
34
- options.configs.astro ??= autoDetectedDeps.astro;
38
+ options.configs.react ??= autoDetectedDeps.react;
39
+ options.configs.next ??= autoDetectedDeps.next;
35
40
  options.configs.test.vitest ??= autoDetectedDeps.vitest;
36
41
  options.configs.test.cypress ??= autoDetectedDeps.cypress;
37
42
  options.configs.test.storybook ??= autoDetectedDeps.storybook;
package/dist/index.mjs CHANGED
@@ -1,17 +1,20 @@
1
1
  import { isTruthy } from "./utils/isTruthy.mjs";
2
2
  import { isEnabled } from "./utils/isEnabled.mjs";
3
- import { getCSSConfig } from "./configs/css.mjs";
3
+ import { getCssConfig } from "./configs/css.mjs";
4
4
  import { getVueConfig } from "./configs/vue.mjs";
5
5
  import { getZodConfig } from "./configs/zod.mjs";
6
6
  import { getBaseConfig } from "./configs/base.mjs";
7
- import { getHTMLConfig } from "./configs/html.mjs";
7
+ import { getHtmlConfig } from "./configs/html.mjs";
8
+ import { getNextConfig } from "./configs/next.mjs";
8
9
  import { getNodeConfig } from "./configs/node.mjs";
9
10
  import { getAstroConfig } from "./configs/astro.mjs";
11
+ import { getReactConfig } from "./configs/react.mjs";
10
12
  import { getVitestConfig } from "./configs/vitest.mjs";
11
13
  import { getCypressConfig } from "./configs/cypress.mjs";
12
14
  import { getImportXConfig } from "./configs/importX.mjs";
13
15
  import { getPromiseConfig } from "./configs/promise.mjs";
14
16
  import { getUnicornConfig } from "./configs/unicorn.mjs";
17
+ import { getBaselineConfig } from "./configs/baseline.mjs";
15
18
  import { getMarkdownConfig } from "./configs/markdown.mjs";
16
19
  import { getTailwindConfig } from "./configs/tailwind.mjs";
17
20
  import { getStorybookConfig } from "./configs/storybook.mjs";
@@ -70,7 +73,7 @@ function defineConfig(...args) {
70
73
  configs = secondArgument ?? [];
71
74
  }
72
75
  const mergedOptions = mergeWithDefaults(options);
73
- const { gitignore, project: { rules, ignores, settings, linterOptions }, configs: { css, vue, zod, html, node, nuxt, astro, unicorn, importX, promise, markdown, tailwind, stylistic, typescript, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
76
+ 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;
74
77
  const ignorePatterns = getIgnorePatterns({
75
78
  gitignore,
76
79
  patterns: ignores
@@ -90,14 +93,17 @@ function defineConfig(...args) {
90
93
  isEnabled(importX) && getImportXConfig(mergedOptions),
91
94
  isEnabled(stylistic) && getStylisticConfig(mergedOptions),
92
95
  isEnabled(perfectionist) && getPerfectionistConfig(mergedOptions),
96
+ isEnabled(useBaseline) && getBaselineConfig(mergedOptions),
93
97
  isEnabled(node) && getNodeConfig(mergedOptions),
94
98
  isEnabled(packageJson) && getPackageJsonConfig(mergedOptions),
95
99
  isEnabled(markdown) && getMarkdownConfig(mergedOptions),
96
- isEnabled(html) && getHTMLConfig(mergedOptions),
97
- isEnabled(css) && getCSSConfig(mergedOptions),
100
+ isEnabled(html) && getHtmlConfig(mergedOptions),
101
+ isEnabled(css) && getCssConfig(mergedOptions),
98
102
  isEnabled(tailwind) && getTailwindConfig(mergedOptions),
99
103
  isEnabled(zod) && getZodConfig(mergedOptions),
100
104
  isEnabled(astro) && getAstroConfig(mergedOptions),
105
+ isEnabled(react) && getReactConfig(mergedOptions),
106
+ isEnabled(next) && getNextConfig(mergedOptions),
101
107
  isEnabled(vue) && getVueConfig(mergedOptions),
102
108
  isEnabled(vue) && getVueComponentNamesConfig(),
103
109
  isEnabled(vue) && isEnabled(nuxt) && getVueServerComponentsConfig(),
@@ -14,7 +14,7 @@ const prettierConfig = {
14
14
  printWidth: 120,
15
15
  proseWrap: "preserve",
16
16
  quoteProps: "consistent",
17
- rangeEnd: Number.POSITIVE_INFINITY,
17
+ rangeEnd: Infinity,
18
18
  rangeStart: 0,
19
19
  requirePragma: false,
20
20
  semi: true,
@@ -16,6 +16,7 @@ const astroRules = {
16
16
  "astro/no-unsafe-inline-scripts": "warn",
17
17
  "astro/no-set-text-directive": "warn",
18
18
  "astro/no-unused-css-selector": "warn",
19
+ "astro/no-omitted-end-tags": "warn",
19
20
  "astro/prefer-class-list-directive": "warn",
20
21
  "astro/prefer-split-class-list": "warn",
21
22
  "astro/jsx-a11y/alt-text": "error",
@@ -0,0 +1,23 @@
1
+ import { isEnabled } from "../utils/isEnabled.mjs";
2
+ import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ //#region src/rules/baseline.ts
4
+ function getBaselineRules(options) {
5
+ const { useBaseline } = options.configs;
6
+ const { baseline, javascript: { ignoredFeatures: userIgnoredFeatures, ignoredNodeTypes: userIgnoredNodeTypes } } = isEnabled(useBaseline) ? useBaseline : defaultOptions.configs.useBaseline;
7
+ return {
8
+ "baseline-js/no-atomics-pause": "warn",
9
+ "baseline-js/no-bigint64array": "warn",
10
+ "baseline-js/no-function-caller-arguments": "warn",
11
+ "baseline-js/no-math-sum-precise": "warn",
12
+ "baseline-js/no-temporal": "warn",
13
+ "baseline-js/use-baseline": ["warn", {
14
+ baseline,
15
+ includeWebApis: { preset: "auto" },
16
+ includeJsBuiltins: { preset: "auto" },
17
+ ignoreFeatures: userIgnoredFeatures,
18
+ ignoreNodeTypes: userIgnoredNodeTypes
19
+ }]
20
+ };
21
+ }
22
+ //#endregion
23
+ export { getBaselineRules };
@@ -45,9 +45,9 @@ const allowedPhysicalProperties = [
45
45
  "contain-intrinsic-width",
46
46
  "contain-intrinsic-height"
47
47
  ];
48
- function getCSSRules(options) {
49
- const { css } = options.configs;
50
- const { useBaseline, allowedRelativeFontUnits } = isEnabled(css) ? css : defaultOptions.configs.css;
48
+ function getCssRules(options) {
49
+ const { useBaseline } = options.configs;
50
+ const { allowedAtRules: userAllowedAtRules, allowedFunctions: userAllowedFunctions, allowedMediaConditions: userAllowedMediaConditions, allowedProperties: userAllowedProperties, allowedPropertyValues: userAllowedPropertyValues, allowedSelectors: userAllowedSelectors, allowedUnits: userAllowedUnits } = isEnabled(useBaseline) ? useBaseline.css : defaultOptions.configs.useBaseline.css;
51
51
  return {
52
52
  "css/font-family-fallbacks": "warn",
53
53
  "css/no-duplicate-imports": "error",
@@ -63,9 +63,30 @@ function getCSSRules(options) {
63
63
  allowUnits: allowedPhysicalUnits,
64
64
  allowProperties: allowedPhysicalProperties
65
65
  }],
66
- "css/relative-font-units": ["warn", { allowUnits: allowedRelativeFontUnits }],
67
- "css/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off"
66
+ "css/relative-font-units": ["warn", { allowUnits: [
67
+ "cap",
68
+ "ch",
69
+ "em",
70
+ "ex",
71
+ "ic",
72
+ "lh",
73
+ "rcap",
74
+ "rch",
75
+ "rem",
76
+ "ric",
77
+ "rlh"
78
+ ] }],
79
+ "css/use-baseline": isEnabled(useBaseline) ? ["warn", {
80
+ available: useBaseline.baseline,
81
+ allowAtRules: userAllowedAtRules,
82
+ allowFunctions: userAllowedFunctions,
83
+ allowMediaConditions: userAllowedMediaConditions,
84
+ allowProperties: userAllowedProperties,
85
+ allowPropertyValues: userAllowedPropertyValues,
86
+ allowSelectors: userAllowedSelectors,
87
+ allowUnits: userAllowedUnits
88
+ }] : "off"
68
89
  };
69
90
  }
70
91
  //#endregion
71
- export { getCSSRules };
92
+ export { getCssRules };