Open History to see the last commit
1import { rules } from './rules'
2import type { ESLint, Linter } from 'eslint'
3import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'
4β
5type RuleKey = keyof typeof rules
6β
7interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
8 rules: Record<RuleKey, RuleModule<any, any, any>>
9 configs: {
10 recommended: ESLint.ConfigData
11 'flat/recommended': Array<Linter.FlatConfig>
12 }
13}
14β
15const plugin: Plugin = {
16 meta: {
17 name: '@tanstack/eslint-plugin-query',
18 },
19 configs: {} as Plugin['configs'],
20 rules,
21}
22β
23// Assign configs here so we can reference `plugin`
24Object.assign(plugin.configs, {
25 recommended: {
26 plugins: ['@tanstack/eslint-plugin-query'],
27 rules: {
28 '@tanstack/query/exhaustive-deps': 'error',
29 '@tanstack/query/no-rest-destructuring': 'warn',
30 '@tanstack/query/stable-query-client': 'error',
31 '@tanstack/query/no-unstable-deps': 'error',
32 },
33 },
34 'flat/recommended': [
35 {
36 plugins: {
37 '@tanstack/query': plugin,
38 },
39 rules: {
40 '@tanstack/query/exhaustive-deps': 'error',
41 '@tanstack/query/no-rest-destructuring': 'warn',
42 '@tanstack/query/stable-query-client': 'error',
43 '@tanstack/query/no-unstable-deps': 'error',
44 },
45 },
46 ],
47})
48β
49export default plugin