Skip to content

Commit 815ca6b

Browse files
committed
feat: enable context-name rule in recommended presets (#1024)
1 parent f78d4d1 commit 815ca6b

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

apps/website/content/docs/rules/overview.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Linter rules can have false positives, false negatives, and some rules are depen
125125
| Rule || 🌟 | Description |
126126
| :------------------------------------------------------------- | :- | :-: | :------------------------------------------------------------------------------- |
127127
| [`component-name`](./naming-convention-component-name) | 0️⃣ | `⚙️` | Enforces naming conventions for components |
128-
| [`context-name`](./naming-convention-context-name) | 0️⃣ | | Enforces context name to be a valid component name with the suffix `Context` |
128+
| [`context-name`](./naming-convention-context-name) | 1️⃣ | | Enforces context name to be a valid component name with the suffix `Context` |
129129
| [`filename`](./naming-convention-filename) | 0️⃣ | `⚙️` | Enforces consistent file naming conventions |
130130
| [`filename-extension`](./naming-convention-filename-extension) | 0️⃣ | `⚙️` | Enforces consistent use of the JSX file extension |
131131
| [`use-state`](./naming-convention-use-state) | 0️⃣ | | Enforces destructuring and symmetric naming of `useState` hook value and setter |

packages/plugins/eslint-plugin-react-naming-convention/src/configs/recommended.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ import type { RulePreset } from "@eslint-react/kit";
22

33
export const name = "react-naming-convention/recommended";
44

5-
export const rules = {} as const satisfies RulePreset;
5+
export const rules = {
6+
"react-naming-convention/context-name": "warn",
7+
// "react-naming-convention/use-state": "warn",
8+
} as const satisfies RulePreset;

packages/plugins/eslint-plugin-react-naming-convention/src/rules/context-name.md

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ react-naming-convention/context-name
1414
@eslint-react/naming-convention/context-name
1515
```
1616

17+
**Presets**
18+
19+
- `recommended`
20+
- `recommended-typescript`
21+
- `recommended-type-checked`
22+
1723
## Description
1824

1925
Enforces context name to be a valid component name with the suffix `Context`.

packages/plugins/eslint-plugin/src/configs/recommended.ts

+4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ export const rules = {
1313
...core.rules,
1414
...dom.rules,
1515
...webApi.rules,
16+
1617
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "warn",
1718
"@eslint-react/hooks-extra/no-unnecessary-use-prefix": "warn",
1819
"@eslint-react/hooks-extra/prefer-use-state-lazy-initialization": "warn",
20+
21+
"@eslint-react/naming-convention/context-name": "warn",
22+
// "@eslint-react/naming-convention/use-state": "warn",
1923
} as const satisfies RulePreset;
2024

2125
export const plugins = {

0 commit comments

Comments
 (0)