eslint-plugin-nextfriday 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +13 -30
  3. package/docs/rules/BOOLEAN_NAMING_PREFIX.md +7 -17
  4. package/docs/rules/ENFORCE_CONSTANT_CASE.md +5 -18
  5. package/docs/rules/ENFORCE_CURLY_NEWLINE.md +4 -4
  6. package/docs/rules/ENFORCE_HOOK_NAMING.md +5 -12
  7. package/docs/rules/ENFORCE_PROPS_SUFFIX.md +3 -21
  8. package/docs/rules/ENFORCE_READONLY_COMPONENT_PROPS.md +3 -12
  9. package/docs/rules/ENFORCE_SERVICE_NAMING.md +5 -9
  10. package/docs/rules/ENFORCE_SORTED_DESTRUCTURING.md +2 -2
  11. package/docs/rules/FILE_KEBAB_CASE.md +4 -54
  12. package/docs/rules/JSX_NEWLINE_BETWEEN_ELEMENTS.md +3 -3
  13. package/docs/rules/JSX_NO_INLINE_OBJECT_PROP.md +2 -2
  14. package/docs/rules/JSX_NO_NEWLINE_SINGLE_LINE_ELEMENTS.md +4 -2
  15. package/docs/rules/JSX_NO_NON_COMPONENT_FUNCTION.md +3 -3
  16. package/docs/rules/JSX_NO_VARIABLE_IN_CALLBACK.md +2 -2
  17. package/docs/rules/JSX_PASCAL_CASE.md +3 -43
  18. package/docs/rules/JSX_REQUIRE_SUSPENSE.md +2 -2
  19. package/docs/rules/JSX_SIMPLE_PROPS.md +2 -2
  20. package/docs/rules/JSX_SORT_PROPS.md +15 -11
  21. package/docs/rules/MD_FILENAME_CASE_RESTRICTION.md +4 -56
  22. package/docs/rules/NEWLINE_AFTER_MULTILINE_BLOCK.md +3 -3
  23. package/docs/rules/NEWLINE_BEFORE_RETURN.md +3 -3
  24. package/docs/rules/NEXTJS_REQUIRE_PUBLIC_ENV.md +3 -19
  25. package/docs/rules/NO_COMPLEX_INLINE_RETURN.md +7 -16
  26. package/docs/rules/NO_DIRECT_DATE.md +2 -2
  27. package/docs/rules/NO_EMOJI.md +4 -4
  28. package/docs/rules/NO_ENV_FALLBACK.md +2 -2
  29. package/docs/rules/NO_INLINE_DEFAULT_EXPORT.md +7 -11
  30. package/docs/rules/NO_INLINE_NESTED_OBJECT.md +3 -9
  31. package/docs/rules/NO_LAZY_IDENTIFIERS.md +8 -17
  32. package/docs/rules/NO_LOGIC_IN_PARAMS.md +7 -13
  33. package/docs/rules/NO_NESTED_TERNARY.md +4 -4
  34. package/docs/rules/NO_RELATIVE_IMPORTS.md +4 -4
  35. package/docs/rules/NO_SINGLE_CHAR_VARIABLES.md +9 -19
  36. package/docs/rules/PREFER_ASYNC_AWAIT.md +4 -4
  37. package/docs/rules/PREFER_DESTRUCTURING_PARAMS.md +7 -16
  38. package/docs/rules/PREFER_FUNCTION_DECLARATION.md +13 -24
  39. package/docs/rules/PREFER_GUARD_CLAUSE.md +4 -4
  40. package/docs/rules/PREFER_IMPORT_TYPE.md +9 -22
  41. package/docs/rules/PREFER_INTERFACE_OVER_INLINE_TYPES.md +7 -103
  42. package/docs/rules/PREFER_JSX_TEMPLATE_LITERALS.md +4 -2
  43. package/docs/rules/PREFER_NAMED_PARAM_TYPES.md +11 -83
  44. package/docs/rules/PREFER_REACT_IMPORT_TYPES.md +6 -57
  45. package/docs/rules/REACT_PROPS_DESTRUCTURE.md +6 -65
  46. package/docs/rules/REQUIRE_EXPLICIT_RETURN_TYPE.md +11 -21
  47. package/docs/rules/SORT_EXPORTS.md +2 -2
  48. package/docs/rules/SORT_IMPORTS.md +2 -2
  49. package/docs/rules/SORT_TYPE_ALPHABETICALLY.md +2 -2
  50. package/docs/rules/SORT_TYPE_REQUIRED_FIRST.md +2 -2
  51. package/lib/index.cjs +753 -742
  52. package/lib/index.cjs.map +1 -1
  53. package/lib/index.d.cts +70 -70
  54. package/lib/index.d.ts +70 -70
  55. package/lib/index.js +772 -761
  56. package/lib/index.js.map +1 -1
  57. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # eslint-plugin-nextfriday
