eslint-plugin-code-style 1.3.9 → 1.4.3
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/CHANGELOG.md +336 -0
- package/README.md +68 -65
- package/index.d.ts +8 -0
- package/index.js +1216 -92
- package/package.json +2 -2
- package/AGENTS.md +0 -677
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable releases of this project are documented here.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/) principles.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [1.4.0] - 2026-01-30
|
|
10
|
+
|
|
11
|
+
**Release Title:** New Rules, Enhanced Auto-Fix & Comprehensive Documentation
|
|
12
|
+
|
|
13
|
+
**Version Range:** v1.3.1 → v1.4.2
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **New Rules (3)**
|
|
18
|
+
- `index-exports-only` - Prevent type/interface definitions in index files (move to types file)
|
|
19
|
+
- `ternary-condition-multiline` - Format complex ternary conditions with each operand on its own line 🔧 ⚙️
|
|
20
|
+
- `no-inline-type-definitions` - Extract inline union types to named types in type files ⚙️
|
|
21
|
+
|
|
22
|
+
- **Auto-Fix Labels in Documentation**
|
|
23
|
+
- Added 🔧 label to indicate auto-fixable rules
|
|
24
|
+
- Added legend explaining 🔧 (auto-fixable) and ⚙️ (customizable) labels
|
|
25
|
+
- Clear distinction: 58 auto-fixable rules, 6 report-only rules
|
|
26
|
+
|
|
27
|
+
### Enhanced
|
|
28
|
+
|
|
29
|
+
- **function-naming-convention** - Expanded verb list from ~50 to ~200+ verbs organized by category (CRUD, validation, transformation, UI, lifecycle, network, etc.)
|
|
30
|
+
- **function-object-destructure** - Added auto-fix: inserts destructuring at function body top and replaces `param.prop` with `prop`
|
|
31
|
+
- **component-props-destructure** - Added auto-fix: converts `(props)` to `({ prop1, prop2 })` and replaces `props.x` with `x` 🔧
|
|
32
|
+
- **react-code-order** - Added auto-fix for reordering code blocks in components/hooks
|
|
33
|
+
- **variable-naming-convention** - Added auto-fix for renaming variables to camelCase
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- **multiline-if-conditions** - Fix indentation calculation for nested code (use actual line indentation)
|
|
38
|
+
- **classname-multiline** - Fix template literal indentation for inline JSX attributes
|
|
39
|
+
- **function-naming-convention** - Skip React components (PascalCase + returns JSX)
|
|
40
|
+
- **variable-naming-convention** - Skip PascalCase arguments (component references)
|
|
41
|
+
- Add "poll" as recognized verb prefix in function-naming-convention
|
|
42
|
+
|
|
43
|
+
### Documentation
|
|
44
|
+
|
|
45
|
+
- Enhanced error messages with examples and helpful context
|
|
46
|
+
- Improved CHANGELOG with full details and Full Changelog links
|
|
47
|
+
- Added GitHub Releases guidelines to AGENTS.md
|
|
48
|
+
|
|
49
|
+
### Report-Only Rules (6)
|
|
50
|
+
|
|
51
|
+
These rules cannot be auto-fixed because they require file creation, movement, or cross-file changes:
|
|
52
|
+
- `absolute-imports-only` - Requires knowledge of project structure
|
|
53
|
+
- `index-exports-only` - Requires moving code to new files
|
|
54
|
+
- `jsx-prop-naming-convention` - Requires cross-file prop renaming
|
|
55
|
+
- `module-index-exports` - Requires file creation
|
|
56
|
+
- `no-inline-type-definitions` - Requires extracting types to new files
|
|
57
|
+
- `typescript-definition-location` - Requires moving code to folders
|
|
58
|
+
|
|
59
|
+
### Stats
|
|
60
|
+
|
|
61
|
+
- Total Rules: 64 (was 61)
|
|
62
|
+
- Auto-fixable: 58 rules 🔧
|
|
63
|
+
- Report-only: 6 rules
|
|
64
|
+
|
|
65
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.3.1...v1.4.2
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## [1.3.0] - 2026-01-28
|
|
70
|
+
|
|
71
|
+
**Release Title:** New Rules, Auto-Fix Enhancements & Agent Skills Integration
|
|
72
|
+
|
|
73
|
+
**Version Range:** v1.2.1 → v1.3.0
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- **New Rules (2)**
|
|
78
|
+
- `classname-multiline` - Enforce multiline className formatting with string/template literal format
|
|
79
|
+
- `function-declaration-style` - Auto-fix function declarations to arrow expressions
|
|
80
|
+
|
|
81
|
+
- **Agent Skills** - Added [Agent Skills](https://agentskills.io) open standard support
|
|
82
|
+
- `test-rule` - Test an ESLint rule after creating or modifying it
|
|
83
|
+
- `validate-types` - Verify TypeScript definitions match rules in index.js
|
|
84
|
+
- `review-config` - Review recommended ESLint configurations
|
|
85
|
+
- `audit-docs` - Verify documentation accuracy across all files
|
|
86
|
+
- Compatible with Claude Code, Cursor, VS Code, GitHub Copilot, Gemini CLI, and more
|
|
87
|
+
|
|
88
|
+
- **TypeScript Support**
|
|
89
|
+
- Added `index.d.ts` with full type definitions for IDE autocomplete
|
|
90
|
+
- All 61 rule names available as TypeScript literal types
|
|
91
|
+
|
|
92
|
+
### Enhanced
|
|
93
|
+
|
|
94
|
+
- `variable-naming-convention` - Enforce camelCase for all variables including constants
|
|
95
|
+
- `function-object-destructure` - Add auto-fix for arrow expression body callbacks
|
|
96
|
+
- `simple-call-single-line` - Extend to collapse callbacks with params, handle optional chaining
|
|
97
|
+
- `function-naming-convention` - Add auto-fix for missing Handler suffix
|
|
98
|
+
- `absolute-imports-only` - Allow relative imports in entry files (main.tsx/main.ts), add pages folder
|
|
99
|
+
|
|
100
|
+
### Fixed
|
|
101
|
+
|
|
102
|
+
- Remove space before `?.` when collapsing simple calls to single line
|
|
103
|
+
- Sync eslint configs and add `@stylistic/semi-style` rule
|
|
104
|
+
|
|
105
|
+
### Documentation
|
|
106
|
+
|
|
107
|
+
- Reorganized AGENTS.md and CLAUDE.md for better AI agent compatibility
|
|
108
|
+
- Added git workflow and versioning guidelines
|
|
109
|
+
- Updated requirements: Node.js 20+, TypeScript 5+, Tailwind CSS 4+
|
|
110
|
+
|
|
111
|
+
### Stats
|
|
112
|
+
|
|
113
|
+
- Total Rules: 61 (was 56)
|
|
114
|
+
- All rules are auto-fixable with `eslint --fix`
|
|
115
|
+
|
|
116
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.2.1...v1.3.0
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## [1.2.0] - 2025-01-25
|
|
121
|
+
|
|
122
|
+
**Release Title:** React Code Order & TypeScript Enhancement Rules
|
|
123
|
+
|
|
124
|
+
**Version Range:** v1.1.10 → v1.2.0
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
|
|
128
|
+
- **New Rules (5)**
|
|
129
|
+
- `component-props-destructure` - Enforce props destructuring in React components
|
|
130
|
+
- `component-props-inline-type` - Enforce inline type annotations for component props
|
|
131
|
+
- `function-object-destructure` - Enforce typed params with body destructuring for non-component functions
|
|
132
|
+
- `react-code-order` - Enforce consistent ordering of hooks and code blocks in components/hooks
|
|
133
|
+
- `type-annotation-spacing` - Enforce proper spacing in TypeScript type annotations
|
|
134
|
+
|
|
135
|
+
### React Code Order (15 Categories)
|
|
136
|
+
|
|
137
|
+
The `react-code-order` rule enforces a logical dependency chain:
|
|
138
|
+
|
|
139
|
+
1. Props destructure (parameter level)
|
|
140
|
+
2. Props destructure in body
|
|
141
|
+
3. `useRef`
|
|
142
|
+
4. `useState`
|
|
143
|
+
5. `useReducer`
|
|
144
|
+
6. Redux hooks
|
|
145
|
+
7. Router hooks
|
|
146
|
+
8. Context hooks
|
|
147
|
+
9. Custom hooks
|
|
148
|
+
10. Derived state
|
|
149
|
+
11. `useMemo`
|
|
150
|
+
12. `useCallback`
|
|
151
|
+
13. Handlers
|
|
152
|
+
14. `useEffect`
|
|
153
|
+
15. Return statement
|
|
154
|
+
|
|
155
|
+
### TypeScript Improvements
|
|
156
|
+
|
|
157
|
+
- `type-annotation-spacing` - No space before colon/generic/array brackets, one space after colon
|
|
158
|
+
- Better support for inline type literals in component props
|
|
159
|
+
|
|
160
|
+
### Stats
|
|
161
|
+
|
|
162
|
+
- Total Rules: 56 (was 51)
|
|
163
|
+
- All rules are auto-fixable with `eslint --fix`
|
|
164
|
+
|
|
165
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.1.10...v1.2.0
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## [1.1.0] - 2025-01-19
|
|
170
|
+
|
|
171
|
+
**Release Title:** TypeScript + Tailwind Support & Configurable Rules
|
|
172
|
+
|
|
173
|
+
**Version Range:** v1.0.17 → v1.1.0
|
|
174
|
+
|
|
175
|
+
### Added
|
|
176
|
+
|
|
177
|
+
- **New Configuration: React + TypeScript + Tailwind**
|
|
178
|
+
- `react-ts-tw` - Recommended ESLint config for TS + Tailwind projects (`recommended-configs/react-ts-tw/`)
|
|
179
|
+
- Includes TypeScript parser, TypeScript ESLint plugin, and Tailwind CSS plugin
|
|
180
|
+
- Perfectionist rules for sorting interfaces, enums, and object types
|
|
181
|
+
- Full documentation with installation instructions
|
|
182
|
+
|
|
183
|
+
- **New Rule**
|
|
184
|
+
- `index-export-style` - Enforce consistent export formatting in index files (shorthand vs import-export style)
|
|
185
|
+
|
|
186
|
+
- **Configurable Rules**
|
|
187
|
+
- `array-items-per-line` - Added `maxItems` option (default: 3)
|
|
188
|
+
- `hook-deps-per-line` - Added `maxDeps` option (default: 2)
|
|
189
|
+
- `multiline-if-conditions` - Added `maxOperands` option (default: 3)
|
|
190
|
+
- `function-arguments-format` - New rule merging `multiline-argument-newline` and `multiple-arguments-per-line`
|
|
191
|
+
|
|
192
|
+
- **Documentation**
|
|
193
|
+
- Added `AGENTS.md` for AI coding agents (Claude Code, Cursor, etc.)
|
|
194
|
+
- Added React test application for validating plugin rules
|
|
195
|
+
- Migration guide to `@stylistic/eslint-plugin` for deprecated formatting rules
|
|
196
|
+
|
|
197
|
+
### Changed
|
|
198
|
+
|
|
199
|
+
- **Self-Sufficient Rules**
|
|
200
|
+
- `export-format` and `import-format` now handle all formatting independently
|
|
201
|
+
- `object-property-per-line` now handles all object formatting independently
|
|
202
|
+
|
|
203
|
+
- **TypeScript Support**
|
|
204
|
+
- `module-index-exports` rule now recognizes `index.ts` and `index.tsx` files
|
|
205
|
+
- Added TypeScript test file patterns (`*.test.ts`, `*.spec.ts`, etc.) to ignore list
|
|
206
|
+
|
|
207
|
+
### Fixed
|
|
208
|
+
|
|
209
|
+
- `object-property-per-line` - Fixed handling of multi-line template literals and spread elements
|
|
210
|
+
- `jsx-ternary-format` - Fixed handling of return statements and broken conditions
|
|
211
|
+
- `comment-spacing` - Renamed to `comment-format` to better reflect functionality
|
|
212
|
+
- Fixed rule count sync between README and index.d.ts
|
|
213
|
+
|
|
214
|
+
### Stats
|
|
215
|
+
|
|
216
|
+
- Total Rules: 51 (was 48)
|
|
217
|
+
- All changes are backward compatible
|
|
218
|
+
- All rules are auto-fixable with `eslint --fix`
|
|
219
|
+
|
|
220
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.0.17...v1.1.0
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## [1.0.16] - 2025-01-11
|
|
225
|
+
|
|
226
|
+
**Release Title:** New Rule: index-export-style
|
|
227
|
+
|
|
228
|
+
**Version Range:** v1.0.15 → v1.0.16
|
|
229
|
+
|
|
230
|
+
### Added
|
|
231
|
+
|
|
232
|
+
- **New Rule**
|
|
233
|
+
- `index-export-style` - Enforce consistent export patterns in index files with shorthand or import-export styles
|
|
234
|
+
|
|
235
|
+
### Changed
|
|
236
|
+
|
|
237
|
+
- Added index file overrides to prevent conflicts with other formatting rules
|
|
238
|
+
|
|
239
|
+
### Stats
|
|
240
|
+
|
|
241
|
+
- Total Rules: 48 (was 47)
|
|
242
|
+
- All rules are auto-fixable with `eslint --fix`
|
|
243
|
+
|
|
244
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.0.15...v1.0.16
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## [1.0.14] - 2025-01-06
|
|
249
|
+
|
|
250
|
+
**Release Title:** Customizable Rules, Recommended Configs & Documentation Overhaul
|
|
251
|
+
|
|
252
|
+
**Version Range:** v1.0.8 → v1.0.14
|
|
253
|
+
|
|
254
|
+
### Added
|
|
255
|
+
|
|
256
|
+
- **Customizable Folder Options**
|
|
257
|
+
- `absolute-imports-only` - Added `extraAllowedFolders` and `extraDeepImportFolders` options
|
|
258
|
+
- `module-index-exports` - Added `extraModuleFolders`, `extraLazyLoadFolders`, and `extraIgnorePatterns` options
|
|
259
|
+
|
|
260
|
+
- **Recommended ESLint Configurations**
|
|
261
|
+
- Added `recommended-configs/react/` folder with battle-tested ESLint flat config
|
|
262
|
+
- Includes comprehensive setup with 9 third-party plugins + all 47 code-style rules
|
|
263
|
+
- Complete documentation with installation commands and plugin explanations
|
|
264
|
+
|
|
265
|
+
- **Documentation**
|
|
266
|
+
- Comprehensive README rewrite with examples for all 47 rules
|
|
267
|
+
- Rules Summary table with descriptions for quick reference
|
|
268
|
+
- "Why This Plugin?" section explaining the unique value proposition
|
|
269
|
+
- Block comments added to all rules in source code with Good/Bad examples
|
|
270
|
+
- Emojis added to all major section titles for better visual hierarchy
|
|
271
|
+
|
|
272
|
+
### Changed
|
|
273
|
+
|
|
274
|
+
- **Internal Refactoring**
|
|
275
|
+
- Standardized all internal helper function names with `Handler` suffix
|
|
276
|
+
- Ensures codebase follows the same conventions enforced by the plugin
|
|
277
|
+
- Made plugin version and name dynamic (reads from package.json)
|
|
278
|
+
|
|
279
|
+
### Fixed
|
|
280
|
+
|
|
281
|
+
- Fixed rule naming: `singleArgumentOneLine` → `singleArgumentOnOneLine`
|
|
282
|
+
- Removed orphaned/duplicate block comments
|
|
283
|
+
|
|
284
|
+
### Stats
|
|
285
|
+
|
|
286
|
+
- Total Rules: 47
|
|
287
|
+
- All rules are auto-fixable with `eslint --fix`
|
|
288
|
+
|
|
289
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.0.8...v1.0.14
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## [1.0.7] - 2025-01-06
|
|
294
|
+
|
|
295
|
+
**Release Title:** TypeScript Type Definitions for IDE Support
|
|
296
|
+
|
|
297
|
+
**Version Range:** v1.0.6 → v1.0.7
|
|
298
|
+
|
|
299
|
+
### Added
|
|
300
|
+
|
|
301
|
+
- **TypeScript Support**
|
|
302
|
+
- `index.d.ts` with comprehensive type definitions
|
|
303
|
+
- IDE autocomplete and IntelliSense support
|
|
304
|
+
- Module augmentation for ESLint's configuration types
|
|
305
|
+
|
|
306
|
+
### Stats
|
|
307
|
+
|
|
308
|
+
- Total Rules: 47
|
|
309
|
+
- All rules are auto-fixable with `eslint --fix`
|
|
310
|
+
|
|
311
|
+
**Full Changelog:** https://github.com/Mohamed-Elhawary/eslint-plugin-code-style/compare/v1.0.6...v1.0.7
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## [1.0.6] - 2025-01-06
|
|
316
|
+
|
|
317
|
+
**Release Title:** Initial Public Release
|
|
318
|
+
|
|
319
|
+
**Version Range:** First Release
|
|
320
|
+
|
|
321
|
+
### Added
|
|
322
|
+
|
|
323
|
+
- **Initial Release**
|
|
324
|
+
- 45+ auto-fixable ESLint rules for React/JSX projects
|
|
325
|
+
- Full support for ESLint v9+ flat config
|
|
326
|
+
- Zero dependencies
|
|
327
|
+
|
|
328
|
+
### Requirements
|
|
329
|
+
|
|
330
|
+
- ESLint >= 9.0.0
|
|
331
|
+
- Node.js >= 20.0.0
|
|
332
|
+
|
|
333
|
+
### Stats
|
|
334
|
+
|
|
335
|
+
- Total Rules: 45+
|
|
336
|
+
- All rules are auto-fixable with `eslint --fix`
|
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
|
+
*64 auto-fixable rules 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 **64 custom auto-fixable rules** 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 **61 custom auto-fixable rules** for code formatting. Built
|
|
|
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
|
-
- **
|
|
39
|
+
- **Highly automated** — 58 of 64 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 64 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
|
-
|
|
100
|
+
**58 rules** support automatic fixing with `eslint --fix`. 6 rules are report-only (require manual changes).
|
|
101
101
|
|
|
102
102
|
</td>
|
|
103
103
|
<td width="50%">
|
|
@@ -250,88 +250,91 @@ rules: {
|
|
|
250
250
|
|
|
251
251
|
## 📖 Rules Categories
|
|
252
252
|
|
|
253
|
-
>
|
|
253
|
+
> **64 rules total** — 58 with auto-fix 🔧, 6 report-only. See detailed examples in [Rules Reference](#-rules-reference) below.
|
|
254
254
|
>
|
|
255
|
-
>
|
|
255
|
+
> **Legend:** 🔧 Auto-fixable with `eslint --fix` • ⚙️ Customizable options
|
|
256
256
|
|
|
257
257
|
| Rule | Description |
|
|
258
258
|
|------|-------------|
|
|
259
259
|
| **Array Rules** | |
|
|
260
|
-
| `array-items-per-line` | Collapse arrays ≤ threshold to one line; expand larger arrays with each item on own line (default: ≤3) ⚙️ |
|
|
261
|
-
| `array-objects-on-new-lines` | Each object in an array starts on its own line for better visual scanning |
|
|
260
|
+
| `array-items-per-line` | Collapse arrays ≤ threshold to one line; expand larger arrays with each item on own line (default: ≤3) 🔧 ⚙️ |
|
|
261
|
+
| `array-objects-on-new-lines` | Each object in an array starts on its own line for better visual scanning 🔧 |
|
|
262
262
|
| **Arrow Function Rules** | |
|
|
263
|
-
| `arrow-function-block-body` | Wrap multiline arrow function expressions in parentheses for clear boundaries |
|
|
264
|
-
| `arrow-function-simple-jsx` | Collapse arrow functions returning simple single-element JSX to one line, remove unnecessary parens |
|
|
265
|
-
| `arrow-function-simplify` | Convert block body with single return to implicit return: `() => { return x; }` → `() => x` |
|
|
266
|
-
| `curried-arrow-same-line` | Curried arrow functions start on same line as `=>`, not on new line |
|
|
263
|
+
| `arrow-function-block-body` | Wrap multiline arrow function expressions in parentheses for clear boundaries 🔧 |
|
|
264
|
+
| `arrow-function-simple-jsx` | Collapse arrow functions returning simple single-element JSX to one line, remove unnecessary parens 🔧 |
|
|
265
|
+
| `arrow-function-simplify` | Convert block body with single return to implicit return: `() => { return x; }` → `() => x` 🔧 |
|
|
266
|
+
| `curried-arrow-same-line` | Curried arrow functions start on same line as `=>`, not on new line 🔧 |
|
|
267
267
|
| **Call Expression Rules** | |
|
|
268
|
-
| `function-arguments-format` | Args ≥ threshold or multiline: first arg on new line, each on own line, closing `)` on new line (default: ≥2) ⚙️ |
|
|
269
|
-
| `nested-call-closing-brackets` | Chain closing brackets on same line: `}));` not scattered across lines |
|
|
270
|
-
| `no-empty-lines-in-function-calls` | No empty lines between arguments or after `(`/before `)` |
|
|
271
|
-
| `opening-brackets-same-line` | Opening `{`, `[`, or `(` on same line as function call, not on new line |
|
|
272
|
-
| `simple-call-single-line` | Collapse simple arrow function calls to single line (including callbacks with params and optional chaining) |
|
|
273
|
-
| `single-argument-on-one-line` | Single simple argument stays on one line: `fn(x)` not expanded |
|
|
268
|
+
| `function-arguments-format` | Args ≥ threshold or multiline: first arg on new line, each on own line, closing `)` on new line (default: ≥2) 🔧 ⚙️ |
|
|
269
|
+
| `nested-call-closing-brackets` | Chain closing brackets on same line: `}));` not scattered across lines 🔧 |
|
|
270
|
+
| `no-empty-lines-in-function-calls` | No empty lines between arguments or after `(`/before `)` 🔧 |
|
|
271
|
+
| `opening-brackets-same-line` | Opening `{`, `[`, or `(` on same line as function call, not on new line 🔧 |
|
|
272
|
+
| `simple-call-single-line` | Collapse simple arrow function calls to single line (including callbacks with params and optional chaining) 🔧 |
|
|
273
|
+
| `single-argument-on-one-line` | Single simple argument stays on one line: `fn(x)` not expanded 🔧 |
|
|
274
274
|
| **Comment Rules** | |
|
|
275
|
-
| `comment-format` | Space after `//`, space inside `/* */`, convert single-line blocks to `//`, no blank lines between file-top comments |
|
|
275
|
+
| `comment-format` | Space after `//`, space inside `/* */`, convert single-line blocks to `//`, no blank lines between file-top comments 🔧 |
|
|
276
276
|
| **Component Rules** | |
|
|
277
|
-
| `component-props-destructure` | Component props must be destructured `({ prop })` not received as `(props)` |
|
|
278
|
-
| `component-props-inline-type` | Inline type annotation `} : {` with matching props, proper spacing, commas, no interface reference |
|
|
277
|
+
| `component-props-destructure` | Component props must be destructured `({ prop })` not received as `(props)` 🔧 |
|
|
278
|
+
| `component-props-inline-type` | Inline type annotation `} : {` with matching props, proper spacing, commas, no interface reference 🔧 |
|
|
279
279
|
| **Control Flow Rules** | |
|
|
280
|
-
| `block-statement-newlines` | Newline after `{` and before `}` in if/for/while/function blocks |
|
|
281
|
-
| `if-statement-format` | `{` on same line as `if`/`else if`, `else` on same line as `}`, proper spacing |
|
|
282
|
-
| `multiline-if-conditions` | Conditions exceeding threshold get one operand per line with proper indentation (default: >3) ⚙️ |
|
|
283
|
-
| `no-empty-lines-in-switch-cases` | No empty line after `case X:` before code, no empty lines between cases |
|
|
280
|
+
| `block-statement-newlines` | Newline after `{` and before `}` in if/for/while/function blocks 🔧 |
|
|
281
|
+
| `if-statement-format` | `{` on same line as `if`/`else if`, `else` on same line as `}`, proper spacing 🔧 |
|
|
282
|
+
| `multiline-if-conditions` | Conditions exceeding threshold get one operand per line with proper indentation (default: >3) 🔧 ⚙️ |
|
|
283
|
+
| `no-empty-lines-in-switch-cases` | No empty line after `case X:` before code, no empty lines between cases 🔧 |
|
|
284
|
+
| `ternary-condition-multiline` | Ternary conditions exceeding threshold get one operand per line (default: >3) 🔧 ⚙️ |
|
|
284
285
|
| **Function Rules** | |
|
|
285
|
-
| `function-call-spacing` | No space between function name and `(`: `fn()` not `fn ()` |
|
|
286
|
-
| `function-declaration-style` | Auto-fix for `func-style`: converts function declarations to arrow expressions |
|
|
287
|
-
| `function-naming-convention` | Functions use camelCase, start with verb (get/set/handle/is/has), handlers end with Handler |
|
|
288
|
-
| `function-object-destructure` | Non-component functions: use typed params (not destructured), destructure in body; report dot notation access |
|
|
289
|
-
| `function-params-per-line` | When multiline, each param on own line with consistent indentation |
|
|
290
|
-
| `no-empty-lines-in-function-params` | No empty lines between parameters or after `(`/before `)` |
|
|
286
|
+
| `function-call-spacing` | No space between function name and `(`: `fn()` not `fn ()` 🔧 |
|
|
287
|
+
| `function-declaration-style` | Auto-fix for `func-style`: converts function declarations to arrow expressions 🔧 |
|
|
288
|
+
| `function-naming-convention` | Functions use camelCase, start with verb (get/set/handle/is/has), handlers end with Handler 🔧 |
|
|
289
|
+
| `function-object-destructure` | Non-component functions: use typed params (not destructured), destructure in body; report dot notation access 🔧 |
|
|
290
|
+
| `function-params-per-line` | When multiline, each param on own line with consistent indentation 🔧 |
|
|
291
|
+
| `no-empty-lines-in-function-params` | No empty lines between parameters or after `(`/before `)` 🔧 |
|
|
291
292
|
| **Hook Rules** | |
|
|
292
|
-
| `hook-callback-format` | React hooks: callback on new line, deps array on separate line, proper indentation |
|
|
293
|
-
| `hook-deps-per-line` | Collapse deps ≤ threshold to one line; expand larger arrays with each dep on own line (default: >2) ⚙️ |
|
|
293
|
+
| `hook-callback-format` | React hooks: callback on new line, deps array on separate line, proper indentation 🔧 |
|
|
294
|
+
| `hook-deps-per-line` | Collapse deps ≤ threshold to one line; expand larger arrays with each dep on own line (default: >2) 🔧 ⚙️ |
|
|
294
295
|
| **Import/Export Rules** | |
|
|
295
296
|
| `absolute-imports-only` | Use alias imports from index files only (not deep paths), no relative imports (default: `@/`) ⚙️ |
|
|
296
|
-
| `export-format` | `export {` on same line; collapse ≤ threshold to one line; expand larger with each specifier on own line (default: ≤3) ⚙️ |
|
|
297
|
-
| `import-format` | `import {` and `} from` on same line; collapse ≤ threshold; expand larger with each specifier on own line (default: ≤3) ⚙️ |
|
|
298
|
-
| `import-source-spacing` | No leading/trailing spaces inside import path quotes |
|
|
299
|
-
| `index-export-style` | Index files: no blank lines, enforce shorthand or import-export style; Regular files: require blank lines between exports (default: shorthand) ⚙️ |
|
|
297
|
+
| `export-format` | `export {` on same line; collapse ≤ threshold to one line; expand larger with each specifier on own line (default: ≤3) 🔧 ⚙️ |
|
|
298
|
+
| `import-format` | `import {` and `} from` on same line; collapse ≤ threshold; expand larger with each specifier on own line (default: ≤3) 🔧 ⚙️ |
|
|
299
|
+
| `import-source-spacing` | No leading/trailing spaces inside import path quotes 🔧 |
|
|
300
|
+
| `index-export-style` | Index files: no blank lines, enforce shorthand or import-export style; Regular files: require blank lines between exports (default: shorthand) 🔧 ⚙️ |
|
|
301
|
+
| `index-exports-only` | Index files should only contain imports and exports, not type/interface definitions |
|
|
300
302
|
| `module-index-exports` | Index files must export all folder contents (files and subfolders) ⚙️ |
|
|
301
303
|
| **JSX Rules** | |
|
|
302
|
-
| `classname-dynamic-at-end` | Dynamic expressions (`${className}`) must be at the end of class strings (JSX and variables) |
|
|
303
|
-
| `classname-multiline` | Long className strings broken into multiple lines; smart detection for objects/returns with Tailwind values ⚙️ |
|
|
304
|
-
| `classname-no-extra-spaces` | No extra/leading/trailing spaces in class strings; smart detection for objects/returns with Tailwind values |
|
|
305
|
-
| `classname-order` | Tailwind class ordering in variables/objects/returns; smart detection for Tailwind values |
|
|
306
|
-
| `jsx-children-on-new-line` | Multiple JSX children: each on own line with proper indentation |
|
|
307
|
-
| `jsx-closing-bracket-spacing` | No space before `>` or `/>` in JSX tags |
|
|
308
|
-
| `jsx-element-child-new-line` | Nested JSX elements on new lines; text/expression children can stay inline |
|
|
309
|
-
| `jsx-logical-expression-simplify` | Remove unnecessary parens around conditions and JSX in logical expressions |
|
|
310
|
-
| `jsx-parentheses-position` | Opening `(` for multiline JSX on same line as `return`/`=>`, not on new line |
|
|
304
|
+
| `classname-dynamic-at-end` | Dynamic expressions (`${className}`) must be at the end of class strings (JSX and variables) 🔧 |
|
|
305
|
+
| `classname-multiline` | Long className strings broken into multiple lines; smart detection for objects/returns with Tailwind values 🔧 ⚙️ |
|
|
306
|
+
| `classname-no-extra-spaces` | No extra/leading/trailing spaces in class strings; smart detection for objects/returns with Tailwind values 🔧 |
|
|
307
|
+
| `classname-order` | Tailwind class ordering in variables/objects/returns; smart detection for Tailwind values 🔧 |
|
|
308
|
+
| `jsx-children-on-new-line` | Multiple JSX children: each on own line with proper indentation 🔧 |
|
|
309
|
+
| `jsx-closing-bracket-spacing` | No space before `>` or `/>` in JSX tags 🔧 |
|
|
310
|
+
| `jsx-element-child-new-line` | Nested JSX elements on new lines; text/expression children can stay inline 🔧 |
|
|
311
|
+
| `jsx-logical-expression-simplify` | Remove unnecessary parens around conditions and JSX in logical expressions 🔧 |
|
|
312
|
+
| `jsx-parentheses-position` | Opening `(` for multiline JSX on same line as `return`/`=>`, not on new line 🔧 |
|
|
311
313
|
| `jsx-prop-naming-convention` | Props: camelCase for regular, kebab-case for data-*/aria-*, PascalCase for component refs |
|
|
312
|
-
| `jsx-simple-element-one-line` | Collapse simple JSX with single text/expression child to one line |
|
|
313
|
-
| `jsx-string-value-trim` | No leading/trailing whitespace inside JSX string attribute values |
|
|
314
|
-
| `jsx-ternary-format` | Simple ternaries on one line; complex branches get parens with proper indentation |
|
|
315
|
-
| `no-empty-lines-in-jsx` | No empty lines between children or after opening/before closing tags |
|
|
314
|
+
| `jsx-simple-element-one-line` | Collapse simple JSX with single text/expression child to one line 🔧 |
|
|
315
|
+
| `jsx-string-value-trim` | No leading/trailing whitespace inside JSX string attribute values 🔧 |
|
|
316
|
+
| `jsx-ternary-format` | Simple ternaries on one line; complex branches get parens with proper indentation 🔧 |
|
|
317
|
+
| `no-empty-lines-in-jsx` | No empty lines between children or after opening/before closing tags 🔧 |
|
|
316
318
|
| **Object Rules** | |
|
|
317
|
-
| `no-empty-lines-in-objects` | No empty lines between properties or after `{`/before `}` |
|
|
318
|
-
| `object-property-per-line` | Collapse ≤ threshold to one line; expand larger with `{`/`}` on own lines and each property on own line (default: ≥2) ⚙️ |
|
|
319
|
-
| `object-property-value-brace` | Opening `{` of object value on same line as `:`, not on new line |
|
|
320
|
-
| `object-property-value-format` | Simple property values on same line as `:`, not on new line |
|
|
321
|
-
| `string-property-spacing` | No leading/trailing spaces inside string property keys |
|
|
319
|
+
| `no-empty-lines-in-objects` | No empty lines between properties or after `{`/before `}` 🔧 |
|
|
320
|
+
| `object-property-per-line` | Collapse ≤ threshold to one line; expand larger with `{`/`}` on own lines and each property on own line (default: ≥2) 🔧 ⚙️ |
|
|
321
|
+
| `object-property-value-brace` | Opening `{` of object value on same line as `:`, not on new line 🔧 |
|
|
322
|
+
| `object-property-value-format` | Simple property values on same line as `:`, not on new line 🔧 |
|
|
323
|
+
| `string-property-spacing` | No leading/trailing spaces inside string property keys 🔧 |
|
|
322
324
|
| **Spacing Rules** | |
|
|
323
|
-
| `assignment-value-same-line` | Assignment values start on same line as `=`, not on new line |
|
|
324
|
-
| `member-expression-bracket-spacing` | No spaces inside brackets in computed member expressions: `arr[0]` not `arr[ 0 ]` |
|
|
325
|
+
| `assignment-value-same-line` | Assignment values start on same line as `=`, not on new line 🔧 |
|
|
326
|
+
| `member-expression-bracket-spacing` | No spaces inside brackets in computed member expressions: `arr[0]` not `arr[ 0 ]` 🔧 |
|
|
325
327
|
| **TypeScript Rules** | |
|
|
326
|
-
| `enum-format` | Enforce enum naming (PascalCase + Enum suffix), UPPER_CASE members, no empty lines, and trailing commas |
|
|
327
|
-
| `interface-format` | Enforce interface naming (PascalCase + Interface suffix), camelCase properties, no empty lines, and trailing commas |
|
|
328
|
-
| `type-
|
|
329
|
-
| `type-
|
|
328
|
+
| `enum-format` | Enforce enum naming (PascalCase + Enum suffix), UPPER_CASE members, no empty lines, and trailing commas 🔧 |
|
|
329
|
+
| `interface-format` | Enforce interface naming (PascalCase + Interface suffix), camelCase properties, no empty lines, and trailing commas 🔧 |
|
|
330
|
+
| `no-inline-type-definitions` | Inline union types in function params should be extracted to named types ⚙️ |
|
|
331
|
+
| `type-annotation-spacing` | Enforce consistent spacing in type annotations: no space before colon/generic/array brackets, one space after colon 🔧 |
|
|
332
|
+
| `type-format` | Enforce type naming (PascalCase + Type suffix), camelCase properties, no empty lines, and trailing commas 🔧 |
|
|
330
333
|
| `typescript-definition-location` | Enforce TypeScript definitions (interfaces, types, enums) to be in designated folders ⚙️ |
|
|
331
334
|
| **React Rules** | |
|
|
332
|
-
| `react-code-order` | Enforce consistent ordering in components and hooks: props destructure → refs → state → redux → router → context → custom hooks → derived → memo → callback → handlers → effects → return |
|
|
335
|
+
| `react-code-order` | Enforce consistent ordering in components and hooks: props destructure → refs → state → redux → router → context → custom hooks → derived → memo → callback → handlers → effects → return 🔧 |
|
|
333
336
|
| **Variable Rules** | |
|
|
334
|
-
| `variable-naming-convention` | camelCase for all variables and constants, PascalCase for components, `use` prefix for hooks |
|
|
337
|
+
| `variable-naming-convention` | camelCase for all variables and constants, PascalCase for components, `use` prefix for hooks 🔧 |
|
|
335
338
|
|
|
336
339
|
<br />
|
|
337
340
|
|
|
@@ -339,7 +342,7 @@ rules: {
|
|
|
339
342
|
|
|
340
343
|
## 📖 Rules Reference
|
|
341
344
|
|
|
342
|
-
>
|
|
345
|
+
> Rules marked with 🔧 are **auto-fixable** using `eslint --fix`
|
|
343
346
|
|
|
344
347
|
<br />
|
|
345
348
|
|
package/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export type RuleNames =
|
|
|
30
30
|
| "code-style/import-format"
|
|
31
31
|
| "code-style/import-source-spacing"
|
|
32
32
|
| "code-style/index-export-style"
|
|
33
|
+
| "code-style/index-exports-only"
|
|
33
34
|
| "code-style/classname-dynamic-at-end"
|
|
34
35
|
| "code-style/classname-multiline"
|
|
35
36
|
| "code-style/classname-no-extra-spaces"
|
|
@@ -47,6 +48,7 @@ export type RuleNames =
|
|
|
47
48
|
| "code-style/module-index-exports"
|
|
48
49
|
| "code-style/multiline-if-conditions"
|
|
49
50
|
| "code-style/nested-call-closing-brackets"
|
|
51
|
+
| "code-style/no-inline-type-definitions"
|
|
50
52
|
| "code-style/no-empty-lines-in-function-calls"
|
|
51
53
|
| "code-style/no-empty-lines-in-function-params"
|
|
52
54
|
| "code-style/no-empty-lines-in-jsx"
|
|
@@ -59,8 +61,10 @@ export type RuleNames =
|
|
|
59
61
|
| "code-style/simple-call-single-line"
|
|
60
62
|
| "code-style/single-argument-on-one-line"
|
|
61
63
|
| "code-style/string-property-spacing"
|
|
64
|
+
| "code-style/ternary-condition-multiline"
|
|
62
65
|
| "code-style/enum-format"
|
|
63
66
|
| "code-style/interface-format"
|
|
67
|
+
| "code-style/type-annotation-spacing"
|
|
64
68
|
| "code-style/type-format"
|
|
65
69
|
| "code-style/typescript-definition-location"
|
|
66
70
|
| "code-style/variable-naming-convention";
|
|
@@ -112,6 +116,7 @@ interface PluginRules {
|
|
|
112
116
|
"import-format": Rule.RuleModule;
|
|
113
117
|
"import-source-spacing": Rule.RuleModule;
|
|
114
118
|
"index-export-style": Rule.RuleModule;
|
|
119
|
+
"index-exports-only": Rule.RuleModule;
|
|
115
120
|
"classname-dynamic-at-end": Rule.RuleModule;
|
|
116
121
|
"classname-multiline": Rule.RuleModule;
|
|
117
122
|
"classname-no-extra-spaces": Rule.RuleModule;
|
|
@@ -129,6 +134,7 @@ interface PluginRules {
|
|
|
129
134
|
"module-index-exports": Rule.RuleModule;
|
|
130
135
|
"multiline-if-conditions": Rule.RuleModule;
|
|
131
136
|
"nested-call-closing-brackets": Rule.RuleModule;
|
|
137
|
+
"no-inline-type-definitions": Rule.RuleModule;
|
|
132
138
|
"no-empty-lines-in-function-calls": Rule.RuleModule;
|
|
133
139
|
"no-empty-lines-in-function-params": Rule.RuleModule;
|
|
134
140
|
"no-empty-lines-in-jsx": Rule.RuleModule;
|
|
@@ -141,8 +147,10 @@ interface PluginRules {
|
|
|
141
147
|
"simple-call-single-line": Rule.RuleModule;
|
|
142
148
|
"single-argument-on-one-line": Rule.RuleModule;
|
|
143
149
|
"string-property-spacing": Rule.RuleModule;
|
|
150
|
+
"ternary-condition-multiline": Rule.RuleModule;
|
|
144
151
|
"enum-format": Rule.RuleModule;
|
|
145
152
|
"interface-format": Rule.RuleModule;
|
|
153
|
+
"type-annotation-spacing": Rule.RuleModule;
|
|
146
154
|
"type-format": Rule.RuleModule;
|
|
147
155
|
"typescript-definition-location": Rule.RuleModule;
|
|
148
156
|
"variable-naming-convention": Rule.RuleModule;
|