eslint-plugin-code-style 2.1.1 → 2.2.1

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.
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  **A powerful ESLint plugin for enforcing consistent code formatting and style rules in React/JSX projects.**
21
21
 
22
- *80 rules (70 auto-fixable, 19 configurable) to keep your codebase clean and consistent*
22
+ *81 rules (71 auto-fixable, 20 configurable) to keep your codebase clean and consistent*
23
23
 
24
24
  </div>
25
25
 
@@ -27,7 +27,7 @@
27
27
 
28
28
  ## 🎯 Why This Plugin?
29
29
 
30
- This plugin provides **80 custom rules** (70 auto-fixable, 19 configurable) for code formatting. Built for **ESLint v9 flat configs**.
30
+ This plugin provides **81 custom rules** (71 auto-fixable, 20 configurable) for code formatting. Built for **ESLint v9 flat configs**.
31
31
 
32
32
  > **Note:** ESLint [deprecated 79 formatting rules](https://eslint.org/blog/2023/10/deprecating-formatting-rules/) in v8.53.0. Our recommended configs use `@stylistic/eslint-plugin` as the replacement for these deprecated rules.
33
33
 
@@ -36,7 +36,7 @@ This plugin provides **80 custom rules** (70 auto-fixable, 19 configurable) for
36
36
  - **Works alongside existing tools** — Complements ESLint's built-in rules and packages like eslint-plugin-react, eslint-plugin-import, etc
37
37
  - **Self-sufficient rules** — Each rule handles complete formatting independently
38
38
  - **Consistency at scale** — Reduces code-style differences between team members by enforcing uniform formatting across your projects
39
- - **Highly automated** — 70 of 80 rules support auto-fix with `eslint --fix`
39
+ - **Highly automated** — 71 of 81 rules support auto-fix with `eslint --fix`
40
40
 
41
41
  When combined with ESLint's native rules and other popular plugins, this package helps create a complete code style solution that keeps your codebase clean and consistent.
42
42
 
@@ -60,7 +60,7 @@ We provide **ready-to-use ESLint flat configuration files** that combine `eslint
60
60
 
61
61
  ### 💡 Why Use These Configs?
62
62
 
63
- - **Complete Coverage** — Combines ESLint built-in rules, third-party plugins, and all 80 code-style rules
63
+ - **Complete Coverage** — Combines ESLint built-in rules, third-party plugins, and all 81 code-style rules
64
64
  - **Ready-to-Use** — Copy the config file and start linting immediately
65
65
  - **Battle-Tested** — These configurations have been refined through real-world usage
66
66
  - **Fully Documented** — Each config includes detailed instructions and explanations
@@ -97,7 +97,7 @@ We provide **ready-to-use ESLint flat configuration files** that combine `eslint
97
97
  <td width="50%">
98
98
 
99
99
  ### 🔧 Auto-Fixable Rules
100
- **70 rules** support automatic fixing with `eslint --fix`. **19 rules** have configurable options. 10 rules are report-only (require manual changes).
100
+ **71 rules** support automatic fixing with `eslint --fix`. **20 rules** have configurable options. 10 rules are report-only (require manual changes).
101
101
 
102
102
  </td>
103
103
  <td width="50%">
@@ -217,6 +217,7 @@ rules: {
217
217
  "code-style/hook-callback-format": "error",
218
218
  "code-style/hook-deps-per-line": "error",
219
219
  "code-style/hook-file-naming-convention": "error",
220
+ "code-style/hook-function-naming-convention": "error",
220
221
  "code-style/use-state-naming-convention": "error",
221
222
  "code-style/if-else-spacing": "error",
222
223
  "code-style/if-statement-format": "error",
@@ -270,7 +271,7 @@ rules: {
270
271
 
271
272
  ## 📖 Rules Categories
272
273
 
273
- > **80 rules total** — 70 with auto-fix 🔧, 19 configurable ⚙️, 10 report-only. See detailed examples in the [Rules Reference](./docs/rules/).
274
+ > **81 rules total** — 71 with auto-fix 🔧, 20 configurable ⚙️, 10 report-only. See detailed examples in the [Rules Reference](./docs/rules/).
274
275
  >
275
276
  > **Legend:** 🔧 Auto-fixable with `eslint --fix` • ⚙️ Customizable options
276
277
 
@@ -297,7 +298,7 @@ rules: {
297
298
  | **Component Rules** | |
298
299
  | `component-props-destructure` | Component props must be destructured `({ prop })` not received as `(props)` 🔧 |
299
300
  | `component-props-inline-type` | Inline type annotation `} : {` with matching props, proper spacing, commas, no interface reference 🔧 |
300
- | `folder-based-naming-convention` | Enforce naming based on folder: suffix for views/layouts/pages/providers/reducers/contexts/themes, camelCase suffix for data/constants/strings/services/reducers folders, chained folder names for nested files 🔧 |
301
+ | `folder-based-naming-convention` | Enforce naming based on folder: suffix for views/layouts/pages/providers/reducers/contexts/themes, camelCase suffix for data/constants/strings/services/reducers folders, chained folder names for nested files, singularizes plural folders 🔧 ⚙️ |
301
302
  | `folder-structure-consistency` | Enforce consistent folder structure (flat vs wrapped) in module folders (atoms, components, hooks, enums, views, etc.) ⚙️ |
302
303
  | `no-redundant-folder-suffix` | Disallow file and folder names that redundantly include the parent folder name as a suffix |
303
304
  | `svg-icon-naming-convention` | SVG components must end with "Icon" suffix; "Icon" suffix components must return SVG |
@@ -324,6 +325,7 @@ rules: {
324
325
  | `hook-callback-format` | React hooks: callback on new line, deps array on separate line, proper indentation 🔧 |
325
326
  | `hook-deps-per-line` | Collapse deps ≤ threshold to one line; expand larger arrays with each dep on own line (default: >2) 🔧 ⚙️ |
326
327
  | `hook-file-naming-convention` | Hook files in module subfolders must include the module name (verb hooks: `use-{verb}-{module}`, list hooks: `use-{module}-list`) |
328
+ | `hook-function-naming-convention` | Hook function name must match camelCase of file name (e.g., `use-create-super-admin.ts` → `useCreateSuperAdmin`) 🔧 |
327
329
  | `use-state-naming-convention` | Boolean useState variables must start with is/has/with/without prefix 🔧 ⚙️ |
328
330
  | **Import/Export Rules** | |
329
331
  | `absolute-imports-only` | Use alias imports from index files only (not deep paths), no relative imports; files within the same module folder must use relative imports — auto-fixes absolute imports to relative (default: `@/`) 🔧 ⚙️ |
@@ -392,7 +394,7 @@ For detailed documentation with examples, configuration options, and best practi
392
394
  | [Components](./docs/rules/components.md) | 6 | Props destructure, folder naming, structure consistency |
393
395
  | [Control Flow](./docs/rules/control-flow.md) | 8 | Block newlines, if/else, logical expressions, ternaries |
394
396
  | [Functions](./docs/rules/functions.md) | 6 | Call spacing, declaration style, naming, params |
395
- | [Hooks](./docs/rules/hooks.md) | 4 | Callback format, deps-per-line, file naming, useState naming |
397
+ | [Hooks](./docs/rules/hooks.md) | 5 | Callback format, deps-per-line, file naming, function naming, useState naming |
396
398
  | [Imports/Exports](./docs/rules/imports-exports.md) | 8 | Absolute imports, format, index exports, module exports |
397
399
  | [JSX](./docs/rules/jsx.md) | 14 | ClassName handling, children, logical expressions |
398
400
  | [Objects](./docs/rules/objects.md) | 5 | Property formatting, empty lines, string properties |
@@ -408,7 +410,7 @@ For detailed documentation with examples, configuration options, and best practi
408
410
 
409
411
  ## 🔧 Auto-fixing
410
412
 
411
- 70 of 80 rules support auto-fixing. Run ESLint with the `--fix` flag:
413
+ 71 of 81 rules support auto-fixing. Run ESLint with the `--fix` flag:
412
414
 
413
415
  ```bash
414
416
  # Fix all files in src directory