eslint-plugin-code-style 2.0.18 → 2.1.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.
- package/README.md +10 -8
- package/dist/index.js +124 -124
- package/index.d.ts +2 -0
- package/package.json +1 -1
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
|
-
*
|
|
22
|
+
*80 rules (70 auto-fixable, 19 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 **
|
|
30
|
+
This plugin provides **80 custom rules** (70 auto-fixable, 19 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 **79 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
|
|
39
|
+
- **Highly automated** — 70 of 80 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
|
|
63
|
+
- **Complete Coverage** — Combines ESLint built-in rules, third-party plugins, and all 80 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.
|
|
100
|
+
**70 rules** support automatic fixing with `eslint --fix`. **19 rules** have configurable options. 10 rules are report-only (require manual changes).
|
|
101
101
|
|
|
102
102
|
</td>
|
|
103
103
|
<td width="50%">
|
|
@@ -216,6 +216,7 @@ rules: {
|
|
|
216
216
|
"code-style/function-params-per-line": "error",
|
|
217
217
|
"code-style/hook-callback-format": "error",
|
|
218
218
|
"code-style/hook-deps-per-line": "error",
|
|
219
|
+
"code-style/hook-file-naming-convention": "error",
|
|
219
220
|
"code-style/use-state-naming-convention": "error",
|
|
220
221
|
"code-style/if-else-spacing": "error",
|
|
221
222
|
"code-style/if-statement-format": "error",
|
|
@@ -269,7 +270,7 @@ rules: {
|
|
|
269
270
|
|
|
270
271
|
## 📖 Rules Categories
|
|
271
272
|
|
|
272
|
-
> **
|
|
273
|
+
> **80 rules total** — 70 with auto-fix 🔧, 19 configurable ⚙️, 10 report-only. See detailed examples in the [Rules Reference](./docs/rules/).
|
|
273
274
|
>
|
|
274
275
|
> **Legend:** 🔧 Auto-fixable with `eslint --fix` • ⚙️ Customizable options
|
|
275
276
|
|
|
@@ -322,6 +323,7 @@ rules: {
|
|
|
322
323
|
| **Hook Rules** | |
|
|
323
324
|
| `hook-callback-format` | React hooks: callback on new line, deps array on separate line, proper indentation 🔧 |
|
|
324
325
|
| `hook-deps-per-line` | Collapse deps ≤ threshold to one line; expand larger arrays with each dep on own line (default: >2) 🔧 ⚙️ |
|
|
326
|
+
| `hook-file-naming-convention` | Hook files in module subfolders must include the module name (verb hooks: `use-{verb}-{module}`, list hooks: `use-{module}-list`) |
|
|
325
327
|
| `use-state-naming-convention` | Boolean useState variables must start with is/has/with/without prefix 🔧 ⚙️ |
|
|
326
328
|
| **Import/Export Rules** | |
|
|
327
329
|
| `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: `@/`) 🔧 ⚙️ |
|
|
@@ -390,7 +392,7 @@ For detailed documentation with examples, configuration options, and best practi
|
|
|
390
392
|
| [Components](./docs/rules/components.md) | 6 | Props destructure, folder naming, structure consistency |
|
|
391
393
|
| [Control Flow](./docs/rules/control-flow.md) | 8 | Block newlines, if/else, logical expressions, ternaries |
|
|
392
394
|
| [Functions](./docs/rules/functions.md) | 6 | Call spacing, declaration style, naming, params |
|
|
393
|
-
| [Hooks](./docs/rules/hooks.md) |
|
|
395
|
+
| [Hooks](./docs/rules/hooks.md) | 4 | Callback format, deps-per-line, file naming, useState naming |
|
|
394
396
|
| [Imports/Exports](./docs/rules/imports-exports.md) | 8 | Absolute imports, format, index exports, module exports |
|
|
395
397
|
| [JSX](./docs/rules/jsx.md) | 14 | ClassName handling, children, logical expressions |
|
|
396
398
|
| [Objects](./docs/rules/objects.md) | 5 | Property formatting, empty lines, string properties |
|
|
@@ -406,7 +408,7 @@ For detailed documentation with examples, configuration options, and best practi
|
|
|
406
408
|
|
|
407
409
|
## 🔧 Auto-fixing
|
|
408
410
|
|
|
409
|
-
70 of
|
|
411
|
+
70 of 80 rules support auto-fixing. Run ESLint with the `--fix` flag:
|
|
410
412
|
|
|
411
413
|
```bash
|
|
412
414
|
# Fix all files in src directory
|