@tanstack/eslint-plugin-query
Advanced tools
Comparing version 5.20.0 to 5.20.1
@@ -1,7 +0,7 @@ | ||
import type { TSESLint } from '@typescript-eslint/utils'; | ||
import type { ESLintUtils } from '@typescript-eslint/utils'; | ||
export declare const configs: { | ||
recommended: { | ||
plugins: string[]; | ||
rules: [string, TSESLint.RuleModule<any, any, TSESLint.RuleListener>]; | ||
rules: [string, ESLintUtils.RuleModule<string, readonly unknown[], ESLintUtils.RuleListener>]; | ||
}; | ||
}; |
import type { ESLintUtils } from '@typescript-eslint/utils'; | ||
export declare const rules: Record<string, ESLintUtils.RuleModule<string, any, ESLintUtils.RuleListener>>; | ||
export declare const rules: Record<string, ESLintUtils.RuleModule<string, ReadonlyArray<unknown>, ESLintUtils.RuleListener>>; |
@@ -1,4 +0,4 @@ | ||
import { name, rule } from "./rules/exhaustive-deps.rule.js"; | ||
import { name, rule } from "./rules/exhaustive-deps/exhaustive-deps.rule.js"; | ||
import { name as name$1, rule as rule$1 } from "./rules/stable-query-client/stable-query-client.rule.js"; | ||
import { name as name$2, rule as rule$2 } from "./rules/no-rest-desctructuring/no-rest-destructuring.rule.js"; | ||
import { name as name$2, rule as rule$2 } from "./rules/no-rest-destructuring/no-rest-destructuring.rule.js"; | ||
const rules = { | ||
@@ -5,0 +5,0 @@ [name]: rule, |
@@ -1,3 +0,3 @@ | ||
import type { ESLintUtils } from '@typescript-eslint/utils'; | ||
import { ESLintUtils } from '@typescript-eslint/utils'; | ||
export declare const name = "stable-query-client"; | ||
export declare const rule: ESLintUtils.RuleModule<string, any, ESLintUtils.RuleListener>; | ||
export declare const rule: ESLintUtils.RuleModule<string, readonly unknown[], ESLintUtils.RuleListener>; |
@@ -1,5 +0,7 @@ | ||
import { AST_NODE_TYPES } from "@typescript-eslint/utils"; | ||
import { ESLintUtils, AST_NODE_TYPES } from "@typescript-eslint/utils"; | ||
import { ASTUtils } from "../../utils/ast-utils.js"; | ||
import { createRule } from "../../utils/create-rule.js"; | ||
import { getDocsUrl } from "../../utils/get-docs-url.js"; | ||
import { detectTanstackQueryImports } from "../../utils/detect-react-query-imports.js"; | ||
const name = "stable-query-client"; | ||
const createRule = ESLintUtils.RuleCreator(getDocsUrl); | ||
const rule = createRule({ | ||
@@ -25,3 +27,3 @@ name, | ||
defaultOptions: [], | ||
create: (context, _, helpers) => { | ||
create: detectTanstackQueryImports((context, _, helpers) => { | ||
return { | ||
@@ -60,3 +62,3 @@ NewExpression: (node) => { | ||
}; | ||
} | ||
}) | ||
}); | ||
@@ -63,0 +65,0 @@ export { |
@@ -10,4 +10,4 @@ import { TSESTree } from '@typescript-eslint/utils'; | ||
}; | ||
export type EnhancedCreate = (context: Context, options: Options, helpers: Helpers) => ReturnType<Create>; | ||
type EnhancedCreate = (context: Context, options: Options, helpers: Helpers) => ReturnType<Create>; | ||
export declare function detectTanstackQueryImports(create: EnhancedCreate): Create; | ||
export {}; |
{ | ||
"name": "@tanstack/eslint-plugin-query", | ||
"version": "5.20.0", | ||
"version": "5.20.1", | ||
"description": "ESLint plugin for TanStack Query", | ||
@@ -5,0 +5,0 @@ "author": "Eliya Cohen", |
import { RuleTester } from '@typescript-eslint/rule-tester' | ||
import { normalizeIndent } from '../utils/test-utils' | ||
import { rule } from '../rules/exhaustive-deps.rule' | ||
import { rule } from '../rules/exhaustive-deps/exhaustive-deps.rule' | ||
import { normalizeIndent } from './test-utils' | ||
@@ -26,3 +26,2 @@ const ruleTester = new RuleTester({ | ||
name: 'should pass when deps are passed in template literal', | ||
// eslint-disable-next-line no-template-curly-in-string | ||
code: 'useQuery({ queryKey: [`entity/${id}`], queryFn: () => api.getEntity(id) });', | ||
@@ -468,3 +467,2 @@ }, | ||
messageId: 'fixTo', | ||
// eslint-disable-next-line no-template-curly-in-string | ||
data: { result: '["entity/${id}", id]' }, | ||
@@ -494,3 +492,2 @@ output: normalizeIndent` | ||
messageId: 'fixTo', | ||
// eslint-disable-next-line no-template-curly-in-string | ||
data: { result: '[`entity/${a}`, b]' }, | ||
@@ -497,0 +494,0 @@ output: normalizeIndent` |
import { rules } from './rules' | ||
import type { TSESLint } from '@typescript-eslint/utils' | ||
import type { ESLintUtils } from '@typescript-eslint/utils' | ||
function generateRecommendedConfig( | ||
allRules: Record<string, TSESLint.RuleModule<any, any>>, | ||
allRules: Record< | ||
string, | ||
ESLintUtils.RuleModule< | ||
string, | ||
ReadonlyArray<unknown>, | ||
ESLintUtils.RuleListener | ||
> | ||
>, | ||
) { | ||
@@ -7,0 +14,0 @@ return Object.entries(allRules).reduce( |
@@ -1,4 +0,4 @@ | ||
import * as exhaustiveDeps from './rules/exhaustive-deps.rule' | ||
import * as exhaustiveDeps from './rules/exhaustive-deps/exhaustive-deps.rule' | ||
import * as stableQueryClient from './rules/stable-query-client/stable-query-client.rule' | ||
import * as noRestDestructuring from './rules/no-rest-desctructuring/no-rest-destructuring.rule' | ||
import * as noRestDestructuring from './rules/no-rest-destructuring/no-rest-destructuring.rule' | ||
import type { ESLintUtils } from '@typescript-eslint/utils' | ||
@@ -8,3 +8,7 @@ | ||
string, | ||
ESLintUtils.RuleModule<string, any, ESLintUtils.RuleListener> | ||
ESLintUtils.RuleModule< | ||
string, | ||
ReadonlyArray<unknown>, | ||
ESLintUtils.RuleListener | ||
> | ||
> = { | ||
@@ -11,0 +15,0 @@ [exhaustiveDeps.name]: exhaustiveDeps.rule, |
@@ -1,14 +0,12 @@ | ||
import { AST_NODE_TYPES } from '@typescript-eslint/utils' | ||
import { AST_NODE_TYPES, ESLintUtils } from '@typescript-eslint/utils' | ||
import { ASTUtils } from '../../utils/ast-utils' | ||
import { createRule } from '../../utils/create-rule' | ||
import { getDocsUrl } from '../../utils/get-docs-url' | ||
import { detectTanstackQueryImports } from '../../utils/detect-react-query-imports' | ||
import type { TSESLint } from '@typescript-eslint/utils' | ||
import type { ESLintUtils } from '@typescript-eslint/utils' | ||
export const name = 'stable-query-client' | ||
export const rule: ESLintUtils.RuleModule< | ||
string, | ||
any, | ||
ESLintUtils.RuleListener | ||
> = createRule({ | ||
const createRule = ESLintUtils.RuleCreator(getDocsUrl) | ||
export const rule = createRule({ | ||
name, | ||
@@ -34,3 +32,3 @@ meta: { | ||
create: (context, _, helpers) => { | ||
create: detectTanstackQueryImports((context, _, helpers) => { | ||
return { | ||
@@ -83,3 +81,3 @@ NewExpression: (node) => { | ||
} | ||
}, | ||
}), | ||
}) |
@@ -18,3 +18,3 @@ import { TSESTree } from '@typescript-eslint/utils' | ||
export type EnhancedCreate = ( | ||
type EnhancedCreate = ( | ||
context: Context, | ||
@@ -21,0 +21,0 @@ options: Options, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198769
91
3160