@jmlweb/eslint-config-node 2.0.4 → 2.0.5
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 +8 -0
- package/README.md +30 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
## 📦 Installation
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
|
|
24
|
+
pnpm add -D @jmlweb/eslint-config-node eslint @eslint/js typescript-eslint eslint-config-prettier eslint-plugin-n eslint-plugin-simple-import-sort globals @jmlweb/eslint-config-base
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
@@ -162,9 +162,35 @@ import { Component } from './component';
|
|
|
162
162
|
Fix import order automatically:
|
|
163
163
|
|
|
164
164
|
```bash
|
|
165
|
-
|
|
165
|
+
pnpm exec eslint --fix .
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
+
## 🤔 Why Use This?
|
|
169
|
+
|
|
170
|
+
> **Philosophy**: Node.js applications should follow Node.js best practices and leverage the platform's capabilities correctly.
|
|
171
|
+
|
|
172
|
+
This package extends the base TypeScript config with Node.js-specific rules that prevent common Node.js pitfalls, enforce best practices for the platform, and provide proper global variable handling for the Node.js runtime.
|
|
173
|
+
|
|
174
|
+
### Design Decisions
|
|
175
|
+
|
|
176
|
+
**Node.js Plugin (`eslint-plugin-n`)**: Enforces Node.js best practices and catches platform-specific issues
|
|
177
|
+
|
|
178
|
+
- **Why**: Node.js has unique patterns (async I/O, modules, process management) that require specific rules. The plugin catches deprecated APIs, improper module usage, and process handling issues
|
|
179
|
+
- **Trade-off**: Additional rules to learn, but prevents Node.js-specific bugs
|
|
180
|
+
- **When to override**: When you know you're using a pattern correctly despite the warning (rare)
|
|
181
|
+
|
|
182
|
+
**Node.js Globals**: Automatically includes Node.js global variables (`process`, `__dirname`, `Buffer`, etc.)
|
|
183
|
+
|
|
184
|
+
- **Why**: Node.js applications need access to platform globals. Explicitly declaring them prevents "undefined variable" errors
|
|
185
|
+
- **Trade-off**: None - this is required for Node.js development
|
|
186
|
+
- **When to override**: Never - Node.js code needs these globals
|
|
187
|
+
|
|
188
|
+
**Extends Base TypeScript Config**: Inherits all strict type checking rules
|
|
189
|
+
|
|
190
|
+
- **Why**: Node.js applications benefit from strict typing, especially for API contracts, database models, and configuration
|
|
191
|
+
- **Trade-off**: More verbose code, but prevents runtime errors in production
|
|
192
|
+
- **When to override**: Follow the same guidelines as the base TypeScript config
|
|
193
|
+
|
|
168
194
|
## 🎯 When to Use
|
|
169
195
|
|
|
170
196
|
Use this configuration when you want:
|
|
@@ -219,8 +245,8 @@ Add linting scripts to your `package.json`:
|
|
|
219
245
|
Then run:
|
|
220
246
|
|
|
221
247
|
```bash
|
|
222
|
-
|
|
223
|
-
|
|
248
|
+
pnpm lint # Lint all files
|
|
249
|
+
pnpm lint:fix # Fix auto-fixable issues
|
|
224
250
|
```
|
|
225
251
|
|
|
226
252
|
## 📋 Requirements
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/eslint-config-node",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "ESLint configuration for Node.js projects with TypeScript, extending base config with Node.js-specific rules",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
55
55
|
"globals": "^15.0.0",
|
|
56
56
|
"typescript-eslint": "^8.0.0",
|
|
57
|
-
"@jmlweb/eslint-config-base": "2.0.
|
|
57
|
+
"@jmlweb/eslint-config-base": "2.0.4"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@jmlweb/eslint-config-base": "2.0.
|
|
60
|
+
"@jmlweb/eslint-config-base": "2.0.4"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@eslint/js": "^9.39.2",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"typescript": "^5.9.3",
|
|
72
72
|
"typescript-eslint": "^8.34.1",
|
|
73
73
|
"@jmlweb/tsconfig-internal": "0.0.1",
|
|
74
|
-
"@jmlweb/eslint-config-base": "2.0.
|
|
74
|
+
"@jmlweb/eslint-config-base": "2.0.4"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"build": "tsup",
|