@shayanthenerd/eslint-config 0.25.0 → 0.26.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.
Files changed (36) hide show
  1. package/README.md +71 -58
  2. package/dist/configs/base.mjs +1 -1
  3. package/dist/configs/baseline.mjs +22 -0
  4. package/dist/configs/css.mjs +6 -6
  5. package/dist/configs/html.mjs +7 -7
  6. package/dist/configs/next.mjs +20 -0
  7. package/dist/configs/react.mjs +29 -0
  8. package/dist/helpers/globs.mjs +2 -1
  9. package/dist/helpers/ignores/defaultIgnorePatterns.mjs +2 -0
  10. package/dist/helpers/isPackageDetected.mjs +1 -1
  11. package/dist/helpers/options/defaultOptions.mjs +47 -8
  12. package/dist/helpers/options/enableDetectedConfigs.mjs +6 -1
  13. package/dist/index.mjs +11 -5
  14. package/dist/prettier.config.mjs +1 -1
  15. package/dist/rules/astro.mjs +1 -0
  16. package/dist/rules/baseline.mjs +23 -0
  17. package/dist/rules/css.mjs +27 -6
  18. package/dist/rules/html.mjs +7 -7
  19. package/dist/rules/javascript.mjs +1 -2
  20. package/dist/rules/next.mjs +28 -0
  21. package/dist/rules/packageJson.mjs +1 -1
  22. package/dist/rules/react.mjs +160 -0
  23. package/dist/rules/typescript.mjs +1 -0
  24. package/dist/rules/unicorn.mjs +97 -1
  25. package/dist/rules/vue.mjs +2 -2
  26. package/dist/types/eslint-schema.d.mts +2384 -348
  27. package/dist/types/index.d.mts +55 -22
  28. package/dist/types/options/baseline.d.mts +106 -0
  29. package/dist/types/options/nuxt.d.mts +1 -2
  30. package/dist/types/options/react.d.mts +50 -0
  31. package/dist/types/options/stylistic.d.mts +1 -1
  32. package/dist/types/options/test.d.mts +1 -1
  33. package/package.json +21 -16
  34. package/dist/types/options/css.d.mts +0 -27
  35. package/dist/types/options/html.d.mts +0 -27
  36. package/dist/types/options/perfectionist.d.mts +0 -18
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)
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:
@@ -176,6 +175,8 @@ PNPM's strict dependency resolution avoids this issue.
176
175
  > [!NOTE]
177
176
  > 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
177
 
178
+ `configs.useBaseline` is automatically enabled when `autoDetectDeps: true` and `env: 'browser'` (both are the defaults).
179
+
179
180
  To opt out of this behavior, either [globally disable automatic dependency detection](#customization) or manually disable the unwanted integrations that were enabled automatically.
180
181
 
181
182
  ## Framework and Tool Integrations
@@ -464,27 +465,10 @@ _.vscode/settings.json_:
464
465
  overrides?: Overrides,
465
466
  },
466
467
  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
468
  overrides?: Overrides,
484
469
  },
485
470
  html?: boolean | {
486
471
  idNamingConvention?: 'camelCase' | 'kebab-case' | 'PascalCase' | 'snake_case',
487
- useBaseline?: false | number | 'newly' | 'widely',
488
472
  overrides?: Overrides,
489
473
  },
490
474
  importX?: boolean | {
@@ -496,6 +480,9 @@ _.vscode/settings.json_:
496
480
  language?: 'gfm' | 'commonmark',
497
481
  overrides?: Overrides,
498
482
  },
483
+ next?: boolean | {
484
+ overrides?: Overrides,
485
+ },
499
486
  node?: boolean | {
500
487
  overrides?: Overrides,
501
488
  },
@@ -518,6 +505,14 @@ _.vscode/settings.json_:
518
505
  promise?: boolean | {
519
506
  overrides?: Overrides,
520
507
  },
