eslint-config-agent 1.2.0 โ 1.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/CHANGELOG.md +6 -0
- package/README.md +3 -85
- package/package.json +1 -1
- package/rules/README.md +0 -42
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. See [Conven
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
## [1.2.1](https://github.com/tupe12334/eslint-config/compare/v1.2.0...v1.2.1) (2025-09-11)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* remove outdated TODO and ESLint rules documentation ([4d820ce](https://github.com/tupe12334/eslint-config/commit/4d820cec99d8ffb8e9e23c8c313e644351871d70))
|
|
12
|
+
|
|
7
13
|
## [1.2.0](https://github.com/tupe12334/eslint-config/compare/v1.1.4...v1.2.0) (2025-09-11)
|
|
8
14
|
|
|
9
15
|
### Features
|
package/README.md
CHANGED
|
@@ -209,36 +209,6 @@ This ESLint configuration prioritizes **explicit code** over convenient shortcut
|
|
|
209
209
|
- **๐ Self-Documenting**: Code that explains its intent without extensive comments
|
|
210
210
|
- **๐ ๏ธ Maintainable**: Patterns that remain clear even as the codebase grows
|
|
211
211
|
|
|
212
|
-
### Key Rules Enforced
|
|
213
|
-
|
|
214
|
-
#### Type Safety Rules
|
|
215
|
-
- **๐ซ No Optional Chaining** (`?.`): Forces explicit null/undefined checks
|
|
216
|
-
```typescript
|
|
217
|
-
// โ Avoid
|
|
218
|
-
const name = user?.profile?.name;
|
|
219
|
-
|
|
220
|
-
// โ
Preferred
|
|
221
|
-
const name = user && user.profile ? user.profile.name : undefined;
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
- **๐ซ No Nullish Coalescing** (`??`): Use explicit checks instead
|
|
225
|
-
```typescript
|
|
226
|
-
// โ Avoid
|
|
227
|
-
const name = userName ?? 'Anonymous';
|
|
228
|
-
|
|
229
|
-
// โ
Preferred
|
|
230
|
-
const name = userName !== null && userName !== undefined ? userName : 'Anonymous';
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
#### File Organization Rules
|
|
234
|
-
- **๐ JSX File Extensions**: JSX syntax only allowed in `.tsx` and `.jsx` files
|
|
235
|
-
- **๐ Function Length**: Maximum 100 lines per function (warning level)
|
|
236
|
-
- **๐งน No Trailing Spaces**: Enforces clean, consistent formatting
|
|
237
|
-
|
|
238
|
-
#### React & TypeScript Rules
|
|
239
|
-
- **โ๏ธ React Hooks**: Full enforcement of hooks rules and dependency arrays
|
|
240
|
-
- **๐ค TypeScript**: Strict type checking with explicit type assertions
|
|
241
|
-
- **๐ฆ Import/Export**: Consistent module patterns and import ordering
|
|
242
212
|
|
|
243
213
|
### Supported File Types & Configurations
|
|
244
214
|
|
|
@@ -263,21 +233,9 @@ This ESLint configuration prioritizes **explicit code** over convenient shortcut
|
|
|
263
233
|
- Compatible with Preact-specific patterns and optimizations
|
|
264
234
|
- Shared configuration with React rules where applicable
|
|
265
235
|
|
|
266
|
-
###
|
|
236
|
+
### Configuration Philosophy
|
|
267
237
|
|
|
268
|
-
|
|
269
|
-
- TypeScript strict type checking
|
|
270
|
-
- React hooks validation
|
|
271
|
-
- Import/export consistency
|
|
272
|
-
- Function complexity limits
|
|
273
|
-
- Whitespace and formatting
|
|
274
|
-
|
|
275
|
-
#### **Disabled Rules**
|
|
276
|
-
Many common ESLint and React rules are intentionally disabled to reduce noise while focusing on the most impactful code quality issues:
|
|
277
|
-
- `react/react-in-jsx-scope` (not needed with modern React)
|
|
278
|
-
- `@typescript-eslint/no-unused-vars` (TypeScript handles this)
|
|
279
|
-
- `no-undef` (TypeScript handles this)
|
|
280
|
-
- Plus 50+ other rules optimized for developer productivity
|
|
238
|
+
This configuration focuses on enforcing patterns that improve long-term maintainability while reducing noise from less impactful rules. The ruleset is carefully curated to balance developer productivity with code quality.
|
|
281
239
|
|
|
282
240
|
## Migration Guide
|
|
283
241
|
|
|
@@ -398,37 +356,6 @@ npm install --save-dev eslint@^9.34.0
|
|
|
398
356
|
|
|
399
357
|
### Frequently Asked Questions
|
|
400
358
|
|
|
401
|
-
#### **Q: Why are optional chaining and nullish coalescing disabled?**
|
|
402
|
-
A: These features, while convenient, can hide potential runtime errors. Explicit null checks make your code's intention clearer and prevent unexpected behavior when dealing with complex nested objects.
|
|
403
|
-
|
|
404
|
-
#### **Q: Can I enable optional chaining for specific files?**
|
|
405
|
-
A: Yes! Use file-specific overrides:
|
|
406
|
-
```javascript
|
|
407
|
-
export default [
|
|
408
|
-
...config,
|
|
409
|
-
{
|
|
410
|
-
files: ['src/legacy/**/*.ts'],
|
|
411
|
-
rules: {
|
|
412
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
413
|
-
'@typescript-eslint/prefer-optional-chain': 'off',
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
];
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
#### **Q: How do I handle large existing codebases?**
|
|
420
|
-
A: Start with warnings instead of errors:
|
|
421
|
-
```javascript
|
|
422
|
-
export default [
|
|
423
|
-
...config,
|
|
424
|
-
{
|
|
425
|
-
rules: {
|
|
426
|
-
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
|
427
|
-
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
];
|
|
431
|
-
```
|
|
432
359
|
|
|
433
360
|
#### **Q: Does this work with monorepos?**
|
|
434
361
|
A: Yes! Place the `eslint.config.js` at the root of each package, or use a shared config:
|
|
@@ -443,16 +370,7 @@ export default sharedConfig;
|
|
|
443
370
|
```
|
|
444
371
|
|
|
445
372
|
#### **Q: How does this help with AI coding assistants like GitHub Copilot, Claude, or ChatGPT?**
|
|
446
|
-
A: This configuration
|
|
447
|
-
|
|
448
|
-
- **๐ซ Prevents**: AI generating `user?.profile?.name` shortcuts
|
|
449
|
-
- **โ
Enforces**: AI writing `user && user.profile ? user.profile.name : undefined`
|
|
450
|
-
- **๐ซ Prevents**: AI using `value ?? fallback` patterns
|
|
451
|
-
- **โ
Enforces**: AI writing explicit null/undefined checks
|
|
452
|
-
- **๐ Limits**: Function length so AI doesn't generate massive functions
|
|
453
|
-
- **๐๏ธ Organizes**: File structure so AI puts JSX only in proper file extensions
|
|
454
|
-
|
|
455
|
-
This means you get AI assistance while maintaining code that you can actually understand and debug months later.
|
|
373
|
+
A: This configuration helps AI assistants generate more maintainable and debuggable code by enforcing consistent patterns and preventing problematic shortcuts. This means you get AI assistance while maintaining code that you can actually understand and debug months later.
|
|
456
374
|
|
|
457
375
|
#### **Q: How do I contribute or report issues?**
|
|
458
376
|
A: Please use the [GitHub repository](https://github.com/tupe12334/eslint-config) for issues and contributions.
|
package/package.json
CHANGED
package/rules/README.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# ESLint Rules Configuration
|
|
2
|
-
|
|
3
|
-
This directory contains custom rule configurations and their tests using ESLint's RuleTester.
|
|
4
|
-
|
|
5
|
-
## Structure
|
|
6
|
-
|
|
7
|
-
Each rule has its own directory with:
|
|
8
|
-
- `index.js` - The rule configuration (severity and options)
|
|
9
|
-
- `[rule-name].spec.js` - RuleTester test cases
|
|
10
|
-
|
|
11
|
-
## Available Rules
|
|
12
|
-
|
|
13
|
-
### no-trailing-spaces
|
|
14
|
-
- **Severity**: error
|
|
15
|
-
- **Description**: Disallows trailing whitespace at the end of lines
|
|
16
|
-
- **Options**:
|
|
17
|
-
- `skipBlankLines: false` - Check empty lines for trailing spaces
|
|
18
|
-
- `ignoreComments: false` - Check comments for trailing spaces
|
|
19
|
-
|
|
20
|
-
## Testing
|
|
21
|
-
|
|
22
|
-
Run individual rule tests:
|
|
23
|
-
```bash
|
|
24
|
-
cd rules/no-trailing-spaces
|
|
25
|
-
node no-trailing-spaces.spec.js
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Adding New Rules
|
|
29
|
-
|
|
30
|
-
1. Create a new directory: `rules/[rule-name]/`
|
|
31
|
-
2. Add `index.js` with the rule configuration
|
|
32
|
-
3. Add `[rule-name].spec.js` with RuleTester tests
|
|
33
|
-
4. Import the configuration in the main `index.js` file
|
|
34
|
-
|
|
35
|
-
Example structure:
|
|
36
|
-
```javascript
|
|
37
|
-
// rules/[rule-name]/index.js
|
|
38
|
-
export const rule = "error"; // or "warn"
|
|
39
|
-
export const options = { /* rule options */ };
|
|
40
|
-
export const [ruleName]Config = [rule, options];
|
|
41
|
-
export default [ruleName]Config;
|
|
42
|
-
```
|