forked from TanStack/query
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
51 lines (46 loc) · 1.37 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { rules } from './rules'
import type { ESLint, Linter } from 'eslint'
import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'
type RuleKey = keyof typeof rules
export interface Plugin extends Omit<ESLint.Plugin, 'rules'> {
rules: Record<RuleKey, RuleModule<any, any, any>>
configs: {
recommended: ESLint.ConfigData
'flat/recommended': Array<Linter.FlatConfig>
}
}
const plugin: Plugin = {
meta: {
name: '@tanstack/eslint-plugin-query',
},
configs: {} as Plugin['configs'],
rules,
}
// Assign configs here so we can reference `plugin`
Object.assign(plugin.configs, {
recommended: {
plugins: ['@tanstack/query'],
rules: {
'@tanstack/query/exhaustive-deps': 'error',
'@tanstack/query/no-rest-destructuring': 'warn',
'@tanstack/query/stable-query-client': 'error',
'@tanstack/query/no-unstable-deps': 'error',
'@tanstack/query/infinite-query-property-order': 'error',
},
},
'flat/recommended': [
{
plugins: {
'@tanstack/query': plugin,
},
rules: {
'@tanstack/query/exhaustive-deps': 'error',
'@tanstack/query/no-rest-destructuring': 'warn',
'@tanstack/query/stable-query-client': 'error',
'@tanstack/query/no-unstable-deps': 'error',
'@tanstack/query/infinite-query-property-order': 'error',
},
},
],
})
export default plugin