508
+ react?: boolean | {
509
+ accessibility?: boolean | {
510
+ anchorComponents?: string[],
511
+ headingComponents?: string[],
512
+ imageComponents?: string[],
513
+ },
514
+ overrides?: Overrides,
515
+ },
521
516
  stylistic?: boolean | {
522
517
  arrowParens?: 'always' | 'as-needed',
523
518
  indent?: number,
@@ -527,7 +522,7 @@ _.vscode/settings.json_:
527
522
  maxLineLength?: number,
528
523
  memberDelimiterStyle?: 'semi' | 'comma',
529
524
  quotes?: 'double' | 'single' | 'backtick',
530
- selfCloseVoidHTMLElements?: 'never' | 'always',
525
+ selfCloseVoidHtmlElements?: 'never' | 'always',
531
526
  semi?: 'never' | 'always',
532
527
  trailingComma?: 'never' | 'always' | 'only-multiline' | 'always-multiline',
533
528
  overrides?: Overrides,
@@ -573,6 +568,23 @@ _.vscode/settings.json_:
573
568
  unicorn?: boolean | {
574
569
  overrides?: Overrides,
575
570
  },
571
+ useBaseline?: boolean | {
572
+ baseline?: number | 'newly' | 'widely',
573
+ css?: {
574
+ allowedAtRules?: AllowedAtRules,
575
+ allowedFunctions?: AllowedFunctions,
576
+ allowedMediaConditions?: AllowedMediaConditions,
577
+ allowedProperties?: AllowedProperties,
578
+ allowedPropertyValues?: AllowedPropertyValues,
579
+ allowedSelectors?: AllowedSelectors,
580
+ allowedUnits?: AllowedUnits,
581
+ },
582
+ javascript?: {
583
+ ignoredFeatures?: string[],
584
+ ignoredNodeTypes?: string[],
585
+ },
586
+ overrides?: Overrides,
587
+ },
576
588
  vue?: boolean | {
577
589
  accessibility?: boolean | {
578
590
  accessibleChildComponents?: string[],
@@ -646,7 +658,7 @@ You can find a list of all available versions and their changelogs on the [relea
646
658
 
647
659
  ## Roadmap to v1.0.0
648
660
  - [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.
661
+ - [x] Add support for React, Next, Astro, and Markdown.
650
662
  - [ ] Develop an interactive starter wizard to quickly scaffold the configurations for ESLint, Prettier, etc.
651
663
 
652
664
  ## Contribution Guide
@@ -671,20 +683,21 @@ This project was inspired by the work of [Anthony Fu][antfu], whose generous con
671
683
 
672
684
  <!-- ESLint Plugins -->
673
685
  [plugin-astro]: https://ota-meshi.github.io/eslint-plugin-astro
686
+ [plugin-baseline]: https://baselinejs.vercel.app
674
687
  [plugin-css]: https://github.com/eslint/css
675
688
  [plugin-cypress]: https://github.com/cypress-io/eslint-plugin-cypress
676
689
  [plugin-html]: https://html-eslint.org
690
+ [plugin-html-react]: https://html-eslint.org/docs/react/getting-started
677
691
  [plugin-import-x]: https://github.com/un-ts/eslint-plugin-import-x
678
692
  [plugin-jsx-a11y]: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y
679
693
  [plugin-md]: https://github.com/eslint/markdown
680
694
  [plugin-n]: https://github.com/eslint-community/eslint-plugin-n
681
- [plugin-next]: https://nextjs.org/docs/app/api-reference/config/eslint#eslint-plugin
695
+ [plugin-next]: https://github.com/vercel/next.js/tree/HEAD/packages/eslint-plugin-next
682
696
  [plugin-package-json]: https://github.com/JoshuaKGoldberg/eslint-plugin-package-json
683
697
  [plugin-perfectionist]: https://perfectionist.dev
684
698
  [plugin-playwright]: https://github.com/mskelton/eslint-plugin-playwright
685
699
  [plugin-promise]: https://github.com/eslint-community/eslint-plugin-promise
686
700
  [plugin-react]: https://eslint-react.xyz
687
- [plugin-react-hooks]: https://react.dev/reference/eslint-plugin-react-hooks
688
701
  [plugin-storybook]: https://storybook.js.org/docs/configure/integration/eslint-plugin
689
702
  [plugin-stylistic]: https://eslint.style
690
703
  [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
14
  files: [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,7 +6,9 @@ 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",
11
+ "**/routeTree.gen.ts",
10
12
  "**/auto-import?(s).d.ts",
11
13
  "**/out",
12
14
  "**/dist",
@@ -7,7 +7,7 @@ const detectedPackages = [];
7
7
  function logDetectedPackages() {
8
8
  if (detectedPackages.length > 0) {
9
9
  detectedPackages.sort();
10
- console.info(`${styleText("green", "✔")} Active ESLint integrations:`, detectedPackages.map((packageName) => styleText("blue", packageName)).join(", "));
10
+ console.info(`${styleText("green", "✔")} ESLint integrations enabled via dependency detection:`, detectedPackages.map((packageName) => styleText("blue", packageName)).join(", "));
11
11
  }
12
12
  }
13
13
  function isPackageDetected(packageName, options) {
@@ -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 };