2
2
 
3
+ ## 1.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#81](https://github.com/next-friday/eslint-plugin-nextfriday/pull/81) [`081326a`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/081326adf199aee711e97b1627def3bf867ad89c) Thanks [@joetakara](https://github.com/joetakara)! - Add hyphenated string group to jsx-sort-props for props like aria-label and data-slot. Fix jsx-newline-between-elements to include self-closing elements
8
+
9
+ ## 1.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#79](https://github.com/next-friday/eslint-plugin-nextfriday/pull/79) [`cb5ab46`](https://github.com/next-friday/eslint-plugin-nextfriday/commit/cb5ab460f758e1e57f9604417b673362ec6c71d8) Thanks [@joetakara](https://github.com/joetakara)! - Add expression group to jsx-sort-props rule for variable references, member expressions, and other dynamic values
14
+
3
15
  ## 1.16.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -48,7 +48,7 @@ export default [nextfriday.configs["nextjs/recommended"]];
48
48
 
49
49
  #### Bundled Plugin Configs
50
50
 
51
- Pre-configured configs for popular plugins. No extra install needed — they ship as dependencies.
51
+ Pre-configured configs for popular plugins. No extra install needed — they ship as dependencies. These configs are arrays, so use the spread operator (`...`) to merge them into your flat config.
52
52
 
53
53
  ```js
54
54
  import nextfriday from "eslint-plugin-nextfriday";
@@ -142,34 +142,7 @@ export default [
142
142
  ];
143
143
  ```
144
144
 
145
- ### Legacy Config (ESLint 8 and below)
146
-
147
- #### Base Legacy Configuration
148
-
149
- ```js
150
- module.exports = {
151
- plugins: ["nextfriday"],
152
- extends: ["plugin:nextfriday/base"], // or "plugin:nextfriday/base/recommended"
153
- };
154
- ```
155
-
156
- #### React Legacy Configuration
157
-
158
- ```js
159
- module.exports = {
160
- plugins: ["nextfriday"],
161
- extends: ["plugin:nextfriday/react"], // or "plugin:nextfriday/react/recommended"
162
- };
163
- ```
164
-
165
- #### Next.js Legacy Configuration
166
-
167
- ```js
168
- module.exports = {
169
- plugins: ["nextfriday"],
170
- extends: ["plugin:nextfriday/nextjs"], // or "plugin:nextfriday/nextjs/recommended"
171
- };
172
- ```
145
+ > **Note:** This plugin requires ESLint 9+ and only supports the flat config format. Legacy `.eslintrc` configurations are not supported.
173
146
 
174
147
  ## Rules
175
148
 
@@ -354,6 +327,16 @@ Additionally included in `nextjs`, `nextjs/recommended` only:
354
327
  - **Clean code practices**: Prevents emoji usage, enforces parameter destructuring, and more
355
328
  - **Formatting rules**: Enforces consistent blank lines around multi-line blocks and return statements
