@shayanthenerd/eslint-config 0.30.3 β†’ 0.32.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.
Files changed (48) hide show
  1. package/README.md +15 -5
  2. package/dist/configs/astro.mjs +6 -5
  3. package/dist/configs/baseline.mjs +1 -1
  4. package/dist/configs/css.mjs +5 -4
  5. package/dist/configs/cypress.mjs +4 -3
  6. package/dist/configs/html.mjs +4 -3
  7. package/dist/configs/importX.mjs +5 -4
  8. package/dist/configs/javascript.mjs +5 -4
  9. package/dist/configs/markdown.mjs +4 -3
  10. package/dist/configs/next.mjs +4 -3
  11. package/dist/configs/node.mjs +6 -5
  12. package/dist/configs/nuxt.mjs +23 -22
  13. package/dist/configs/packageJson.mjs +4 -3
  14. package/dist/configs/perfectionist.mjs +5 -4
  15. package/dist/configs/playwright.mjs +4 -3
  16. package/dist/configs/promise.mjs +5 -4
  17. package/dist/configs/react.mjs +4 -3
  18. package/dist/configs/storybook.mjs +4 -3
  19. package/dist/configs/stylistic.mjs +5 -4
  20. package/dist/configs/tailwind.mjs +5 -4
  21. package/dist/configs/tanstack.mjs +26 -0
  22. package/dist/configs/typescript.mjs +5 -4
  23. package/dist/configs/unicorn.mjs +5 -4
  24. package/dist/configs/vitest.mjs +4 -3
  25. package/dist/configs/vue.mjs +5 -4
  26. package/dist/configs/zod.mjs +5 -4
  27. package/dist/helpers/options/defaultOptions.mjs +6 -0
  28. package/dist/helpers/options/enableDetectedConfigs.mjs +11 -1
  29. package/dist/helpers/options/mergeWithDefaults.mjs +1 -1
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.mjs +22 -53
  32. package/dist/rules/baseline.mjs +1 -1
  33. package/dist/rules/css.mjs +1 -1
  34. package/dist/rules/html.mjs +1 -1
  35. package/dist/rules/markdown.mjs +1 -1
  36. package/dist/rules/perfectionist.mjs +8 -13
  37. package/dist/rules/react.mjs +1 -1
  38. package/dist/rules/stylistic.mjs +4 -2
  39. package/dist/rules/tailwind.mjs +1 -1
  40. package/dist/rules/tanstack.mjs +39 -0
  41. package/dist/rules/typescript.mjs +2 -2
  42. package/dist/rules/unicorn.mjs +1 -1
  43. package/dist/rules/vue.mjs +4 -3
  44. package/dist/rules/zod.mjs +1 -1
  45. package/dist/types/eslint-schema.d.mts +678 -430
  46. package/dist/types/index.d.mts +15 -6
  47. package/dist/types/options/tanstack.d.mts +32 -0
  48. package/package.json +23 -18
package/README.md CHANGED
@@ -43,6 +43,7 @@ Legend:
43
43
  | [Astro][plugin-astro] ([jsx-accessibility][plugin-jsx-a11y]) | πŸ”β€‰ |
44
44
  | [React][plugin-react] ([jsx-accessibility][plugin-jsx-a11y], [@html-eslint/react][plugin-html-react]) | πŸ”β€‰ |
45
45
  | [Next][plugin-next] | πŸ”β€‰ |
46
+ | [TanStack Start][plugin-tanstack-start], [TanStack Query][plugin-tanstack-query], [TanStack Router][plugin-tanstack-router] | πŸ”β€‰ |
46
47
  | [Vue & Nuxt][plugin-vue] ([vue-accessibility][plugin-vue-a11y]) | πŸ”β€‰ |
47
48
  | [Tailwind][plugin-tailwind] | βš™οΈβ€‰ |
48
49
  | [Zod & Zod Mini][plugin-zod] | πŸ”β€‰ |
@@ -62,7 +63,7 @@ Legend:
62
63
  ## Installation and Configuration
63
64
  1. Install the package and ESLint as dev dependencies:
64
65
  ```shell
65
- npm i -D @shayanthenerd/eslint-config eslint
66
+ pnpm i -D @shayanthenerd/eslint-config eslint
66
67
  ```
67
68
 
68
69
  2. Create an ESLint configuration file (_eslint.config.js_) at the root of your project:
