diff --git a/apps/website/content/docs/rules/overview.mdx b/apps/website/content/docs/rules/overview.mdx index deefb5285..938fe0781 100644 --- a/apps/website/content/docs/rules/overview.mdx +++ b/apps/website/content/docs/rules/overview.mdx @@ -125,7 +125,7 @@ Linter rules can have false positives, false negatives, and some rules are depen | Rule | ✅ | 🌟 | Description | | :------------------------------------------------------------- | :- | :-: | :------------------------------------------------------------------------------- | | [`component-name`](./naming-convention-component-name) | 0️⃣ | `⚙️` | Enforces naming conventions for components | -| [`context-name`](./naming-convention-context-name) | 0️⃣ | | Enforces context name to be a valid component name with the suffix `Context` | +| [`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 | 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 c6126d3c5..e62065a87 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 @@ -2,4 +2,7 @@ import type { RulePreset } from "@eslint-react/kit"; export const name = "react-naming-convention/recommended"; -export const rules = {} as const satisfies RulePreset; +export const rules = { + "react-naming-convention/context-name": "warn", + // "react-naming-convention/use-state": "warn", +} as const satisfies RulePreset; diff --git a/packages/plugins/eslint-plugin-react-naming-convention/src/rules/context-name.md b/packages/plugins/eslint-plugin-react-naming-convention/src/rules/context-name.md index 4f2d1e0d9..0b273027d 100644 --- a/packages/plugins/eslint-plugin-react-naming-convention/src/rules/context-name.md +++ b/packages/plugins/eslint-plugin-react-naming-convention/src/rules/context-name.md @@ -14,6 +14,12 @@ react-naming-convention/context-name @eslint-react/naming-convention/context-name ``` +**Presets** + +- `recommended` +- `recommended-typescript` +- `recommended-type-checked` + ## Description Enforces context name to be a valid component name with the suffix `Context`. diff --git a/packages/plugins/eslint-plugin/src/configs/recommended.ts b/packages/plugins/eslint-plugin/src/configs/recommended.ts index 8a83a218e..972a63c24 100644 --- a/packages/plugins/eslint-plugin/src/configs/recommended.ts +++ b/packages/plugins/eslint-plugin/src/configs/recommended.ts @@ -13,9 +13,13 @@ export const rules = { ...core.rules, ...dom.rules, ...webApi.rules, + "@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "warn", "@eslint-react/hooks-extra/no-unnecessary-use-prefix": "warn", "@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn", + + "@eslint-react/naming-convention/context-name": "warn", + // "@eslint-react/naming-convention/use-state": "warn", } as const satisfies RulePreset; export const plugins = {