356
329
 
330
+ ## Agent Skill
331
+
332
+ This plugin ships with an [Agent Skill](https://github.com/anthropics/skills) that teaches AI coding assistants (Claude Code, Cursor, etc.) all 51 rules so they generate compliant code from the start.
333
+
334
+ ```bash
335
+ npx skills add next-friday/eslint-plugin-nextfriday --skill eslint-plugin-nextfriday
336
+ ```
337
+
338
+ Once installed, AI assistants will automatically follow the naming, code style, type, JSX, import, and formatting patterns enforced by this plugin — reducing lint errors to zero.
339
+
357
340
  ## Need Help?
358
341
 
359
342
  If you encounter any issues or have questions:
@@ -363,4 +346,4 @@ If you encounter any issues or have questions:
363
346
 
364
347
  ## License
365
348
 
366
- MIT - feel free to use this plugin in your projects!
349
+ MIT
@@ -8,9 +8,11 @@ This rule enforces that boolean variables and parameters use a descriptive prefi
8
8
 
9
9
  **Recommended prefixes:** `is`, `has`, `should`, `can`, `did`, `will`, `was`, `are`, `does`, `had`
10
10
 
11
- **Incorrect** code for this rule:
11
+ ## Examples
12
12
 
13
- ```typescript
13
+ ### Incorrect
14
+
15
+ ```ts
14
16
  const valid = true;
15
17
  const user = false;
16
18
  const open = true;
@@ -30,9 +32,9 @@ const fn = (enabled: boolean) => {};
30
32
  function toggle(active = true) {}
31
33
  ```
32
34
 
33
- **Correct** code for this rule:
35
+ ### Correct
34
36
 
35
- ```typescript
37
+ ```ts
36
38
  const isValid = true;
37
39
  const hasUser = false;
38
40
  const isOpen = true;
@@ -78,24 +80,12 @@ The rule identifies boolean variables and parameters by:
78
80
  | `does` | Action capability | `doesExist`, `doesMatch`, `doesContain` |
79
81
  | `had` | Past possession | `hadError`, `hadAccess`, `hadPrevious` |
80
82
 
81
- ## Benefits
82
-
83
- - **Self-documenting code**: Boolean intent is immediately clear
84
- - **Reads like English**: `if (isActive)` reads as "if is active"
85
- - **Reduced ambiguity**: `user = false` vs `hasUser = false` - the latter is clear
86
- - **Consistent codebase**: Enforces uniform boolean naming across the project
87
- - **Better code review**: Reviewers can quickly understand boolean logic
88
-
89
- ## When Not To Use
83
+ ## When Not To Use It
90
84
 
91
85
  - When working with external APIs that return boolean fields with different naming conventions
92
86
  - In mathematical or scientific code where single-letter variables are conventional
93
87
  - When interfacing with legacy code that would require extensive refactoring
94
88
 
95
- ## Configuration
96
-
97
- This rule has no configuration options.
98
-
99
89
  ## Related Rules
100
90
 
101
91
  - [no-single-char-variables](./NO_SINGLE_CHAR_VARIABLES.md) - Disallows single character variable names
@@ -4,19 +4,13 @@ Enforce SCREAMING_SNAKE_CASE for constant primitive values.
4
4
 
5
5
  ## Rule Details
6
6
 
7
- This rule ensures that `const` declarations with primitive values (strings, numbers, booleans, template literals) use SCREAMING_SNAKE_CASE naming convention.
8
-
9
- ### Why?
10
-
11
- - **Clarity**: SCREAMING_SNAKE_CASE clearly indicates a value is a constant that shouldn't change
12
- - **Convention**: Follows common JavaScript/TypeScript naming patterns for constants
13
- - **Readability**: Makes it easy to distinguish constants from regular variables
7
+ This rule ensures that `const` declarations with primitive values (strings, numbers, booleans, template literals) use SCREAMING_SNAKE_CASE naming convention. Objects, arrays, and functions are not checked. Only `const` declarations are checked; `let` and `var` are ignored.
14
8
 
15
9
  ## Examples
16
10
 
17
- ### Incorrect
11
+ ### Incorrect
18
12
 
19
- ```typescript
13
+ ```ts
20
14
  const defaultCover = "/images/default.jpg";
21
15
  const pageLimit = 10;
22
16
  const isEnabled = true;
@@ -24,9 +18,9 @@ const apiBaseUrl = "https://api.example.com";
24
18
  const template = `hello world`;
25
19
  ```
26
20
 
27
- ### Correct
21
+ ### Correct
28
22
 
29
- ```typescript
23
+ ```ts
30
24
  const DEFAULT_COVER = "/images/default.jpg";
31
25
  const PAGE_LIMIT = 10;
32
26
  const IS_ENABLED = true;
@@ -47,10 +41,3 @@ var pageLimit = 10;
47
41
 
48
42
  - If your project uses different naming conventions for constants
49
43
  - If you prefer camelCase for all variable declarations
50
-
51
- ## Notes
52
-
53
- - Only applies to `const` declarations
54
- - Only applies to primitive values: strings, numbers, booleans, template literals
55
- - Objects, arrays, and functions are not checked (can use camelCase/PascalCase)
56
- - `let` and `var` declarations are not checked
@@ -13,9 +13,9 @@ This rule manages curly braces for `IfStatement` based on visual layout (line br
13
13
 
14
14
  ## Examples
15
15
 
16
- ### Incorrect
16
+ ### Incorrect
17
17
 
18
- ```tsx
18
+ ```ts
19
19
  // Single-line with braces (BAD)
20
20
  if (!data) {
21
21
  return [];
@@ -30,9 +30,9 @@ if (veryLongCondition && anotherCondition) return [];
30
30
  if (condition) doSomething();
31
31
  ```
32
32
 
33
- ### Correct
33
+ ### Correct
34
34
 
35
- ```tsx
35
+ ```ts
36
36
  // Single-line without braces (GOOD)
37
37
  if (!data) return [];
38
38
  if (x > 0) doSomething();
@@ -4,7 +4,7 @@ Enforce `use` prefix for functions in custom hook files (`*.hook.ts`, `*.hooks.t
4
4
 
5
5
  ## Rule Details
6
6
 
7
- This rule ensures that all exported functions in custom hook files follow React's hook naming convention by starting with `use`.
7
+ This rule ensures that all exported functions in custom hook files (`*.hook.ts`, `*.hooks.ts`) follow React's hook naming convention by starting with `use`.
8
8
 
9
9
  ### Why?
10
10
 
@@ -14,9 +14,9 @@ This rule ensures that all exported functions in custom hook files follow React'
14
14
 
15
15
  ## Examples
16
16
 
17
- ### Incorrect
17
+ ### Incorrect
18
18
 
19
- ```typescript
19
+ ```ts
20
20
  // search-params.hook.ts
21
21
  export function searchParamsHandler() {}
22
22
  export default handleSearch;
@@ -26,9 +26,9 @@ export const authManager = () => {};
26
26
  export default function customHook() {}
27
27
  ```
28
28
 
29
- ### Correct
29
+ ### Correct
30
30
 
31
- ```typescript
31
+ ```ts
32
32
  // search-params.hook.ts
33
33
  export function useSearchParamsHandler() {}
34
34
  export default useSearchParamsHandler;
@@ -42,10 +42,3 @@ export default function useCustomHook() {}
42
42
 
43
43
  - If your project uses a different naming convention for hook files
44
44
  - If you don't use the `*.hook.ts` or `*.hooks.ts` file naming pattern
45
-
46
- ## Applies To
47
-
48
- This rule only applies to files matching:
49
-
50
- - `*.hook.ts`
51
- - `*.hooks.ts`
@@ -4,17 +4,11 @@ Enforce `Props` suffix for interfaces and types in component files (`*.tsx`, `*.
4
4
 
5
5
  ## Rule Details
6
6
 
7
- This rule ensures that all interfaces and object type aliases in React component files end with the `Props` suffix for consistency and clarity.
8
-
9
- ### Why?
10
-
11
- - **Clarity**: Clearly identifies types that represent component props
12
- - **Consistency**: Standardizes naming across all component files
13
- - **Convention**: Follows common React/TypeScript naming patterns
7
+ This rule ensures that all interfaces and object type aliases in React component files (`.tsx`, `.jsx`) end with the `Props` suffix. Only interfaces and type aliases with object literal types are checked; union types, function types, and type references are not affected.
14
8
 
15
9
  ## Examples
16
10
 
17
- ### Incorrect
11
+ ### Incorrect
18
12
 
19
13
  ```tsx
20
14
  // Button.tsx
@@ -25,7 +19,7 @@ interface Card {
25
19
  type ButtonType = { disabled: boolean };
26
20
  ```
27
21
 
28
- ### Correct
22
+ ### Correct
29
23
 
30
24
  ```tsx
31
25
  // Button.tsx
@@ -46,15 +40,3 @@ type ButtonState = SomeOtherType;
46
40
 
47
41
  - If your project uses different naming conventions for prop types
48
42
  - If you have utility types in component files that shouldn't end with `Props`
49
-
50
- ## Applies To
51
-
52
- This rule only applies to files with extensions:
53
-
54
- - `.tsx`
55
- - `.jsx`
56
-
57
- ## Notes
58
-
59
- - Only interfaces and type aliases with object literal types are checked
60
- - Union types, function types, and type references are not affected
@@ -8,7 +8,7 @@ This rule enforces that React component props using named types (interfaces or t
8
8
 
9
9
  ## Examples
10
10
 
11
- ### Incorrect
11
+ ### Incorrect
12
12
 
13
13
  ```tsx
14
14
  interface Props {
@@ -35,7 +35,7 @@ function Layout(props: LayoutProps) {
35
35
  }
36
36
  ```
37
37
 
38
- ### Correct
38
+ ### Correct
39
39
 
40
40
  ```tsx
41
41
  interface Props {
@@ -77,7 +77,7 @@ const helper = (props: HelperProps) => {
77
77
  };
78
78
  ```
79
79
 
80
- ## When Not To Use
80
+ ## When Not To Use It
81
81
 
82
82
  This rule should not be used if:
83
83
 
@@ -93,12 +93,3 @@ This rule is fixable using ESLint's `--fix` option. The fixer will automatically
93
93
 
94
94
  - [`prefer-interface-over-inline-types`](./PREFER_INTERFACE_OVER_INLINE_TYPES.md) - Enforces interface declarations over inline types
95
95
  - [`react-props-destructure`](./REACT_PROPS_DESTRUCTURE.md) - Enforces destructuring props inside component body
96
-
97
- ## Configuration
98
-
99
- This rule is included in the following configurations:
100
-
101
- - `react` (warn)
102
- - `react/recommended` (error)
103
- - `nextjs` (warn)
104
- - `nextjs/recommended` (error)
@@ -4,7 +4,7 @@ Enforce `fetch` prefix for async functions in `*.service.ts` files instead of `g
4
4
 
5
5
  ## Rule Details
6
6
 
7
- This rule ensures consistent naming conventions for service layer functions. In service files, async data-fetching functions should use the `fetch` prefix to clearly indicate they perform network/API calls.
7
+ This rule ensures consistent naming conventions for service layer functions. In `*.service.ts` files, async data-fetching functions should use the `fetch` prefix to clearly indicate they perform network/API calls.
8
8
 
9
9
  ### Why?
10
10
 
@@ -14,9 +14,9 @@ This rule ensures consistent naming conventions for service layer functions. In
14
14
 
15
15
  ## Examples
16
16
 
17
- ### Incorrect
17
+ ### Incorrect
18
18
 
19
- ```typescript
19
+ ```ts
20
20
  // article.service.ts
21
21
  export async function getArticles() {}
22
22
  export async function loadFaq() {}
@@ -24,9 +24,9 @@ export async function getUserById() {}
24
24
  export const getUsers = async () => {};
25
25
  ```
26
26
 
27
- ### Correct
27
+ ### Correct
28
28
 
29
- ```typescript
29
+ ```ts
30
30
  // article.service.ts
31
31
  export async function fetchArticles() {}
32
32
  export async function fetchFaqList() {}
@@ -46,7 +46,3 @@ export async function deleteComment() {}
46
46
 
47
47
  - If your project uses different naming conventions for service functions
48
48
  - If you prefer `get`/`load` prefixes for data-fetching operations
49
-
50
- ## Applies To
51
-
52
- This rule only applies to files matching `*.service.ts`.
@@ -24,7 +24,7 @@ Properties are sorted in this order:
24
24
 
25
25
  ## Examples
26
26
 
27
- ### Incorrect
27
+ ### Incorrect
28
28
 
29
29
  ```js
30
30
  // Bad: Not sorted alphabetically
@@ -66,7 +66,7 @@ const { b, a } = foo;
66
66
  const { duration = 5000, autoplay = false, totalSlides } = options;
67
67
  ```
68
68
 
69
- ### Correct
69
+ ### Correct
70
70
 
71
71
  ```js
72
72
  // Good: Alphabetically sorted without defaults
@@ -4,13 +4,13 @@ Enforce kebab-case filenames for .ts and .js files.
4
4
 
5
5
  ## Rule Details
6
6
 
7
- This rule enforces that all TypeScript (.ts) and JavaScript (.js) files use kebab-case naming convention for their **filenames**. Kebab-case uses lowercase letters and hyphens to separate words, making filenames more consistent and URL-friendly.
7
+ This rule enforces that all TypeScript (.ts) and JavaScript (.js) files use kebab-case naming convention for their **filenames**. Kebab-case uses lowercase letters and hyphens to separate words, making filenames more consistent and URL-friendly. Single word filenames are considered valid kebab-case.
8
8
 
9
- **This rule checks the filename, not the code content.**
9
+ **This rule checks the filename, not the code content.** Only `.ts` and `.js` files are checked; other file types are ignored.
10
10
 
11
11
  ## Examples
12
12
 
13
- **Incorrect** filenames for this rule:
13
+ ### Incorrect
14
14
 
15
15
  - `MyFile.ts` (PascalCase)
16
16
  - `camelCase.js` (camelCase)
@@ -19,7 +19,7 @@ This rule enforces that all TypeScript (.ts) and JavaScript (.js) files use keba
19
19
  - `UPPERCASE.ts` (UPPERCASE)
20
20
  - `My File.js` (contains spaces)
21
21
 
22
- **Correct** filenames for this rule:
22
+ ### Correct
23
23
 
24
24
  - `my-file.ts`
25
25
  - `kebab-case.js`
@@ -28,56 +28,6 @@ This rule enforces that all TypeScript (.ts) and JavaScript (.js) files use keba
28
28
  - `user-service.ts`
29
29
  - `api-utils.ts`
30
30
 
31
- ## Code Examples
32
-
33
- The content of the file doesn't matter - only the filename is checked:
34
-
35
- ```typescript
36
- // INCORRECT: File: MyFile.ts (incorrect filename)
37
- function myFunction() {
38
- return "Hello World";
39
- }
40
-
41
- export { myFunction };
42
- ```
43
-
44
- ```typescript
45
- // CORRECT: File: my-file.ts (correct filename)
46
- function myFunction() {
47
- return "Hello World";
48
- }
49
-
50
- export { myFunction };
51
- ```
52
-
53
- ```javascript
54
- // INCORRECT: File: UserService.js (incorrect filename)
55
- class UserService {
56
- getUser() {
57
- return {};
58
- }
59
- }
60
-
61
- export { UserService };
62
- ```
63
-
64
- ```javascript
65
- // CORRECT: File: user-service.js (correct filename)
66
- class UserService {
67
- getUser() {
68
- return {};
69
- }
70
- }
71
-
72
- export { UserService };
73
- ```
74
-
75
31
  ## When Not To Use It
76
32
 
77
33
  If your project has established naming conventions that conflict with kebab-case, or if you're working with frameworks that require specific filename patterns, you may want to disable this rule.
78
-
79
- ## Notes
80
-
81
- - This rule only applies to `.ts` and `.js` files
82
- - Other file types (`.jsx`, `.tsx`, `.json`, etc.) are ignored
83
- - Single word filenames are considered valid kebab-case
@@ -6,9 +6,9 @@ Require empty lines between sibling JSX elements when at least one spans multipl
6
6
 
7
7
  This rule enforces empty lines between sibling JSX elements when either element spans multiple lines. This improves visual separation and readability of complex component structures. Single-line elements do not require empty lines between them.
8
8
 
9
- ### Examples
9
+ ## Examples
10
10
 
11
- #### Incorrect
11
+ ### Incorrect
12
12
 
13
13
  ```jsx
14
14
  function Dashboard() {
@@ -37,7 +37,7 @@ function UserProfile() {
37
37
  }
38
38
  ```
39
39
 
40
- #### Correct
40
+ ### Correct
41
41
 
42
42
  Multi-line elements need empty lines between them:
43
43
 
@@ -14,7 +14,7 @@ This rule flags inline object literals used directly as JSX prop values. Inline
14
14
 
15
15
  ## Examples
16
16
 
17
- ### Incorrect
17
+ ### Incorrect
18
18
 
19
19
  ```tsx
20
20
  <Component style={{ color: "red" }} />
@@ -23,7 +23,7 @@ This rule flags inline object literals used directly as JSX prop values. Inline
23
23
  <div style={{ margin: 0 }} />
24
24
  ```
25
25
 
26
- ### Correct
26
+ ### Correct
27
27
 
28
28
  ```tsx
29
29
  const style = { color: "red" };
@@ -2,6 +2,8 @@
2
2
 
3
3
  Disallow empty lines between single-line sibling JSX elements.
4
4
 
5
+ > This rule is auto-fixable using `--fix`.
6
+
5
7
  ## Rule Details
6
8
 
7
9
  This rule enforces that sibling JSX elements which are both single-line should not have empty lines between them. Single-line elements should be compact and grouped together.
@@ -16,7 +18,7 @@ Use with `jsx-newline-between-elements` which requires empty lines between multi
16
18
 
17
19
  ## Examples
18
20
 
19
- ### Incorrect
21
+ ### Incorrect
20
22
 
21
23
  ```tsx
22
24
  // Bad: Unnecessary empty line between single-line siblings
@@ -38,7 +40,7 @@ Use with `jsx-newline-between-elements` which requires empty lines between multi
38
40
  </ul>
39
41
  ```
40
42
 
41
- ### Correct
43
+ ### Correct
42
44
 
43
45
  ```tsx
44
46
  // Good: Single-line siblings are compact
@@ -18,7 +18,7 @@ This rule prevents non-component functions from being defined at the top level i
18
18
 
19
19
  ## Examples
20
20
 
21
- ### Incorrect
21
+ ### Incorrect
22
22
 
23
23
  ```tsx
24
24
  // Bad: Non-component function defined at top level in .tsx file
@@ -62,7 +62,7 @@ const OrderSummary = () => {
62
62
  export { OrderSummary };
63
63
  ```
64
64
 
65
- ### Correct
65
+ ### Correct
66
66
 
67
67
  ```tsx
68
68
  // Good: Function imported from separate file
@@ -91,7 +91,7 @@ const Component = () => {
91
91
  };
92
92
  ```
93
93
 
94
- ```typescript
94
+ ```ts
95
95
  // Good: Functions in .ts or .js files are allowed
96
96
  // utils.ts
97
97
  function helper(name: string) {
@@ -15,7 +15,7 @@ This rule prevents variable declarations inside callback functions that are dire
15
15
 
16
16
  ## Examples
17
17
 
18
- ### Incorrect
18
+ ### Incorrect
19
19
 
20
20
  ```tsx
21
21
  // Bad: Variable declared inside map callback in JSX
@@ -61,7 +61,7 @@ const OrderSummary = ({ orders }) => {
61
61
  };
62
62
  ```
63
63
 
64
- ### Correct
64
+ ### Correct
65
65
 
66
66
  ```tsx
67
67
  // Good: Extract logic to a separate function
@@ -10,7 +10,7 @@ This rule enforces that JSX and TSX files use PascalCase naming convention for t
10
10
 
11
11
  ## Examples
12
12
 
13
- **Incorrect** filenames for this rule:
13
+ ### Incorrect
14
14
 
15
15
  - `my-component.jsx` (kebab-case)
16
16
  - `userProfile.jsx` (camelCase)
@@ -20,7 +20,7 @@ This rule enforces that JSX and TSX files use PascalCase naming convention for t
20
20
  - `My Component.jsx` (contains spaces)
21
21
  - `My.Component.tsx` (contains dots)
22
22
 
23
- **Correct** filenames for this rule:
23
+ ### Correct
24
24
 
25
25
  - `MyComponent.jsx`
26
26
  - `UserProfile.tsx`
@@ -28,47 +28,7 @@ This rule enforces that JSX and TSX files use PascalCase naming convention for t
28
28
  - `LoginForm.tsx`
29
29
  - `UserProfile2.jsx` (PascalCase with numbers)
30
30
 
31
- ## Code Examples
32
-
33
- The content of the file doesn't matter - only the filename is checked:
34
-
35
- ```jsx
36
- // INCORRECT: File: my-component.jsx (incorrect filename)
37
- function MyComponent() {
38
- return <div>Hello</div>;
39
- }
40
-
41
- export default MyComponent;
42
- ```
43
-
44
- ```jsx
45
- // CORRECT: File: MyComponent.jsx (correct filename)
46
- function MyComponent() {
47
- return <div>Hello</div>;
48
- }
49
-
50
- export default MyComponent;
51
- ```
52
-
53
- ```tsx
54
- // INCORRECT: File: user-profile.tsx (incorrect filename)
55
- function UserProfile() {
56
- return <div>Profile</div>;
57
- }
58
-
59
- export default UserProfile;
60
- ```
61
-
62
- ```tsx
63
- // CORRECT: File: UserProfile.tsx (correct filename)
64
- function UserProfile() {
65
- return <div>Profile</div>;
66
- }
67
-
68
- export default UserProfile;
69
- ```
70
-
71
- ## When Not To Use
31
+ ## When Not To Use It
72
32
 
73
33
  If your project uses different naming conventions for JSX/TSX files, you can disable this rule.
74
34
 
@@ -14,7 +14,7 @@ This rule ensures that components created with `lazy()` or `React.lazy()` are al
14
14
 
15
15
  ## Examples
16
16
 
17
- ### Incorrect
17
+ ### Incorrect
18
18
 
19
19
  ```tsx
20
20
  const AsyncComponent = lazy(() => import("./Component"));
@@ -29,7 +29,7 @@ const LazyModal = React.lazy(() => import("./Modal"));
29
29
  </div>
30
30
  ```
31
31
 
32
- ### Correct
32
+ ### Correct
33
33
 
34
34
  ```tsx
35
35
  const AsyncComponent = lazy(() => import("./Component"));