@@ -88,9 +89,9 @@ Legend:
88
89
  ---
89
90
 
90
91
  After installation:
91
- - Use `npm run lint` to lint files without modifying them (useful for CI).
92
- - Use `npm run lint:fix` to lint and fix files.
93
- - Use `npm run lint:inspect` to see a visual breakdown of your configuration.
92
+ - Use `pnpm run lint` to lint files without modifying them (useful for CI).
93
+ - Use `pnpm run lint:fix` to lint and fix files.
94
+ - Use `pnpm run lint:inspect` to see a visual breakdown of your configuration.
94
95
  - See [IDE Support](#ide-support) for editor integration.
95
96
  - See [Customization](#customization) for advanced configuration.
96
97
  - See [Formatting](#formatting) for formatting options and Prettier integration.
@@ -313,7 +314,7 @@ For file types that ESLint Stylistic does not handleβ€”such as CSS, JSON, YAML,
313
314
 
314
315
  1. Install Prettier as a dev dependency:
315
316
  ```shell
316
- npm i -D prettier
317
+ pnpm i -D prettier
317
318
  ```
318
319
 
319
320
  2. Create a Prettier config file in the root of your project (_prettier.config.js_):
@@ -619,6 +620,12 @@ For file types that ESLint Stylistic does not handleβ€”such as CSS, JSON, YAML,
619
620
  multilineSort?: boolean,
620
621
  overrides?: Overrides,
621
622
  },
623
+ tanstack?: boolean | {
624
+ query?: boolean,
625
+ router?: boolean,
626
+ start?: boolean,
627
+ overrides?: Overrides,
628
+ },
622
629
  test?: {
623
630
  maxNestedDescribe?: number,
624
631
  testFunction?: 'it' | 'test',
@@ -768,6 +775,9 @@ This project was inspired by the work of [Anthony Fu][antfu], whose generous con
768
775
  [plugin-storybook]: https://storybook.js.org/docs/configure/integration/eslint-plugin
769
776
  [plugin-stylistic]: https://eslint.style
770
777
  [plugin-tailwind]: https://github.com/schoero/eslint-plugin-better-tailwindcss
778
+ [plugin-tanstack-query]: https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query
779
+ [plugin-tanstack-router]: https://tanstack.com/router/latest/docs/eslint/eslint-plugin-router
780
+ [plugin-tanstack-start]: https://tanstack.com/start/latest/docs/eslint/eslint-plugin-start
771
781
  [plugin-ts]: https://typescript-eslint.io
772
782
  [plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
773
783
  [plugin-vitest]: https://github.com/vitest-dev/eslint-plugin-vitest
@@ -1,16 +1,16 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getAstroRules } from "../rules/astro.mjs";
5
+ import * as eslintParserAstro from "astro-eslint-parser";
5
6
  import { mergeConfigs } from "eslint-flat-config-utils";
6
- import { parser } from "typescript-eslint";
7
7
  import eslintPluginAstro from "eslint-plugin-astro";
8
- import * as eslintParserAstro from "astro-eslint-parser";
8
+ import { parser } from "typescript-eslint";
9
9
  //#region src/configs/astro.ts
10
10
  function getAstroConfig(options) {
11
11
  const { astro } = options.configs;
12
12
  const { overrides } = isEnabled(astro) ? astro : defaultOptions.configs.astro;
13
- return mergeConfigs({
13
+ const astroConfig = {
14
14
  name: "shayanthenerd/astro",
15
15
  files: [globs.astro],
16
16
  plugins: { astro: eslintPluginAstro },
@@ -26,7 +26,8 @@ function getAstroConfig(options) {
26
26
  }
27
27
  },
28
28
  rules: getAstroRules(options)
29
- }, overrides);
29
+ };
30
+ return mergeConfigs(astroConfig, overrides);
30
31
  }
31
32
  //#endregion
32
33
  export { getAstroConfig };
@@ -1,7 +1,7 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
2
  import { isEnabled } from "../utils/isEnabled.mjs";
4
3
  import { getBaselineRules } from "../rules/baseline.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import eslintPluginBaselineJs from "eslint-plugin-baseline-js";
6
6
  //#region src/configs/baseline.ts
7
7
  function getBaselineConfig(options) {
@@ -1,17 +1,17 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getCssRules } from "../rules/css.mjs";
5
- import eslintPluginCss from "@eslint/css";
6
5
  import { mergeConfigs } from "eslint-flat-config-utils";
7
6
  import eslintPluginUnicorn from "eslint-plugin-unicorn";
7
+ import eslintPluginCss from "@eslint/css";
8
8
  import { tailwind3, tailwind4 } from "tailwind-csstree";
9
9
  //#region src/configs/css.ts
10
10
  function getCssConfig(options) {
11
11
  const { css, unicorn, tailwind } = options.configs;
12
12
  const { overrides } = isEnabled(css) ? css : defaultOptions.configs.css;
13
13
  const tailwindSyntax = isEnabled(tailwind) && tailwind.entryPoint ? tailwind4 : tailwind3;
14
- return mergeConfigs({
14
+ const cssConfig = {
15
15
  name: "shayanthenerd/css",
16
16
  files: [globs.css],
17
17
  plugins: {
@@ -24,7 +24,8 @@ function getCssConfig(options) {
24
24
  customSyntax: isEnabled(tailwind) ? tailwindSyntax : void 0
25
25
  },
26
26
  rules: getCssRules(options)
27
- }, overrides);
27
+ };
28
+ return mergeConfigs(cssConfig, overrides);
28
29
  }
29
30
  //#endregion
30
31
  export { getCssConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getCypressRules } from "../rules/cypress.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginCypress from "eslint-plugin-cypress";
@@ -8,13 +8,14 @@ import eslintPluginCypress from "eslint-plugin-cypress";
8
8
  function getCypressConfig(options) {
9
9
  const { cypress } = options.configs.test;
10
10
  const { overrides } = isEnabled(cypress) ? cypress : defaultOptions.configs.test.cypress;
11
- return mergeConfigs({
11
+ const cypressConfig = {
12
12
  name: "shayanthenerd/cypress",
13
13
  files: [globs.test],
14
14
  plugins: { cypress: eslintPluginCypress },
15
15
  languageOptions: { globals: eslintPluginCypress.configs.recommended.languageOptions?.globals },
16
16
  rules: getCypressRules()
17
- }, overrides);
17
+ };
18
+ return mergeConfigs(cypressConfig, overrides);
18
19
  }
19
20
  //#endregion
20
21
  export { getCypressConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getHtmlRules } from "../rules/html.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginUnicorn from "eslint-plugin-unicorn";
@@ -9,7 +9,7 @@ import eslintPluginHtml from "@html-eslint/eslint-plugin";
9
9
  function getHtmlConfig(options) {
10
10
  const { html, unicorn } = options.configs;
11
11
  const { overrides } = isEnabled(html) ? html : defaultOptions.configs.html;
12
- return mergeConfigs({
12
+ const htmlConfig = {
13
13
  name: "shayanthenerd/html",
14
14
  files: [globs.html],
15
15
  plugins: {
@@ -18,7 +18,8 @@ function getHtmlConfig(options) {
18
18
  },
19
19
  languageOptions: { parser: eslintPluginHtml.configs["flat/recommended"].languageOptions.parser },
20
20
  rules: getHtmlRules(options)
21
- }, overrides);
21
+ };
22
+ return mergeConfigs(htmlConfig, overrides);
22
23
  }
23
24
  //#endregion
24
25
  export { getHtmlConfig };
@@ -1,7 +1,7 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
- import { isEnabled } from "../utils/isEnabled.mjs";
4
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import { getImportXRules } from "../rules/importX.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import eslintPluginImportX from "eslint-plugin-import-x";
@@ -9,7 +9,7 @@ import eslintPluginImportX from "eslint-plugin-import-x";
9
9
  function getImportXConfig(options) {
10
10
  const { vue, astro, importX, typescript } = options.configs;
11
11
  const { overrides } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
12
- return mergeConfigs({
12
+ const importXConfig = {
13
13
  name: "shayanthenerd/import-x",
14
14
  files: [
15
15
  globs.src,
@@ -20,7 +20,8 @@ function getImportXConfig(options) {
20
20
  plugins: { "import-x": eslintPluginImportX },
21
21
  settings: isEnabled(typescript) ? eslintPluginImportX.flatConfigs.typescript.settings : {},
22
22
  rules: getImportXRules(options)
23
- }, overrides);
23
+ };
24
+ return mergeConfigs(importXConfig, overrides);
24
25
  }
25
26
  //#endregion
26
27
  export { getImportXConfig };
@@ -1,6 +1,6 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
2
  import { isEnabled } from "../utils/isEnabled.mjs";
3
+ import { isTruthy } from "../utils/isTruthy.mjs";
4
4
  import { getJavaScriptRules } from "../rules/javascript.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import { parser } from "typescript-eslint";
@@ -8,8 +8,8 @@ import globals from "globals";
8
8
  //#region src/configs/javascript.ts
9
9
  function getJavascriptConfig(options) {
10
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
- return mergeConfigs({
12
- name: "shayanthenerd/base",
11
+ const baseConfig = {
12
+ name: "shayanthenerd/javascript",
13
13
  files: [
14
14
  globs.src,
15
15
  globs.jsxTsx,
@@ -46,7 +46,8 @@ function getJavascriptConfig(options) {
46
46
  }
47
47
  },
48
48
  rules: getJavaScriptRules(options)
49
- }, overrides);
49
+ };
50
+ return mergeConfigs(baseConfig, overrides);
50
51
  }
51
52
  //#endregion
52
53
  export { getJavascriptConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getMarkdownRules } from "../rules/markdown.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginUnicorn from "eslint-plugin-unicorn";
@@ -9,7 +9,7 @@ import eslintPluginMarkdown from "@eslint/markdown";
9
9
  function getMarkdownConfig(options) {
10
10
  const { unicorn, markdown } = options.configs;
11
11
  const { language, frontmatter, overrides } = isEnabled(markdown) ? markdown : defaultOptions.configs.markdown;
12
- return mergeConfigs({
12
+ const markdownConfig = {
13
13
  name: "shayanthenerd/markdown",
14
14
  files: [globs.markdown],
15
15
  plugins: {
@@ -22,7 +22,8 @@ function getMarkdownConfig(options) {
22
22
  frontmatter
23
23
  },
24
24
  rules: getMarkdownRules(options)
25
- }, overrides);
25
+ };
26
+ return mergeConfigs(markdownConfig, overrides);
26
27
  }
27
28
  //#endregion
28
29
  export { getMarkdownConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getNextRules } from "../rules/next.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginNext from "@next/eslint-plugin-next";
@@ -8,13 +8,14 @@ import eslintPluginNext from "@next/eslint-plugin-next";
8
8
  function getNextConfig(options) {
9
9
  const { packageDir, configs: { next } } = options;
10
10
  const { overrides } = isEnabled(next) ? next : defaultOptions.configs.next;
11
- return mergeConfigs({
11
+ const nextConfig = {
12
12
  name: "shayanthenerd/next",
13
13
  files: [globs.src, globs.jsxTsx],
14
14
  plugins: { next: eslintPluginNext },
15
15
  settings: { next: { rootDir: packageDir } },
16
16
  rules: getNextRules()
17
- }, overrides);
17
+ };
18
+ return mergeConfigs(nextConfig, overrides);
18
19
  }
19
20
  //#endregion
20
21
  export { getNextConfig };
@@ -1,17 +1,17 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
- import { isEnabled } from "../utils/isEnabled.mjs";
4
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import { getNodeRules } from "../rules/node.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
- import eslintPluginNode from "eslint-plugin-n";
8
7
  import path from "node:path";
8
+ import eslintPluginNode from "eslint-plugin-n";
9
9
  //#region src/configs/node.ts
10
10
  function getNodeConfig(options) {
11
11
  const { tsConfig, configs: { vue, node, astro } } = options;
12
12
  const { overrides } = isEnabled(node) ? node : defaultOptions.configs.node;
13
13
  const tsconfigPath = tsConfig ? path.resolve(tsConfig.rootDir, tsConfig.filename) : void 0;
14
- return mergeConfigs({
14
+ const nodeConfig = {
15
15
  name: "shayanthenerd/node",
16
16
  files: [
17
17
  globs.src,
@@ -22,7 +22,8 @@ function getNodeConfig(options) {
22
22
  plugins: { n: eslintPluginNode },
23
23
  settings: { n: tsconfigPath ? { tsconfigPath } : void 0 },
24
24
  rules: getNodeRules(options)
25
- }, overrides);
25
+ };
26
+ return mergeConfigs(nodeConfig, overrides);
26
27
  }
27
28
  //#endregion
28
29
  export { getNodeConfig };
@@ -1,12 +1,12 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getNuxtRules } from "../rules/nuxt.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
- import eslintPluginVue from "eslint-plugin-vue";
7
6
  import { parser } from "typescript-eslint";
8
- import eslintPluginNuxt from "@nuxt/eslint-plugin";
7
+ import eslintPluginVue from "eslint-plugin-vue";
9
8
  import eslintPluginNuxtLinkChecker from "nuxt-link-checker/eslint";
9
+ import eslintPluginNuxt from "@nuxt/eslint-plugin";
10
10
  //#region src/configs/nuxt.ts
11
11
  const baseVueConfig = eslintPluginVue.configs["flat/base"].find((config) => config.languageOptions?.parser);
12
12
  const middlewaresConfig = {
@@ -35,26 +35,27 @@ const serverComponentsConfig = {
35
35
  function getNuxtConfigs(options) {
36
36
  const { nuxt } = options.configs;
37
37
  const { overrides } = isEnabled(nuxt) ? nuxt : defaultOptions.configs.nuxt;
38
+ const config = {
39
+ name: "shayanthenerd/nuxt",
40
+ files: [globs.vue],
41
+ plugins: {
42
+ "vue": eslintPluginVue,
43
+ "nuxt": eslintPluginNuxt,
44
+ "link-checker": eslintPluginNuxtLinkChecker
45
+ },
46
+ processor: "vue/vue",
47
+ languageOptions: {
48
+ parser: baseVueConfig?.languageOptions?.parser,
49
+ parserOptions: {
50
+ parser,
51
+ extraFileExtensions: [".vue"],
52
+ vueFeatures: { filter: false }
53
+ }
54
+ },
55
+ rules: getNuxtRules()
56
+ };
38
57
  return [
39
- mergeConfigs({
40
- name: "shayanthenerd/nuxt",
41
- files: [globs.vue],
42
- plugins: {
43
- "vue": eslintPluginVue,
44
- "nuxt": eslintPluginNuxt,
45
- "link-checker": eslintPluginNuxtLinkChecker
46
- },
47
- processor: "vue/vue",
48
- languageOptions: {
49
- parser: baseVueConfig?.languageOptions?.parser,
50
- parserOptions: {
51
- parser,
52
- extraFileExtensions: [".vue"],
53
- vueFeatures: { filter: false }
54
- }
55
- },
56
- rules: getNuxtRules()
57
- }, overrides),
58
+ mergeConfigs(config, overrides),
58
59
  middlewaresConfig,
59
60
  componentNamesConfig,
60
61
  serverComponentsConfig
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getPackageJsonRules } from "../rules/packageJson.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginPackageJson from "eslint-plugin-package-json";
@@ -8,13 +8,14 @@ import eslintPluginPackageJson from "eslint-plugin-package-json";
8
8
  function getPackageJsonConfig(options) {
9
9
  const { packageJson } = options.configs;
10
10
  const { overrides } = isEnabled(packageJson) ? packageJson : defaultOptions.configs.packageJson;
11
- return mergeConfigs({
11
+ const packageJsonConfig = {
12
12
  name: "shayanthenerd/package-json",
13
13
  files: [globs.packageJson],
14
14
  plugins: { "package-json": eslintPluginPackageJson },
15
15
  languageOptions: { parser: eslintPluginPackageJson.configs.recommended.languageOptions.parser },
16
16
  rules: getPackageJsonRules()
17
- }, overrides);
17
+ };
18
+ return mergeConfigs(packageJsonConfig, overrides);
18
19
  }
19
20
  //#endregion
20
21
  export { getPackageJsonConfig };
@@ -1,7 +1,7 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
- import { isEnabled } from "../utils/isEnabled.mjs";
4
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import { getPerfectionistRules } from "../rules/perfectionist.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import eslintPluginPerfectionist from "eslint-plugin-perfectionist";
@@ -9,7 +9,7 @@ import eslintPluginPerfectionist from "eslint-plugin-perfectionist";
9
9
  function getPerfectionistConfig(options) {
10
10
  const { vue, astro, perfectionist } = options.configs;
11
11
  const { sortType, overrides } = isEnabled(perfectionist) ? perfectionist : defaultOptions.configs.perfectionist;
12
- return mergeConfigs({
12
+ const perfectionistConfig = {
13
13
  name: "shayanthenerd/perfectionist",
14
14
  files: [
15
15
  globs.src,
@@ -27,7 +27,8 @@ function getPerfectionistConfig(options) {
27
27
  }
28
28
  } },
29
29
  rules: getPerfectionistRules(options)
30
- }, overrides);
30
+ };
31
+ return mergeConfigs(perfectionistConfig, overrides);
31
32
  }
32
33
  //#endregion
33
34
  export { getPerfectionistConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getPlaywrightRules } from "../rules/playwright.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginPlaywright from "eslint-plugin-playwright";
@@ -8,13 +8,14 @@ import eslintPluginPlaywright from "eslint-plugin-playwright";
8
8
  function getPlaywrightConfig(options) {
9
9
  const { playwright } = options.configs.test;
10
10
  const { overrides } = isEnabled(playwright) ? playwright : defaultOptions.configs.test.playwright;
11
- return mergeConfigs({
11
+ const playwrightConfig = {
12
12
  name: "shayanthenerd/playwright",
13
13
  files: [globs.test],
14
14
  plugins: { playwright: eslintPluginPlaywright },
15
15
  languageOptions: { globals: eslintPluginPlaywright.configs["flat/recommended"].languageOptions?.globals },
16
16
  rules: getPlaywrightRules(options)
17
- }, overrides);
17
+ };
18
+ return mergeConfigs(playwrightConfig, overrides);
18
19
  }
19
20
  //#endregion
20
21
  export { getPlaywrightConfig };
@@ -1,7 +1,7 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
- import { isEnabled } from "../utils/isEnabled.mjs";
4
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import { getPromiseRules } from "../rules/promise.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import eslintPluginPromise from "eslint-plugin-promise";
@@ -9,7 +9,7 @@ import eslintPluginPromise from "eslint-plugin-promise";
9
9
  function getPromiseConfig(options) {
10
10
  const { vue, astro, promise } = options.configs;
11
11
  const { overrides } = isEnabled(promise) ? promise : defaultOptions.configs.promise;
12
- return mergeConfigs({
12
+ const promiseConfig = {
13
13
  name: "shayanthenerd/promise",
14
14
  files: [
15
15
  globs.src,
@@ -19,7 +19,8 @@ function getPromiseConfig(options) {
19
19
  ].filter(isTruthy),
20
20
  plugins: { promise: eslintPluginPromise },
21
21
  rules: getPromiseRules()
22
- }, overrides);
22
+ };
23
+ return mergeConfigs(promiseConfig, overrides);
23
24
  }
24
25
  //#endregion
25
26
  export { getPromiseConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getReactRules } from "../rules/react.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginUnicorn from "eslint-plugin-unicorn";
@@ -11,7 +11,7 @@ import eslintPluginHtmlReact from "@html-eslint/eslint-plugin-react";
11
11
  function getReactConfig(options) {
12
12
  const { react, unicorn } = options.configs;
13
13
  const { overrides, accessibility } = isEnabled(react) ? react : defaultOptions.configs.react;
14
- return mergeConfigs({
14
+ const reactConfig = {
15
15
  name: "shayanthenerd/react",
16
16
  files: [globs.src, globs.jsxTsx],
17
17
  plugins: {
@@ -21,7 +21,8 @@ function getReactConfig(options) {
21
21
  ...isEnabled(accessibility) && { "jsx-a11y": eslintPluginJsxA11y }
22
22
  },
23
23
  rules: getReactRules(options)
24
- }, overrides);
24
+ };
25
+ return mergeConfigs(reactConfig, overrides);
25
26
  }
26
27
  //#endregion
27
28
  export { getReactConfig };
@@ -1,6 +1,6 @@
1
1
  import { globs } from "../helpers/globs.mjs";
2
- import { isEnabled } from "../utils/isEnabled.mjs";
3
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
4
  import { getStorybookRules } from "../rules/storybook.mjs";
5
5
  import { mergeConfigs } from "eslint-flat-config-utils";
6
6
  import eslintPluginStorybook from "eslint-plugin-storybook";
@@ -8,12 +8,13 @@ import eslintPluginStorybook from "eslint-plugin-storybook";
8
8
  function getStorybookConfig(options) {
9
9
  const { storybook } = options.configs.test;
10
10
  const { overrides } = isEnabled(storybook) ? storybook : defaultOptions.configs.test.storybook;
11
- return mergeConfigs({
11
+ const storybookConfig = {
12
12
  name: "shayanthenerd/storybook",
13
13
  files: [globs.storybook],
14
14
  plugins: { storybook: eslintPluginStorybook },
15
15
  rules: getStorybookRules(options)
16
- }, overrides);
16
+ };
17
+ return mergeConfigs(storybookConfig, overrides);
17
18
  }
18
19
  //#endregion
19
20
  export { getStorybookConfig };
@@ -1,7 +1,7 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
- import { isEnabled } from "../utils/isEnabled.mjs";
4
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import { getStylisticRules } from "../rules/stylistic.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import eslintPluginStylistic from "@stylistic/eslint-plugin";
@@ -9,7 +9,7 @@ import eslintPluginStylistic from "@stylistic/eslint-plugin";
9
9
  function getStylisticConfig(options) {
10
10
  const { vue, astro, stylistic } = options.configs;
11
11
  const { overrides } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
12
- return mergeConfigs({
12
+ const stylisticConfig = {
13
13
  name: "shayanthenerd/stylistic",
14
14
  files: [
15
15
  globs.src,
@@ -19,7 +19,8 @@ function getStylisticConfig(options) {
19
19
  ].filter(isTruthy),
20
20
  plugins: { "@stylistic": eslintPluginStylistic },
21
21
  rules: getStylisticRules(options)
22
- }, overrides);
22
+ };
23
+ return mergeConfigs(stylisticConfig, overrides);
23
24
  }
24
25
  //#endregion
25
26
  export { getStylisticConfig };
@@ -1,7 +1,7 @@
1
- import { isTruthy } from "../utils/isTruthy.mjs";
2
1
  import { globs } from "../helpers/globs.mjs";
3
- import { isEnabled } from "../utils/isEnabled.mjs";
4
2
  import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { isTruthy } from "../utils/isTruthy.mjs";
5
5
  import { getTailwindRules } from "../rules/tailwind.mjs";
6
6
  import { mergeConfigs } from "eslint-flat-config-utils";
7
7
  import path from "node:path";
@@ -54,7 +54,7 @@ function getTailwindConfig(options) {
54
54
  isNuxtUiEnabled ? nuxtUiAttributes : void 0,
55
55
  isNuxtUiEnabled ? nuxtUiAppConfigUiFields : void 0
56
56
  ].filter(isTruthy);
57
- return mergeConfigs({
57
+ const tailwindConfig = {
58
58
  name: "shayanthenerd/tailwind",
59
59
  files: [
60
60
  globs.src,
@@ -73,7 +73,8 @@ function getTailwindConfig(options) {
73
73
  detectComponentClasses: true
74
74
  } },
75
75
  rules: getTailwindRules(options)
76
- }, overrides);
76
+ };
77
+ return mergeConfigs(tailwindConfig, overrides);
77
78
  }
78
79
  //#endregion
79
80
  export { getTailwindConfig };
@@ -0,0 +1,26 @@
1
+ import { globs } from "../helpers/globs.mjs";
2
+ import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
3
+ import { isEnabled } from "../utils/isEnabled.mjs";
4
+ import { getTanstackRules } from "../rules/tanstack.mjs";
5
+ import { mergeConfigs } from "eslint-flat-config-utils";
6
+ import eslintPluginTanstackQuery from "@tanstack/eslint-plugin-query";
7
+ import eslintPluginTanstackRouter from "@tanstack/eslint-plugin-router";
8
+ import eslintPluginTanstackStart from "@tanstack/eslint-plugin-start";
9
+ //#region src/configs/tanstack.ts
10
+ function getTanstackConfig(options) {
11
+ const { tanstack } = options.configs;
12
+ const { overrides } = isEnabled(tanstack) ? tanstack : defaultOptions.configs.tanstack;
13
+ const tanstackConfig = {
14
+ name: "shayanthenerd/tanstack",
15
+ files: [globs.src, globs.jsxTsx],
16
+ plugins: isEnabled(tanstack) ? {
17
+ ...isEnabled(tanstack.start) && { "@tanstack/start": eslintPluginTanstackStart },
18
+ ...isEnabled(tanstack.query) && { "@tanstack/query": eslintPluginTanstackQuery },
19
+ ...isEnabled(tanstack.router) && { "@tanstack/router": eslintPluginTanstackRouter }
20
+ } : {},
21
+ rules: getTanstackRules(options)
22
+ };
23
+ return mergeConfigs(tanstackConfig, overrides);
24
+ }
25
+ //#endregion
26
+ export { getTanstackConfig };