@shayanthenerd/eslint-config 0.31.0 β 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.
- package/README.md +15 -5
- package/dist/configs/javascript.mjs +1 -1
- package/dist/configs/tanstack.mjs +26 -0
- package/dist/helpers/options/defaultOptions.mjs +6 -0
- package/dist/helpers/options/enableDetectedConfigs.mjs +10 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -35
- package/dist/rules/tanstack.mjs +39 -0
- package/dist/types/eslint-schema.d.mts +75 -0
- package/dist/types/index.d.mts +7 -0
- package/dist/types/options/tanstack.d.mts +32 -0
- package/package.json +6 -3
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
|
-
|
|
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 `
|
|
92
|
-
- Use `
|
|
93
|
-
- Use `
|
|
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
|
-
|
|
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
|
|
@@ -9,7 +9,7 @@ import globals from "globals";
|
|
|
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
11
|
const baseConfig = {
|
|
12
|
-
name: "shayanthenerd/
|
|
12
|
+
name: "shayanthenerd/javascript",
|
|
13
13
|
files: [
|
|
14
14
|
globs.src,
|
|
15
15
|
globs.jsxTsx,
|
|
@@ -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 };
|
|
@@ -25,6 +25,9 @@ function enableDetectedConfigs(options) {
|
|
|
25
25
|
astro: isPackageDetected("astro", options),
|
|
26
26
|
react: isPackageDetected("react", options),
|
|
27
27
|
next: isPackageDetected("next", options),
|
|
28
|
+
tanstackStart: isPackageDetected("@tanstack/react-start", options),
|
|
29
|
+
tanstackQuery: isPackageDetected("@tanstack/react-query", options),
|
|
30
|
+
tanstackRouter: isPackageDetected("@tanstack/react-router", options),
|
|
28
31
|
vue: isPackageDetected("vue", options),
|
|
29
32
|
nuxt: isPackageDetected("nuxt", options),
|
|
30
33
|
nuxtUI: isPackageDetected("@nuxt/ui", options),
|
|
@@ -55,6 +58,7 @@ function enableDetectedConfigs(options) {
|
|
|
55
58
|
options.configs.nuxt ??= autoDetectedPackages.nuxt;
|
|
56
59
|
options.configs.react ??= autoDetectedPackages.react;
|
|
57
60
|
options.configs.next ??= autoDetectedPackages.next;
|
|
61
|
+
options.configs.tanstack ??= autoDetectedPackages.tanstackStart || autoDetectedPackages.tanstackQuery || autoDetectedPackages.tanstackRouter;
|
|
58
62
|
options.configs.test.vitest ??= autoDetectedPackages.vitest;
|
|
59
63
|
options.configs.test.cypress ??= autoDetectedPackages.cypress;
|
|
60
64
|
options.configs.test.storybook ??= autoDetectedPackages.storybook;
|
|
@@ -76,6 +80,12 @@ function enableDetectedConfigs(options) {
|
|
|
76
80
|
options.configs.vue = options.configs.vue === true ? {} : options.configs.vue;
|
|
77
81
|
options.configs.vue.blockLang = { script: "ts" };
|
|
78
82
|
}
|
|
83
|
+
if (options.configs.tanstack) {
|
|
84
|
+
if (options.configs.tanstack === true) options.configs.tanstack = {};
|
|
85
|
+
options.configs.tanstack.start ??= autoDetectedPackages.tanstackStart;
|
|
86
|
+
options.configs.tanstack.query ??= autoDetectedPackages.tanstackQuery;
|
|
87
|
+
options.configs.tanstack.router ??= autoDetectedPackages.tanstackRouter;
|
|
88
|
+
}
|
|
79
89
|
if (options.configs.nuxt) {
|
|
80
90
|
if (options.configs.nuxt === true) options.configs.nuxt = {};
|
|
81
91
|
options.configs.nuxt.ui ??= autoDetectedPackages.nuxtUI;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Options } from "./types/index.mjs";
|
|
2
2
|
import { Linter } from "eslint";
|
|
3
3
|
//#region src/index.d.ts
|
|
4
|
-
/** Valid argument combinations for `defineConfig`. */
|
|
5
|
-
type DefineConfigArguments = [] | [options: Options] | [configs: Linter.Config[]] | [options: Options, configs: Linter.Config[]];
|
|
6
4
|
/**
|
|
7
5
|
* Define your ESLint configuration based on the provided options and/or custom Flat Config Objects.
|
|
8
6
|
*
|
|
@@ -37,6 +35,8 @@ type DefineConfigArguments = [] | [options: Options] | [configs: Linter.Config[]
|
|
|
37
35
|
* ],
|
|
38
36
|
* );
|
|
39
37
|
*/
|
|
40
|
-
declare function defineConfig(
|
|
38
|
+
declare function defineConfig(options: Options): Linter.Config[];
|
|
39
|
+
declare function defineConfig(configs: Linter.Config[]): Linter.Config[];
|
|
40
|
+
declare function defineConfig(options: Options, configs: Linter.Config[]): Linter.Config[];
|
|
41
41
|
//#endregion
|
|
42
42
|
export { defineConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import { getReactConfig } from "./configs/react.mjs";
|
|
|
19
19
|
import { getStorybookConfig } from "./configs/storybook.mjs";
|
|
20
20
|
import { getStylisticConfig } from "./configs/stylistic.mjs";
|
|
21
21
|
import { getTailwindConfig } from "./configs/tailwind.mjs";
|
|
22
|
+
import { getTanstackConfig } from "./configs/tanstack.mjs";
|
|
22
23
|
import { getTypescriptConfig } from "./configs/typescript.mjs";
|
|
23
24
|
import { getUnicornConfig } from "./configs/unicorn.mjs";
|
|
24
25
|
import { getVitestConfig } from "./configs/vitest.mjs";
|
|
@@ -28,40 +29,6 @@ import { getIgnorePatterns } from "./helpers/ignores/getIgnorePatterns.mjs";
|
|
|
28
29
|
import { mergeWithDefaults } from "./helpers/options/mergeWithDefaults.mjs";
|
|
29
30
|
import { defineConfig as defineConfig$1, globalIgnores } from "eslint/config";
|
|
30
31
|
//#region src/index.ts
|
|
31
|
-
/**
|
|
32
|
-
* Define your ESLint configuration based on the provided options and/or custom Flat Config Objects.
|
|
33
|
-
*
|
|
34
|
-
* @param {...DefineConfigArguments} args The configuration options and/or custom Flat Config objects.
|
|
35
|
-
* @returns {Linter.Config[]} The merged ESLint configuration array
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* defineConfig();
|
|
39
|
-
* // or
|
|
40
|
-
* defineConfig({ autoDetectDeps: 'verbose' });
|
|
41
|
-
* // or
|
|
42
|
-
* defineConfig([
|
|
43
|
-
* {
|
|
44
|
-
* name: 'custom',
|
|
45
|
-
* rules: {
|
|
46
|
-
* 'no-console': 'error',
|
|
47
|
-
* },
|
|
48
|
-
* },
|
|
49
|
-
* { ... },
|
|
50
|
-
* ]);
|
|
51
|
-
* // or
|
|
52
|
-
* defineConfig(
|
|
53
|
-
* { autoDetectDeps: 'verbose' },
|
|
54
|
-
* [
|
|
55
|
-
* {
|
|
56
|
-
* name: 'custom',
|
|
57
|
-
* rules: {
|
|
58
|
-
* 'no-console': 'error',
|
|
59
|
-
* },
|
|
60
|
-
* },
|
|
61
|
-
* { ... },
|
|
62
|
-
* ],
|
|
63
|
-
* );
|
|
64
|
-
*/
|
|
65
32
|
function defineConfig(...args) {
|
|
66
33
|
let options = {};
|
|
67
34
|
let userConfigs = [];
|
|
@@ -72,7 +39,7 @@ function defineConfig(...args) {
|
|
|
72
39
|
userConfigs = secondArgument ?? [];
|
|
73
40
|
}
|
|
74
41
|
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, baseline, markdown, tailwind, stylistic, typescript, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
|
|
42
|
+
const { gitignore, project: { rules, ignores, settings, linterOptions }, configs: { css, vue, zod, html, next, node, nuxt, react, astro, unicorn, importX, promise, baseline, markdown, tailwind, tanstack, stylistic, typescript, packageJson, perfectionist, test: { vitest, cypress, storybook, playwright } } } = mergedOptions;
|
|
76
43
|
const ignorePatterns = getIgnorePatterns({
|
|
77
44
|
gitignore,
|
|
78
45
|
patterns: ignores
|
|
@@ -103,6 +70,7 @@ function defineConfig(...args) {
|
|
|
103
70
|
isEnabled(astro) && getAstroConfig(mergedOptions),
|
|
104
71
|
isEnabled(react) && getReactConfig(mergedOptions),
|
|
105
72
|
isEnabled(next) && getNextConfig(mergedOptions),
|
|
73
|
+
isEnabled(tanstack) && getTanstackConfig(mergedOptions),
|
|
106
74
|
isEnabled(vue) && getVueConfig(mergedOptions),
|
|
107
75
|
...isEnabled(nuxt) ? getNuxtConfigs(mergedOptions) : [],
|
|
108
76
|
isEnabled(storybook) && getStorybookConfig(mergedOptions),
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
2
|
+
//#region src/rules/tanstack.ts
|
|
3
|
+
const tanstackStartRules = {
|
|
4
|
+
"@tanstack/start/no-async-client-component": "error",
|
|
5
|
+
"@tanstack/start/no-client-code-in-server-component": "error"
|
|
6
|
+
};
|
|
7
|
+
const tanstackQueryRules = {
|
|
8
|
+
"@tanstack/query/exhaustive-deps": "warn",
|
|
9
|
+
"@tanstack/query/no-rest-destructuring": "warn",
|
|
10
|
+
"@tanstack/query/stable-query-client": "error",
|
|
11
|
+
"@tanstack/query/no-unstable-deps": "error",
|
|
12
|
+
"@tanstack/query/infinite-query-property-order": "warn",
|
|
13
|
+
"@tanstack/query/no-void-query-fn": "error",
|
|
14
|
+
"@tanstack/query/mutation-property-order": "warn"
|
|
15
|
+
};
|
|
16
|
+
const tanstackRouterRules = {
|
|
17
|
+
"@tanstack/router/create-route-property-order": "warn",
|
|
18
|
+
"@tanstack/router/route-param-names": "error"
|
|
19
|
+
};
|
|
20
|
+
function getTanstackRules(options) {
|
|
21
|
+
const { tanstack, typescript } = options.configs;
|
|
22
|
+
const rules = {};
|
|
23
|
+
if (!isEnabled(tanstack)) return rules;
|
|
24
|
+
if (isEnabled(typescript)) tanstackRouterRules["@typescript-eslint/only-throw-error"] = ["error", { allow: [{
|
|
25
|
+
from: "package",
|
|
26
|
+
package: "@tanstack/router-core",
|
|
27
|
+
name: "Redirect"
|
|
28
|
+
}, {
|
|
29
|
+
from: "package",
|
|
30
|
+
package: "@tanstack/router-core",
|
|
31
|
+
name: "NotFoundError"
|
|
32
|
+
}] }];
|
|
33
|
+
if (isEnabled(tanstack.start)) Object.assign(rules, tanstackStartRules);
|
|
34
|
+
if (isEnabled(tanstack.query)) Object.assign(rules, tanstackQueryRules);
|
|
35
|
+
if (isEnabled(tanstack.router)) Object.assign(rules, tanstackRouterRules);
|
|
36
|
+
return rules;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { getTanstackRules };
|
|
@@ -1557,6 +1557,66 @@ export interface ESLintSchema {
|
|
|
1557
1557
|
* @see https://eslint.style/rules/yield-star-spacing
|
|
1558
1558
|
*/
|
|
1559
1559
|
'@stylistic/yield-star-spacing'?: Linter.RuleEntry<StylisticYieldStarSpacing>;
|
|
1560
|
+
/**
|
|
1561
|
+
* Exhaustive deps rule for useQuery
|
|
1562
|
+
* @see https://tanstack.com/query/latest/docs/eslint/exhaustive-deps
|
|
1563
|
+
*/
|
|
1564
|
+
'@tanstack/query/exhaustive-deps'?: Linter.RuleEntry<TanstackQueryExhaustiveDeps>;
|
|
1565
|
+
/**
|
|
1566
|
+
* Ensure correct order of inference sensitive properties for infinite queries
|
|
1567
|
+
* @see https://tanstack.com/query/latest/docs/eslint/infinite-query-property-order
|
|
1568
|
+
*/
|
|
1569
|
+
'@tanstack/query/infinite-query-property-order'?: Linter.RuleEntry<[]>;
|
|
1570
|
+
/**
|
|
1571
|
+
* Ensure correct order of inference-sensitive properties in useMutation()
|
|
1572
|
+
* @see https://tanstack.com/query/latest/docs/eslint/mutation-property-order
|
|
1573
|
+
*/
|
|
1574
|
+
'@tanstack/query/mutation-property-order'?: Linter.RuleEntry<[]>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Disallows rest destructuring in queries
|
|
1577
|
+
* @see https://tanstack.com/query/latest/docs/eslint/no-rest-destructuring
|
|
1578
|
+
*/
|
|
1579
|
+
'@tanstack/query/no-rest-destructuring'?: Linter.RuleEntry<[]>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Disallow putting the result of query hooks directly in a React hook dependency array
|
|
1582
|
+
* @see https://tanstack.com/query/latest/docs/eslint/no-unstable-deps
|
|
1583
|
+
*/
|
|
1584
|
+
'@tanstack/query/no-unstable-deps'?: Linter.RuleEntry<[]>;
|
|
1585
|
+
/**
|
|
1586
|
+
* Ensures queryFn returns a non-undefined value
|
|
1587
|
+
* @see https://tanstack.com/query/latest/docs/eslint/no-void-query-fn
|
|
1588
|
+
*/
|
|
1589
|
+
'@tanstack/query/no-void-query-fn'?: Linter.RuleEntry<[]>;
|
|
1590
|
+
/**
|
|
1591
|
+
* Prefer using queryOptions() to co-locate queryKey and queryFn
|
|
1592
|
+
* @see https://tanstack.com/query/latest/docs/eslint/prefer-query-options
|
|
1593
|
+
*/
|
|
1594
|
+
'@tanstack/query/prefer-query-options'?: Linter.RuleEntry<[]>;
|
|
1595
|
+
/**
|
|
1596
|
+
* Makes sure that QueryClient is stable
|
|
1597
|
+
* @see https://tanstack.com/query/latest/docs/eslint/stable-query-client
|
|
1598
|
+
*/
|
|
1599
|
+
'@tanstack/query/stable-query-client'?: Linter.RuleEntry<[]>;
|
|
1600
|
+
/**
|
|
1601
|
+
* Ensure correct order of inference sensitive properties for createRoute functions
|
|
1602
|
+
* @see https://tanstack.com/router/latest/docs/eslint/create-route-property-order
|
|
1603
|
+
*/
|
|
1604
|
+
'@tanstack/router/create-route-property-order'?: Linter.RuleEntry<[]>;
|
|
1605
|
+
/**
|
|
1606
|
+
* Ensure route param names are valid JavaScript identifiers
|
|
1607
|
+
* @see https://tanstack.com/router/latest/docs/eslint/route-param-names
|
|
1608
|
+
*/
|
|
1609
|
+
'@tanstack/router/route-param-names'?: Linter.RuleEntry<[]>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Disallow async components in client context. Async components are only valid inside server components.
|
|
1612
|
+
* @see https://tanstack.com/start/latest/docs/eslint/no-async-client-component
|
|
1613
|
+
*/
|
|
1614
|
+
'@tanstack/start/no-async-client-component'?: Linter.RuleEntry<TanstackStartNoAsyncClientComponent>;
|
|
1615
|
+
/**
|
|
1616
|
+
* Disallow client-only code inside server components
|
|
1617
|
+
* @see https://tanstack.com/start/latest/docs/eslint/no-client-code-in-server-component
|
|
1618
|
+
*/
|
|
1619
|
+
'@tanstack/start/no-client-code-in-server-component'?: Linter.RuleEntry<TanstackStartNoClientCodeInServerComponent>;
|
|
1560
1620
|
/**
|
|
1561
1621
|
* Require that function overload signatures be consecutive
|
|
1562
1622
|
* @see https://typescript-eslint.io/rules/adjacent-overload-signatures
|
|
@@ -11595,6 +11655,21 @@ type StylisticYieldStarSpacing = [] | [(("before" | "after" | "both" | "neither"
|
|
|
11595
11655
|
before?: boolean;
|
|
11596
11656
|
after?: boolean;
|
|
11597
11657
|
})];
|
|
11658
|
+
// ----- @tanstack/query/exhaustive-deps -----
|
|
11659
|
+
type TanstackQueryExhaustiveDeps = [] | [{
|
|
11660
|
+
allowlist?: {
|
|
11661
|
+
variables?: string[];
|
|
11662
|
+
types?: string[];
|
|
11663
|
+
};
|
|
11664
|
+
}];
|
|
11665
|
+
// ----- @tanstack/start/no-async-client-component -----
|
|
11666
|
+
type TanstackStartNoAsyncClientComponent = [] | [{
|
|
11667
|
+
ignorePatterns?: string[];
|
|
11668
|
+
}];
|
|
11669
|
+
// ----- @tanstack/start/no-client-code-in-server-component -----
|
|
11670
|
+
type TanstackStartNoClientCodeInServerComponent = [] | [{
|
|
11671
|
+
allowedServerHooks?: string[];
|
|
11672
|
+
}];
|
|
11598
11673
|
// ----- @typescript-eslint/array-type -----
|
|
11599
11674
|
type TypescriptEslintArrayType = [] | [{
|
|
11600
11675
|
default?: ("array" | "generic" | "array-simple");
|
package/dist/types/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import { NuxtOptions } from "./options/nuxt.mjs";
|
|
|
5
5
|
import { ReactOptions } from "./options/react.mjs";
|
|
6
6
|
import { StylisticOptions } from "./options/stylistic.mjs";
|
|
7
7
|
import { TailwindOptions } from "./options/tailwind.mjs";
|
|
8
|
+
import { TanstackOptions } from "./options/tanstack.mjs";
|
|
8
9
|
import { TestOptions } from "./options/test.mjs";
|
|
9
10
|
import { TypescriptOptions } from "./options/typescript.mjs";
|
|
10
11
|
import { VueOptions } from "./options/vue.mjs";
|
|
@@ -378,6 +379,12 @@ interface Options {
|
|
|
378
379
|
* @default false
|
|
379
380
|
*/
|
|
380
381
|
tailwind?: false | TailwindOptions;
|
|
382
|
+
/**
|
|
383
|
+
* Use [@tanstack/eslint-plugin-start](https://tanstack.com/start/latest/docs/eslint/eslint-plugin-start), [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query), and [@tanstack/eslint-plugin-router](https://tanstack.com/router/latest/docs/eslint/eslint-plugin-router) to enforce best practices and avoid common mistakes when using TanStack Start, TanStack Router, and TanStack Query.
|
|
384
|
+
*
|
|
385
|
+
* @default false // `true` if either of "@tanstack/react-start", "@tanstack/react-query", or "@tanstack/react-router" are detected in the dependencies when `autoDetectDeps` is enabled
|
|
386
|
+
*/
|
|
387
|
+
tanstack?: boolean | TanstackOptions;
|
|
381
388
|
/**
|
|
382
389
|
* Configuration options for the testing tools.
|
|
383
390
|
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PluginRules } from "../eslintRules.mjs";
|
|
2
|
+
import { ConfigWithOverrides } from "../index.mjs";
|
|
3
|
+
//#region src/types/options/tanstack.d.ts
|
|
4
|
+
type ConfigRules = PluginRules<'@tanstack'>;
|
|
5
|
+
interface TanstackOptions extends ConfigWithOverrides<ConfigRules> {
|
|
6
|
+
/**
|
|
7
|
+
* Whether [@tanstack/query](https://tanstack.com/query) is used in the project.
|
|
8
|
+
*
|
|
9
|
+
* @default false // `true` if "@tanstack/react-query" is detected in the dependencies when `autoDetectDeps` is enabled
|
|
10
|
+
*
|
|
11
|
+
* @see [@tanstack/eslint-plugin-query](https://tanstack.com/query/latest/docs/eslint/eslint-plugin-query)
|
|
12
|
+
*/
|
|
13
|
+
query?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether [@tanstack/router](https://tanstack.com/router) is used in the project.
|
|
16
|
+
*
|
|
17
|
+
* @default false // `true` if "@tanstack/react-router" is detected in the dependencies when `autoDetectDeps` is enabled
|
|
18
|
+
*
|
|
19
|
+
* @see [@tanstack/eslint-plugin-router](https://tanstack.com/router/latest/docs/eslint/eslint-plugin-router)
|
|
20
|
+
*/
|
|
21
|
+
router?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether [@tanstack/start](https://tanstack.com/start) is used in the project.
|
|
24
|
+
*
|
|
25
|
+
* @default false // `true` if "@tanstack/react-start" is detected in the dependencies when `autoDetectDeps` is enabled
|
|
26
|
+
*
|
|
27
|
+
* @see [@tanstack/eslint-plugin-start](https://tanstack.com/start/latest/docs/eslint/eslint-plugin-start)
|
|
28
|
+
*/
|
|
29
|
+
start?: boolean;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export type { TanstackOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shayanthenerd/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"nano-staged": {
|
|
46
46
|
"**/*.json": "pnpm format",
|
|
47
|
-
"**/*.ts": "pnpm lint",
|
|
47
|
+
"**/*.ts": "pnpm lint --no-warn-ignored",
|
|
48
48
|
"package.json": "pnpm lint",
|
|
49
49
|
"pnpm-lock.yaml": [
|
|
50
50
|
"pnpm generate:types",
|
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
"@next/eslint-plugin-next": "16.3.4",
|
|
67
67
|
"@nuxt/eslint-plugin": "1.17.0",
|
|
68
68
|
"@stylistic/eslint-plugin": "5.10.0",
|
|
69
|
+
"@tanstack/eslint-plugin-query": "5.102.8",
|
|
70
|
+
"@tanstack/eslint-plugin-router": "1.162.0",
|
|
71
|
+
"@tanstack/eslint-plugin-start": "0.1.0",
|
|
69
72
|
"@vitest/eslint-plugin": "1.6.27",
|
|
70
73
|
"astro-eslint-parser": "3.1.0",
|
|
71
74
|
"defu": "6.1.7",
|
|
@@ -74,7 +77,7 @@
|
|
|
74
77
|
"eslint-plugin-astro": "3.1.0",
|
|
75
78
|
"eslint-plugin-baseline-js": "0.7.1",
|
|
76
79
|
"eslint-plugin-better-tailwindcss": "4.7.0",
|
|
77
|
-
"eslint-plugin-cypress": "7.0.
|
|
80
|
+
"eslint-plugin-cypress": "7.0.2",
|
|
78
81
|
"eslint-plugin-import-x": "4.17.1",
|
|
79
82
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
80
83
|
"eslint-plugin-n": "18.3.0",
|