You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/plugins/eslint-plugin-react-hooks-extra/src/rules/no-direct-set-state-in-use-layout-effect.mdx
+5-9Lines changed: 5 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,6 @@
2
2
title: no-direct-set-state-in-use-layout-effect
3
3
---
4
4
5
-
<Callouttype="warning">This rule is experimental and may change in the future or be removed. It is not recommended to use it in production code at this time.</Callout>
6
-
7
5
**Full Name in `eslint-plugin-react-hooks-extra`**
Disallow **direct** calls to the [`set` function](https://react.dev/reference/react/useState#setstate) of `useState` in `useLayoutEffect`.
@@ -149,7 +141,11 @@ export default function RemoteContent() {
149
141
}
150
142
```
151
143
152
-
The following examples are derived from the [React documentation](https://react.dev/learn/you-might-not-need-an-effect):
144
+
<Callouttitle="TIP">
145
+
If you need to fetch remote data within the component, consider using libraries like [TanStack Query](https://tanstack.com/query/v3/) or [SWR](https://swr.vercel.app/). They handle caching, re-fetching, and state management for you, making your code cleaner and more efficient.
146
+
</Callout>
147
+
148
+
The following examples are derived from the [React Docs: You Might Not Need an Effect](https://react.dev/learn/you-might-not-need-an-effect):
Copy file name to clipboardExpand all lines: packages/plugins/eslint-plugin-react-naming-convention/src/rules/component-name.ts
-20Lines changed: 0 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -15,16 +15,6 @@ type Options = readonly [
15
15
|Case
16
16
|{
17
17
allowAllCaps?: boolean;
18
-
/**
19
-
* @todo Remove in the next major version
20
-
* @deprecated Component names now need to start with an uppercase letter instead of a non-lowercase letter. This means `_Button` or `_component` are no longer valid. (@kassens) in https://github.com/facebook/react/pull/25162
21
-
*/
22
-
allowLeadingUnderscore?: boolean;
23
-
/**
24
-
* @todo Remove in the next major version
25
-
* @deprecated This option has no actual effect on the rule
This rule enforces consistent file naming conventions for React components, hooks, and other project files.
24
+
25
+
By default, this rule enforces `PascalCase`, but it can be configured to support `camelCase`, `kebab-case`, or `snake_case` to match your project's standards.
# File name "component.tsx" does not match PascalCase.
46
+
```
40
47
41
-
src/components/example_component.tsx
42
-
1:1 error "File name `example_component.tsx` does not match `kebab-case`. Should rename to `example-component.tsx` @eslint-react/naming-convention/filename
48
+
```text title="ESLint Output"
49
+
src/components/component.tsx
50
+
1:1 error File name `component.tsx` does not match `PascalCase`. Should rename to `Component.tsx` @eslint-react/naming-convention/filename
The rule accepts an object with the following properties:
64
68
65
-
## Rule Options
69
+
-`rule`: The naming convention to enforce. Default: `"PascalCase"`.
70
+
-`"PascalCase"`: `ExampleComponent.tsx`
71
+
-`"camelCase"`: `exampleComponent.tsx`
72
+
-`"kebab-case"`: `example-component.tsx`
73
+
-`"snake_case"`: `example_component.tsx`
74
+
-`excepts`: An array of strings or regex patterns to exclude certain file names from this rule. The default exceptions are designed to accommodate common patterns in modern web frameworks:
0 commit comments