eslint-plugin-code-style 1.17.2 → 2.0.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/AGENTS.md +88 -59
- package/CHANGELOG.md +109 -0
- package/README.md +25 -3705
- package/dist/index.js +272 -0
- package/docs/rules/README.md +31 -0
- package/docs/rules/arrays.md +107 -0
- package/docs/rules/arrow-functions.md +115 -0
- package/docs/rules/call-expressions.md +275 -0
- package/docs/rules/classes.md +88 -0
- package/docs/rules/comments.md +42 -0
- package/docs/rules/components.md +330 -0
- package/docs/rules/control-flow.md +448 -0
- package/docs/rules/functions.md +232 -0
- package/docs/rules/hooks.md +147 -0
- package/docs/rules/imports-exports.md +383 -0
- package/docs/rules/jsx.md +518 -0
- package/docs/rules/objects.md +224 -0
- package/docs/rules/react.md +175 -0
- package/docs/rules/spacing.md +61 -0
- package/docs/rules/strings.md +92 -0
- package/docs/rules/typescript.md +482 -0
- package/docs/rules/variables.md +32 -0
- package/package.json +12 -5
- package/index.js +0 -23217
package/AGENTS.md
CHANGED
|
@@ -6,7 +6,8 @@ Instructions for AI coding agents working with this codebase.
|
|
|
6
6
|
|
|
7
7
|
**eslint-plugin-code-style** is an ESLint plugin providing 79 custom formatting rules (70 auto-fixable, 19 configurable, 9 report-only) for React/JSX projects. It's designed for ESLint v9+ flat config system.
|
|
8
8
|
|
|
9
|
-
- **
|
|
9
|
+
- **Source code:** `src/` - Modular rule files organized by category
|
|
10
|
+
- **Built output:** `dist/index.js` - Bundled + minified (generated by esbuild, gitignored)
|
|
10
11
|
- **Type definitions:** `index.d.ts` - TypeScript declarations for IDE support
|
|
11
12
|
- **Recommended configs:** `recommended-configs/` - Ready-to-use ESLint configurations
|
|
12
13
|
- **Test apps:** `_tests_/` - Sample apps for testing rules
|
|
@@ -17,8 +18,8 @@ Instructions for AI coding agents working with this codebase.
|
|
|
17
18
|
|--------|-------------------|-------------|--------|
|
|
18
19
|
| React (JS) | `recommended-configs/react/` | `_tests_/react/` | Available |
|
|
19
20
|
| React + TS + Tailwind | `recommended-configs/react-ts-tw/` | `_tests_/react-ts-tw/` | Available |
|
|
20
|
-
| React + TypeScript | - | - |
|
|
21
|
-
| React + Tailwind | - | - |
|
|
21
|
+
| React + TypeScript | `recommended-configs/react-ts/` | `_tests_/react-ts/` | Available |
|
|
22
|
+
| React + Tailwind | `recommended-configs/react-tw/` | `_tests_/react-tw/` | Available |
|
|
22
23
|
|
|
23
24
|
### Test Projects & Rule Compatibility
|
|
24
25
|
|
|
@@ -26,16 +27,17 @@ Instructions for AI coding agents working with this codebase.
|
|
|
26
27
|
|
|
27
28
|
Each test project in `_tests_/` corresponds to a specific tech stack. Rules should ONLY be added to projects that support them:
|
|
28
29
|
|
|
29
|
-
| Rule Category | `react/` (JS only) | `react-ts-tw/` (TS + Tailwind) |
|
|
30
|
+
| Rule Category | `react/` (JS only) | `react-ts-tw/` (TS + Tailwind) | `react-ts/` (TS) | `react-tw/` (TW) |
|
|
30
31
|
|---------------|:------------------:|:------------------------------:|:-------------------:|:-------------------:|
|
|
31
32
|
| **General rules** (arrays, functions, etc.) | ✅ | ✅ | ✅ | ✅ |
|
|
32
33
|
| **JSX/React rules** | ✅ | ✅ | ✅ | ✅ |
|
|
33
34
|
| **TypeScript rules** | ❌ | ✅ | ✅ | ❌ |
|
|
34
35
|
| **Tailwind rules** | ❌ | ✅ | ❌ | ✅ |
|
|
35
36
|
|
|
36
|
-
**TypeScript-only rules** (
|
|
37
|
+
**TypeScript-only rules** (70 rules in JS projects, 79 in TS projects):
|
|
37
38
|
- `component-props-inline-type`
|
|
38
39
|
- `enum-format`
|
|
40
|
+
- `enum-type-enforcement`
|
|
39
41
|
- `interface-format`
|
|
40
42
|
- `no-inline-type-definitions`
|
|
41
43
|
- `prop-naming-convention`
|
|
@@ -66,7 +68,8 @@ Each test project in `_tests_/` corresponds to a specific tech stack. Rules shou
|
|
|
66
68
|
## Build & Test Commands
|
|
67
69
|
|
|
68
70
|
```bash
|
|
69
|
-
#
|
|
71
|
+
# Build (required before testing or publishing)
|
|
72
|
+
npm run build # Bundles src/ into dist/index.js via esbuild
|
|
70
73
|
|
|
71
74
|
# Test rules against a test app (e.g., react, react-ts, react-ts-tw)
|
|
72
75
|
cd _tests_/<config-name>
|
|
@@ -74,23 +77,43 @@ npm install
|
|
|
74
77
|
npm run lint # Check for errors
|
|
75
78
|
npm run lint:fix # Auto-fix issues
|
|
76
79
|
|
|
77
|
-
# Publish (from root folder only)
|
|
78
|
-
npm publish
|
|
80
|
+
# Publish (from root folder only — run build first)
|
|
81
|
+
npm run build && npm publish
|
|
79
82
|
```
|
|
80
83
|
|
|
81
84
|
## Code Structure
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
Rules are organized in modular source files under `src/`:
|
|
84
87
|
|
|
85
88
|
```
|
|
86
|
-
|
|
87
|
-
├──
|
|
88
|
-
├──
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
src/
|
|
90
|
+
├── index.js — Entry point, imports all rules, exports plugin object
|
|
91
|
+
├── utils/
|
|
92
|
+
│ └── tailwind.js — Tailwind CSS class utilities (shared across classname-* rules)
|
|
93
|
+
└── rules/
|
|
94
|
+
├── arrays.js — 3 rules
|
|
95
|
+
├── arrow-functions.js — 4 rules
|
|
96
|
+
├── call-expressions.js — 6 rules
|
|
97
|
+
├── classes.js — 2 rules
|
|
98
|
+
├── comments.js — 1 rule
|
|
99
|
+
├── components.js — 6 rules
|
|
100
|
+
├── control-flow.js — 8 rules
|
|
101
|
+
├── functions.js — 6 rules
|
|
102
|
+
├── hooks.js — 3 rules
|
|
103
|
+
├── imports-exports.js — 8 rules
|
|
104
|
+
├── jsx.js — 14 rules
|
|
105
|
+
├── objects.js — 5 rules
|
|
106
|
+
├── react.js — 1 rule
|
|
107
|
+
├── spacing.js — 2 rules
|
|
108
|
+
├── strings.js — 1 rule
|
|
109
|
+
├── typescript.js — 8 rules
|
|
110
|
+
└── variables.js — 1 rule
|
|
111
|
+
dist/
|
|
112
|
+
└── index.js — Bundled + minified output (generated, gitignored)
|
|
92
113
|
```
|
|
93
114
|
|
|
115
|
+
The build step (`npm run build`) uses esbuild to bundle all source files into a single minified `dist/index.js`.
|
|
116
|
+
|
|
94
117
|
## Rule Implementation Pattern
|
|
95
118
|
|
|
96
119
|
Every rule follows this exact structure:
|
|
@@ -160,8 +183,10 @@ const ruleName = {
|
|
|
160
183
|
|
|
161
184
|
When creating a new rule, ALL of the following files must be updated:
|
|
162
185
|
|
|
163
|
-
#### 1. `
|
|
186
|
+
#### 1. `src/rules/<category>.js` — Rule Implementation
|
|
164
187
|
|
|
188
|
+
- [ ] Add rule to the appropriate category file in `src/rules/`
|
|
189
|
+
- [ ] Add the variable name to the file's `export { ... }` block
|
|
165
190
|
- [ ] Add JSDoc comment block with the standard format:
|
|
166
191
|
```javascript
|
|
167
192
|
/**
|
|
@@ -181,7 +206,8 @@ When creating a new rule, ALL of the following files must be updated:
|
|
|
181
206
|
```
|
|
182
207
|
- [ ] Add `const ruleName = { create(), meta: {} }` definition
|
|
183
208
|
- [ ] Include `fixable: "code"` or `fixable: "whitespace"` in meta if auto-fixable
|
|
184
|
-
- [ ]
|
|
209
|
+
- [ ] Import rule in `src/index.js` and add to `rules` object in default export (keep **alphabetical order**)
|
|
210
|
+
- [ ] Run `npm run build` to regenerate `dist/index.js`
|
|
185
211
|
|
|
186
212
|
#### 2. `index.d.ts` — TypeScript Types
|
|
187
213
|
|
|
@@ -196,11 +222,10 @@ When creating a new rule, ALL of the following files must be updated:
|
|
|
196
222
|
|
|
197
223
|
#### 3. `README.md` — Main Documentation
|
|
198
224
|
|
|
199
|
-
> ⚠️ **IMPORTANT:** README.md has **
|
|
200
|
-
> - **Rule counts** (
|
|
225
|
+
> ⚠️ **IMPORTANT:** README.md has **three separate sections** that mention rules. When adding or editing a rule, you must update ALL relevant sections:
|
|
226
|
+
> - **Rule counts** (5 locations) — must match actual rule count
|
|
201
227
|
> - **Quick Start example** (~line 184) — alphabetically sorted configuration example
|
|
202
228
|
> - **Rules Summary table** — brief description with emoji indicators
|
|
203
|
-
> - **Detailed documentation** — full examples, options, and explanations
|
|
204
229
|
>
|
|
205
230
|
> Missing any section will leave documentation inconsistent. Use the `audit-docs` skill to verify all sections are in sync.
|
|
206
231
|
|
|
@@ -208,9 +233,8 @@ When creating a new rule, ALL of the following files must be updated:
|
|
|
208
233
|
- [ ] Line ~22: `*XX rules (YY auto-fixable)*`
|
|
209
234
|
- [ ] Line ~30: `**XX custom rules** (YY auto-fixable)`
|
|
210
235
|
- [ ] Line ~39: `YY of XX rules support auto-fix`
|
|
211
|
-
- [ ] Line ~
|
|
212
|
-
- [ ] Line ~
|
|
213
|
-
- [ ] Line ~3037: `YY of XX rules support auto-fixing`
|
|
236
|
+
- [ ] Line ~272: `**XX rules total** — YY with auto-fix`
|
|
237
|
+
- [ ] Line ~409: `YY of XX rules support auto-fixing`
|
|
214
238
|
|
|
215
239
|
**b) Add rule to Quick Start example** (~line 184, alphabetically sorted):
|
|
216
240
|
```javascript
|
|
@@ -224,7 +248,10 @@ When creating a new rule, ALL of the following files must be updated:
|
|
|
224
248
|
- Add 🔧 emoji if auto-fixable
|
|
225
249
|
- Add ⚙️ emoji if has configurable options
|
|
226
250
|
|
|
227
|
-
|
|
251
|
+
#### 3b. `docs/rules/<category>.md` — Detailed Rule Documentation
|
|
252
|
+
|
|
253
|
+
Add detailed rule documentation to the appropriate category file in `docs/rules/`:
|
|
254
|
+
|
|
228
255
|
```markdown
|
|
229
256
|
### `new-rule-name`
|
|
230
257
|
|
|
@@ -367,12 +394,12 @@ Run these commands to verify all rules are in sync:
|
|
|
367
394
|
|
|
368
395
|
```bash
|
|
369
396
|
# Count rules in each location
|
|
370
|
-
grep -
|
|
397
|
+
grep -rc "^const [a-zA-Z]* = {$" src/rules/
|
|
371
398
|
grep -c 'code-style/' index.d.ts
|
|
372
399
|
grep -c '"code-style/' recommended-configs/react-ts-tw/eslint.config.js
|
|
373
400
|
|
|
374
401
|
# Find rules missing from README
|
|
375
|
-
grep -oE '"[a-z-]+":' index.js | tr -d '":' | sort > /tmp/a.txt
|
|
402
|
+
grep -oE '"[a-z-]+":' src/index.js | tr -d '":' | sort > /tmp/a.txt
|
|
376
403
|
grep -oE '\`[a-z-]+\`' README.md | tr -d '\`' | sort | uniq > /tmp/b.txt
|
|
377
404
|
comm -23 /tmp/a.txt /tmp/b.txt
|
|
378
405
|
```
|
|
@@ -383,20 +410,21 @@ comm -23 /tmp/a.txt /tmp/b.txt
|
|
|
383
410
|
|
|
384
411
|
**IMPORTANT:** Removing a rule is a **BREAKING CHANGE** requiring a **MAJOR version bump** (e.g., 1.6.0 → 2.0.0).
|
|
385
412
|
|
|
386
|
-
#### 1. `index.js`
|
|
387
|
-
- [ ] Remove the rule's JSDoc comment block
|
|
388
|
-
- [ ] Remove the `
|
|
389
|
-
- [ ] Remove
|
|
413
|
+
#### 1. `src/rules/<category>.js` + `src/index.js`
|
|
414
|
+
- [ ] Remove the rule's JSDoc comment block and `const` definition from category file
|
|
415
|
+
- [ ] Remove from the file's `export { ... }` block
|
|
416
|
+
- [ ] Remove import and `rules` object entry from `src/index.js`
|
|
417
|
+
- [ ] Run `npm run build` to regenerate `dist/index.js`
|
|
390
418
|
|
|
391
419
|
#### 2. `index.d.ts`
|
|
392
420
|
- [ ] Remove from `RuleNames` type union
|
|
393
421
|
- [ ] Remove from `PluginRules` interface
|
|
394
422
|
|
|
395
|
-
#### 3. `README.md`
|
|
423
|
+
#### 3. `README.md` + `docs/rules/`
|
|
396
424
|
- [ ] Update all rule counts (see [Rule Count Locations](#rule-count-locations))
|
|
397
425
|
- [ ] Remove from `rules: {}` example in Quick Start
|
|
398
426
|
- [ ] Remove from Rules Summary table
|
|
399
|
-
- [ ] Remove detailed documentation
|
|
427
|
+
- [ ] Remove detailed documentation from `docs/rules/<category>.md`
|
|
400
428
|
|
|
401
429
|
#### 4. `AGENTS.md`
|
|
402
430
|
- [ ] Update all rule counts
|
|
@@ -423,29 +451,29 @@ comm -23 /tmp/a.txt /tmp/b.txt
|
|
|
423
451
|
|
|
424
452
|
When modifying an existing rule, check if these need updates:
|
|
425
453
|
|
|
426
|
-
> ⚠️ **
|
|
454
|
+
> ⚠️ **Documentation Reminder:** If the rule's behavior, examples, or options change, update README.md (Quick Start example, Rules Summary table) and the detailed docs in `docs/rules/<category>.md`. See the note in "Adding a New Rule" section for details.
|
|
427
455
|
|
|
428
456
|
#### If fixing a bug (PATCH version: x.x.+1):
|
|
429
|
-
- [ ] Fix the issue in rule's `create()` function in `
|
|
457
|
+
- [ ] Fix the issue in rule's `create()` function in `src/rules/<category>.js`
|
|
430
458
|
- [ ] Test in `_tests_/` apps with `npm run lint` and `npm run lint:fix`
|
|
431
459
|
- [ ] Commit: `fix: description of what was fixed in rule-name`
|
|
432
460
|
|
|
433
461
|
#### If changing rule behavior (PATCH or MINOR depending on scope):
|
|
434
|
-
- [ ] Update rule logic in `
|
|
435
|
-
- [ ] Update JSDoc in
|
|
462
|
+
- [ ] Update rule logic in `src/rules/<category>.js`
|
|
463
|
+
- [ ] Update JSDoc in source file (Good/Bad examples if they changed)
|
|
436
464
|
- [ ] Update `README.md` rule documentation section:
|
|
437
465
|
- Update "What it does" if behavior changed
|
|
438
466
|
- Update code examples (✅ Good / ❌ Bad) to reflect new behavior
|
|
439
467
|
- [ ] Test in `_tests_/` apps with `npm run lint` and `npm run lint:fix`
|
|
440
468
|
|
|
441
469
|
#### If adding new options (MINOR version: x.+1.0):
|
|
442
|
-
- [ ] Add option to `schema` in rule's `meta` object in `
|
|
470
|
+
- [ ] Add option to `schema` in rule's `meta` object in `src/rules/<category>.js`
|
|
443
471
|
- [ ] Add option handling in `create()` function with default value:
|
|
444
472
|
```javascript
|
|
445
473
|
const options = context.options[0] || {};
|
|
446
474
|
const newOption = options.newOption !== undefined ? options.newOption : defaultValue;
|
|
447
475
|
```
|
|
448
|
-
- [ ] Update JSDoc Options section in
|
|
476
|
+
- [ ] Update JSDoc Options section in source file
|
|
449
477
|
- [ ] Update README.md rule documentation:
|
|
450
478
|
- Add row to Options table
|
|
451
479
|
- Add configuration example showing the new option
|
|
@@ -466,7 +494,7 @@ When modifying an existing rule, check if these need updates:
|
|
|
466
494
|
|
|
467
495
|
#### If changing default values (MAJOR version: +1.0.0 — breaking change):
|
|
468
496
|
- [ ] Update default value in `create()` function
|
|
469
|
-
- [ ] Update JSDoc in
|
|
497
|
+
- [ ] Update JSDoc in source file
|
|
470
498
|
- [ ] Update README.md options table (Default column)
|
|
471
499
|
- [ ] Commit with `!`: `feat!: change default value for rule-name option`
|
|
472
500
|
|
|
@@ -526,9 +554,9 @@ See "When to Bump Version & Create Tag" section in Git Workflow for details.
|
|
|
526
554
|
|
|
527
555
|
---
|
|
528
556
|
|
|
529
|
-
### Rule Documentation Format in
|
|
557
|
+
### Rule Documentation Format in docs/rules/
|
|
530
558
|
|
|
531
|
-
Each rule should have this format in
|
|
559
|
+
Each rule should have this format in its category file under `docs/rules/`:
|
|
532
560
|
|
|
533
561
|
```markdown
|
|
534
562
|
### `rule-name`
|
|
@@ -638,7 +666,7 @@ if (node.parent?.type === "CallExpression") return;
|
|
|
638
666
|
|
|
639
667
|
## Rule Categories
|
|
640
668
|
|
|
641
|
-
Rules are organized in these categories (alphabetically sorted in index.js and README.md):
|
|
669
|
+
Rules are organized in these categories (alphabetically sorted in src/index.js and README.md):
|
|
642
670
|
|
|
643
671
|
- **Array Rules** — Rules for array formatting
|
|
644
672
|
- `array-callback-destructure`, `array-items-per-line`, `array-objects-on-new-lines`
|
|
@@ -687,8 +715,9 @@ Rules are organized in these categories (alphabetically sorted in index.js and R
|
|
|
687
715
|
|
|
688
716
|
## Documentation Files
|
|
689
717
|
|
|
690
|
-
- `README.md` - Main documentation with
|
|
691
|
-
- `
|
|
718
|
+
- `README.md` - Main documentation with rule overview and links
|
|
719
|
+
- `docs/rules/` - Detailed rule documentation (17 category files with examples and options)
|
|
720
|
+
- `recommended-configs/<config-name>/README.md` - Config-specific documentation (references docs/rules/ for rule details)
|
|
692
721
|
- `index.d.ts` - TypeScript types for IDE autocomplete
|
|
693
722
|
|
|
694
723
|
## Important Notes
|
|
@@ -725,12 +754,12 @@ Rules are organized in these categories (alphabetically sorted in index.js and R
|
|
|
725
754
|
| `README.md` | ~22 | `*79 rules (70 auto-fixable, 19 configurable)*` |
|
|
726
755
|
| `README.md` | ~30 | `**79 custom rules** (70 auto-fixable, 19 configurable)` |
|
|
727
756
|
| `README.md` | ~39 | `70 of 79 rules support auto-fix` |
|
|
728
|
-
| `README.md` | ~
|
|
729
|
-
| `README.md` | ~
|
|
730
|
-
| `README.md` | ~
|
|
757
|
+
| `README.md` | ~272 | `**79 rules total** — 70 with auto-fix, 19 configurable` |
|
|
758
|
+
| `README.md` | ~409 | `70 of 79 rules support auto-fixing` |
|
|
759
|
+
| `docs/rules/README.md` | ~3 | `**79 rules total** — 70 with auto-fix, 19 configurable` |
|
|
731
760
|
| `AGENTS.md` | ~7 | `79 custom formatting rules (70 auto-fixable, 19 configurable, 9 report-only)` |
|
|
732
761
|
| `AGENTS.md` | ~9 | `Contains all 79 rules` |
|
|
733
|
-
| `AGENTS.md` | ~36 | `(
|
|
762
|
+
| `AGENTS.md` | ~36 | `(70 rules in JS projects, 79 in TS projects)` |
|
|
734
763
|
| `AGENTS.md` | ~89 | `(79 rules total)` |
|
|
735
764
|
| `AGENTS.md` | ~675 | `all 79 rules` |
|
|
736
765
|
| `AGENTS.md` | ~697 | `70 auto-fixable rules, 19 configurable rules, 9 report-only` |
|
|
@@ -742,13 +771,13 @@ Rules are organized in these categories (alphabetically sorted in index.js and R
|
|
|
742
771
|
|
|
743
772
|
```bash
|
|
744
773
|
# Count total rules
|
|
745
|
-
grep -
|
|
774
|
+
grep -rc "^const [a-zA-Z]* = {$" src/rules/
|
|
746
775
|
|
|
747
776
|
# Count auto-fixable (code)
|
|
748
|
-
grep -
|
|
777
|
+
grep -rc 'fixable: "code"' src/rules/
|
|
749
778
|
|
|
750
779
|
# Count auto-fixable (whitespace)
|
|
751
|
-
grep -
|
|
780
|
+
grep -rc 'fixable: "whitespace"' src/rules/
|
|
752
781
|
|
|
753
782
|
# Count configurable rules (rules with ⚙️ in README table)
|
|
754
783
|
grep "| \`" README.md | grep -c "⚙️"
|
|
@@ -1220,7 +1249,7 @@ This project includes reusable skills in the `.skills/` directory following the
|
|
|
1220
1249
|
| `manage-rule` | Add, edit, or remove an ESLint rule with all required file updates |
|
|
1221
1250
|
| `review-config` | Review a recommended ESLint configuration |
|
|
1222
1251
|
| `test-rule` | Test an ESLint rule after creating or modifying it |
|
|
1223
|
-
| `validate-types` | Verify TypeScript definitions match rules in index.js |
|
|
1252
|
+
| `validate-types` | Verify TypeScript definitions match rules in src/index.js |
|
|
1224
1253
|
|
|
1225
1254
|
See `.skills/*/skill.md` for detailed instructions.
|
|
1226
1255
|
|
|
@@ -1240,7 +1269,7 @@ Test an ESLint rule to verify it works correctly.
|
|
|
1240
1269
|
|
|
1241
1270
|
**Steps:**
|
|
1242
1271
|
|
|
1243
|
-
1. **Find the rule** in `
|
|
1272
|
+
1. **Find the rule** in `src/rules/<category>.js` and understand what it checks
|
|
1244
1273
|
2. **Identify test app** — Use `_tests_/react/` for JS rules or `_tests_/react-ts-tw/` for TS rules
|
|
1245
1274
|
3. **Create test cases** in the test app:
|
|
1246
1275
|
- Add code that should PASS (no violations)
|
|
@@ -1260,15 +1289,15 @@ Test an ESLint rule to verify it works correctly.
|
|
|
1260
1289
|
|
|
1261
1290
|
### Workflow: Validate Types
|
|
1262
1291
|
|
|
1263
|
-
Verify TypeScript definitions match the rules in `index.js`.
|
|
1292
|
+
Verify TypeScript definitions match the rules in `src/index.js`.
|
|
1264
1293
|
|
|
1265
1294
|
**When to use:** After adding new rules or before releases.
|
|
1266
1295
|
|
|
1267
1296
|
**Steps:**
|
|
1268
1297
|
|
|
1269
|
-
1. **Count rules in
|
|
1298
|
+
1. **Count rules in src/:**
|
|
1270
1299
|
```bash
|
|
1271
|
-
grep -
|
|
1300
|
+
grep -rc "^const .* = {$" src/rules/
|
|
1272
1301
|
```
|
|
1273
1302
|
Or count entries in the `rules` export object.
|
|
1274
1303
|
|
|
@@ -1277,8 +1306,8 @@ Verify TypeScript definitions match the rules in `index.js`.
|
|
|
1277
1306
|
- Verify `PluginRules` interface includes all rules
|
|
1278
1307
|
|
|
1279
1308
|
3. **Look for mismatches:**
|
|
1280
|
-
- Rules in `index.js` missing from `index.d.ts`?
|
|
1281
|
-
- Rules in `index.d.ts` that don't exist in `index.js`?
|
|
1309
|
+
- Rules in `src/index.js` missing from `index.d.ts`?
|
|
1310
|
+
- Rules in `index.d.ts` that don't exist in `src/index.js`?
|
|
1282
1311
|
|
|
1283
1312
|
4. **Report:**
|
|
1284
1313
|
- Total rules: X
|
|
@@ -1334,7 +1363,7 @@ Verify documentation accuracy across all files.
|
|
|
1334
1363
|
|
|
1335
1364
|
1. **Count actual rules:**
|
|
1336
1365
|
```bash
|
|
1337
|
-
grep -
|
|
1366
|
+
grep -rc "^const .* = {$" src/rules/
|
|
1338
1367
|
```
|
|
1339
1368
|
|
|
1340
1369
|
2. **Check rule count references:**
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,111 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.0.0] - 2026-02-09
|
|
11
|
+
|
|
12
|
+
**Modular Source Architecture + Minified Build**
|
|
13
|
+
|
|
14
|
+
**Version Range:** v1.20.0 → v2.0.0
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **BREAKING: Modular source architecture** — Split monolithic 23K-line `index.js` into `src/` with 17 category files + shared utilities
|
|
19
|
+
- `src/index.js` — Entry point importing all rules
|
|
20
|
+
- `src/rules/*.js` — 17 category files (arrays, arrow-functions, call-expressions, classes, comments, components, control-flow, functions, hooks, imports-exports, jsx, objects, react, spacing, strings, typescript, variables)
|
|
21
|
+
- `src/utils/tailwind.js` — Shared Tailwind CSS class utilities
|
|
22
|
+
- **Build system** — Added esbuild to bundle and minify `src/` into `dist/index.js`
|
|
23
|
+
- `npm run build` generates the bundled output
|
|
24
|
+
- Output is ~269 KB (was ~1 MB), a 73% reduction
|
|
25
|
+
- **Package entry point** — `main` and `exports` now point to `dist/index.js` instead of `index.js`
|
|
26
|
+
- **npm package** — Publishes `dist/index.js` instead of root `index.js`; removed root `index.js` from package
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- `esbuild.config.js` — Build configuration
|
|
31
|
+
- `esbuild` as devDependency
|
|
32
|
+
- `npm run build` script
|
|
33
|
+
|
|
34
|
+
### Stats
|
|
35
|
+
|
|
36
|
+
- Total Rules: 79
|
|
37
|
+
- Auto-fixable: 70 rules 🔧
|
|
38
|
+
- Configurable: 19 rules ⚙️
|
|
39
|
+
- Report-only: 9 rules
|
|
40
|
+
- Unpacked size: ~400 KB (was ~1.26 MB)
|
|
41
|
+
|
|
42
|
+
**Full Changelog:** [v1.20.0...v2.0.0](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.20.0...v2.0.0)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## [1.20.0] - 2026-02-09
|
|
47
|
+
|
|
48
|
+
**README Reorganization — Split Rules Reference into docs/rules/**
|
|
49
|
+
|
|
50
|
+
**Version Range:** v1.19.0 → v1.20.0
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- **Rules Reference Documentation** (`docs/rules/`) — 17 category files with detailed rule documentation, examples, and configuration options
|
|
55
|
+
- `arrays.md`, `arrow-functions.md`, `call-expressions.md`, `classes.md`, `comments.md`, `components.md`, `control-flow.md`, `functions.md`, `hooks.md`, `imports-exports.md`, `jsx.md`, `objects.md`, `react.md`, `spacing.md`, `strings.md`, `typescript.md`, `variables.md`
|
|
56
|
+
- **Rules index page** (`docs/rules/README.md`) — Overview table linking to all 17 category files
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- **README.md** — Reorganized from ~4,150 lines to ~475 lines by moving detailed rule documentation to `docs/rules/`
|
|
61
|
+
- Kept: badges, Why This Plugin, Recommended Configs, Features, Installation, Quick Start, Enable All Rules, Rules Summary table, Rules Reference links, Auto-fixing, Disabling Rules, Contributing, License
|
|
62
|
+
- Moved: All detailed rule examples, options, and explanations to `docs/rules/` category files
|
|
63
|
+
- **Recommended config READMEs** — Updated rule documentation links to point to `docs/rules/` instead of main README
|
|
64
|
+
- **AGENTS.md** — Updated documentation references to reflect new `docs/rules/` structure
|
|
65
|
+
- **package.json** — Added `docs/` to npm `files` array
|
|
66
|
+
|
|
67
|
+
**Full Changelog:** [v1.19.0...v1.20.0](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.19.0...v1.20.0)
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## [1.19.0] - 2026-02-09
|
|
72
|
+
|
|
73
|
+
**New: React + Tailwind Test Project & Recommended Config**
|
|
74
|
+
|
|
75
|
+
**Version Range:** v1.18.0 → v1.19.0
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
|
|
79
|
+
- **React + Tailwind test project** (`_tests_/react-tw/`) — React + Tailwind CSS project (no TypeScript) with 70 code-style rules enabled and Tailwind CSS v4 plugin
|
|
80
|
+
- **React + Tailwind recommended config** (`recommended-configs/react-tw/`) — Ready-to-use ESLint flat config for React + Tailwind CSS projects without TypeScript
|
|
81
|
+
- Includes 70 JavaScript-compatible code-style rules, Tailwind CSS plugin, and recommended third-party plugins
|
|
82
|
+
- Documented with installation instructions, rule explanations, and customization guide
|
|
83
|
+
|
|
84
|
+
### Changed
|
|
85
|
+
|
|
86
|
+
- Updated Available Configurations table in README.md — React + Tailwind now links to config instead of "Coming Soon"
|
|
87
|
+
- Updated AGENTS.md — React + Tailwind marked as Available with folder paths
|
|
88
|
+
|
|
89
|
+
**Full Changelog:** [v1.18.0...v1.19.0](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.18.0...v1.19.0)
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## [1.18.0] - 2026-02-09
|
|
94
|
+
|
|
95
|
+
**New: React + TypeScript Test Project & Recommended Config**
|
|
96
|
+
|
|
97
|
+
**Version Range:** v1.17.2 → v1.18.0
|
|
98
|
+
|
|
99
|
+
### Added
|
|
100
|
+
|
|
101
|
+
- **React + TypeScript test project** (`_tests_/react-ts/`) — React + TypeScript project (no Tailwind) with all 79 code-style rules enabled and @typescript-eslint parser
|
|
102
|
+
- **React + TypeScript recommended config** (`recommended-configs/react-ts/`) — Ready-to-use ESLint flat config for React + TypeScript projects without Tailwind CSS
|
|
103
|
+
- Includes all 79 code-style rules, TypeScript parser, and recommended third-party plugins
|
|
104
|
+
- Documented with installation instructions, rule explanations, and customization guide
|
|
105
|
+
|
|
106
|
+
### Changed
|
|
107
|
+
|
|
108
|
+
- Updated Available Configurations table in README.md — React + TypeScript now links to config instead of "Coming Soon"
|
|
109
|
+
- Updated AGENTS.md — React + TypeScript marked as Available with folder paths
|
|
110
|
+
|
|
111
|
+
**Full Changelog:** [v1.17.2...v1.18.0](https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.17.2...v1.18.0)
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
10
115
|
## [1.17.2] - 2026-02-09
|
|
11
116
|
|
|
12
117
|
**Fix: CamelCase Naming Auto-Fix & Prefix Enforcement**
|
|
@@ -1841,6 +1946,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1841
1946
|
|
|
1842
1947
|
---
|
|
1843
1948
|
|
|
1949
|
+
[2.0.0]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.20.0...v2.0.0
|
|
1950
|
+
[1.20.0]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.19.0...v1.20.0
|
|
1951
|
+
[1.19.0]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.18.0...v1.19.0
|
|
1952
|
+
[1.18.0]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.17.2...v1.18.0
|
|
1844
1953
|
[1.17.2]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.17.1...v1.17.2
|
|
1845
1954
|
[1.17.1]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.17.0...v1.17.1
|
|
1846
1955
|
[1.17.0]: https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.16.0...v1.17.0
|