Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

index.ts

22 lines618 Bytes

1import type { TSESLint } from '@typescript-eslint/utils'
2import { rules } from '../rules'
3​
4function generateRecommendedConfig(
5 allRules: Record<string, TSESLint.RuleModule<any, any>>,
6) {
7 return Object.entries(allRules).reduce((memo, [name, rule]) => {
8 const { recommended } = rule.meta.docs || {}
9​
10 return {
11 ...memo,
12 ...(recommended ? { [`@tanstack/query/${name}`]: recommended } : {}),
13 }
14 }, {} as Record<string, 'strict' | 'error' | 'warn'>)
16​
17export const configs = {
18 recommended: {
19 plugins: ['@tanstack/eslint-plugin-query'],
20 rules: generateRecommendedConfig(rules),
21 },