From 847036b577ee172f7fccb88097b27b124f7199fe Mon Sep 17 00:00:00 2001 From: Wonsuk Choi Date: Sun, 4 Oct 2026 11:49:45 +0900 Subject: [PATCH] docs(eslint-plugin-query): add JSDoc to the exported interfaces and type aliases (#11875) * docs(eslint-plugin-query): add JSDoc to the exported interfaces and type aliases * docs(eslint-plugin-query): name the exact config keys in the 'Plugin' description --- packages/eslint-plugin-query/src/index.ts | 4 ++++ .../src/rules/infinite-query-property-order/constants.ts | 6 ++++++ .../src/rules/mutation-property-order/constants.ts | 6 ++++++ packages/eslint-plugin-query/src/types.ts | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/packages/eslint-plugin-query/src/index.ts b/packages/eslint-plugin-query/src/index.ts index 085ba7b9f3..b558d004e6 100644 --- a/packages/eslint-plugin-query/src/index.ts +++ b/packages/eslint-plugin-query/src/index.ts @@ -4,6 +4,10 @@ import type { RuleModule } from '@typescript-eslint/utils/ts-eslint' type RuleKey = keyof typeof rules +/** + * The ESLint plugin object: its `rules`, and its configs — the legacy `recommended` and + * `recommendedStrict`, and the flat `flat/recommended` and `flat/recommended-strict`. + */ export interface Plugin extends Omit { rules: Record> configs: { diff --git a/packages/eslint-plugin-query/src/rules/infinite-query-property-order/constants.ts b/packages/eslint-plugin-query/src/rules/infinite-query-property-order/constants.ts index ec1f3ff287..11083028fd 100644 --- a/packages/eslint-plugin-query/src/rules/infinite-query-property-order/constants.ts +++ b/packages/eslint-plugin-query/src/rules/infinite-query-property-order/constants.ts @@ -4,6 +4,9 @@ export const infiniteQueryFunctions = [ 'useSuspenseInfiniteQuery', ] as const +/** + * The names of the functions whose options the `infinite-query-property-order` rule checks. + */ export type InfiniteQueryFunctions = (typeof infiniteQueryFunctions)[number] export const checkedProperties = [ @@ -12,6 +15,9 @@ export const checkedProperties = [ 'getNextPageParam', ] as const +/** + * The option properties whose order the `infinite-query-property-order` rule checks. + */ export type InfiniteQueryProperties = (typeof checkedProperties)[number] export const sortRules = [ diff --git a/packages/eslint-plugin-query/src/rules/mutation-property-order/constants.ts b/packages/eslint-plugin-query/src/rules/mutation-property-order/constants.ts index 04c809a694..d7f70fea22 100644 --- a/packages/eslint-plugin-query/src/rules/mutation-property-order/constants.ts +++ b/packages/eslint-plugin-query/src/rules/mutation-property-order/constants.ts @@ -1,9 +1,15 @@ export const mutationFunctions = ['useMutation'] as const +/** + * The names of the functions whose options the `mutation-property-order` rule checks. + */ export type MutationFunctions = (typeof mutationFunctions)[number] export const checkedProperties = ['onMutate', 'onError', 'onSettled'] as const +/** + * The option properties whose order the `mutation-property-order` rule checks. + */ export type MutationProperties = (typeof checkedProperties)[number] export const sortRules = [[['onMutate'], ['onError', 'onSettled']]] as const diff --git a/packages/eslint-plugin-query/src/types.ts b/packages/eslint-plugin-query/src/types.ts index 74c3053188..13bf301b78 100644 --- a/packages/eslint-plugin-query/src/types.ts +++ b/packages/eslint-plugin-query/src/types.ts @@ -1,3 +1,7 @@ +/** + * Extra fields in a rule's `meta.docs`: `recommended` is the rule's severity in the recommended + * configs, or `'strict'` if it is only enabled in the strict ones. + */ export type ExtraRuleDocs = { recommended: 'strict' | 'error' | 'warn' }