Open History to see the last commit
1import { ESLintUtils } from '@typescript-eslint/utils'
2import { detectTanstackQueryImports } from './detect-react-query-imports'
3import type { EnhancedCreate } from './detect-react-query-imports'
4β
5const getDocsUrl = (ruleName: string): string =>
6 `https://tanstack.com/query/v4/docs/eslint/${ruleName}`
7β
8type EslintRule = Omit<
9 Parameters<ReturnType<typeof ESLintUtils.RuleCreator>>[0],
10 'create'
11> & {
12 create: EnhancedCreate
13}
14β
15export function createRule({ create, ...rest }: EslintRule) {
16 return ESLintUtils.RuleCreator(getDocsUrl)({
17 ...rest,
18 create: detectTanstackQueryImports(create),
19 })
20}