From 265b2c76d7d5e0e4b044af72272b687d10b3203e Mon Sep 17 00:00:00 2001 From: Rel1cx Date: Wed, 1 Oct 2025 03:02:18 +0800 Subject: [PATCH] Update recommended presets, closes #1251 --- apps/website/content/docs/rules/overview.mdx | 2 +- .../src/configs/recommended.ts | 2 +- .../src/rules/use-state.mdx | 6 ++++++ packages/plugins/eslint-plugin/src/configs/recommended.ts | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/website/content/docs/rules/overview.mdx b/apps/website/content/docs/rules/overview.mdx index f8029e141..ed89c1644 100644 --- a/apps/website/content/docs/rules/overview.mdx +++ b/apps/website/content/docs/rules/overview.mdx @@ -140,7 +140,7 @@ full: true | [`context-name`](./naming-convention-context-name) | 1️⃣ | | Enforces context name to be a valid component name with the suffix `Context` | | [`filename`](./naming-convention-filename) | 0️⃣ | `⚙️` | Enforces consistent file naming conventions | | [`filename-extension`](./naming-convention-filename-extension) | 0️⃣ | `⚙️` | Enforces consistent use of the JSX file extension | -| [`use-state`](./naming-convention-use-state) | 0️⃣ | | Enforces destructuring and symmetric naming of `useState` hook value and setter | +| [`use-state`](./naming-convention-use-state) | 1️⃣ | | Enforces destructuring and symmetric naming of `useState` hook value and setter | ## Debug Rules diff --git a/packages/plugins/eslint-plugin-react-naming-convention/src/configs/recommended.ts b/packages/plugins/eslint-plugin-react-naming-convention/src/configs/recommended.ts index 86de6e029..73154d542 100644 --- a/packages/plugins/eslint-plugin-react-naming-convention/src/configs/recommended.ts +++ b/packages/plugins/eslint-plugin-react-naming-convention/src/configs/recommended.ts @@ -4,5 +4,5 @@ export const name = "react-naming-convention/recommended"; export const rules = { "react-naming-convention/context-name": "warn", - // "react-naming-convention/use-state": "warn", + "react-naming-convention/use-state": "warn", } as const satisfies Record; diff --git a/packages/plugins/eslint-plugin-react-naming-convention/src/rules/use-state.mdx b/packages/plugins/eslint-plugin-react-naming-convention/src/rules/use-state.mdx index 507d2c7e1..81add0155 100644 --- a/packages/plugins/eslint-plugin-react-naming-convention/src/rules/use-state.mdx +++ b/packages/plugins/eslint-plugin-react-naming-convention/src/rules/use-state.mdx @@ -14,6 +14,12 @@ react-naming-convention/use-state @eslint-react/naming-convention/use-state ``` +**Presets** + +- `recommended` +- `recommended-typescript` +- `recommended-type-checked` + ## Description Enforces destructuring and symmetric naming of `useState` hook value and setter. diff --git a/packages/plugins/eslint-plugin/src/configs/recommended.ts b/packages/plugins/eslint-plugin/src/configs/recommended.ts index 9b8964e47..c9c91782a 100644 --- a/packages/plugins/eslint-plugin/src/configs/recommended.ts +++ b/packages/plugins/eslint-plugin/src/configs/recommended.ts @@ -13,9 +13,9 @@ export const rules = { ...x.rules, ...dom.rules, ...webApi.rules, - + "@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "warn", "@eslint-react/naming-convention/context-name": "warn", - // "@eslint-react/naming-convention/use-state": "warn", + "@eslint-react/naming-convention/use-state": "warn", } as const satisfies Record; export const plugins = {