@jmlweb/eslint-config-node 2.0.3 → 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 +16 -0
- package/README.md +57 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @jmlweb/eslint-config-node
|
|
2
2
|
|
|
3
|
+
## 2.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a9ece1: Update documentation to use pnpm commands instead of npm
|
|
8
|
+
- Updated dependencies [4a9ece1]
|
|
9
|
+
- @jmlweb/eslint-config-base@2.0.4
|
|
10
|
+
|
|
11
|
+
## 2.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
|
|
16
|
+
- Updated dependencies [6b73301]
|
|
17
|
+
- @jmlweb/eslint-config-base@2.0.3
|
|
18
|
+
|
|
3
19
|
## 2.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -21,9 +21,11 @@
|
|
|
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
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
28
|
+
|
|
27
29
|
## 🚀 Quick Start
|
|
28
30
|
|
|
29
31
|
Create an `eslint.config.js` file in your project root:
|
|
@@ -160,9 +162,35 @@ import { Component } from './component';
|
|
|
160
162
|
Fix import order automatically:
|
|
161
163
|
|
|
162
164
|
```bash
|
|
163
|
-
|
|
165
|
+
pnpm exec eslint --fix .
|
|
164
166
|
```
|
|
165
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
|
+
|
|
166
194
|
## 🎯 When to Use
|
|
167
195
|
|
|
168
196
|
Use this configuration when you want:
|
|
@@ -217,8 +245,8 @@ Add linting scripts to your `package.json`:
|
|
|
217
245
|
Then run:
|
|
218
246
|
|
|
219
247
|
```bash
|
|
220
|
-
|
|
221
|
-
|
|
248
|
+
pnpm lint # Lint all files
|
|
249
|
+
pnpm lint:fix # Fix auto-fixable issues
|
|
222
250
|
```
|
|
223
251
|
|
|
224
252
|
## 📋 Requirements
|
|
@@ -249,10 +277,35 @@ See real-world usage examples:
|
|
|
249
277
|
|
|
250
278
|
## 🔗 Related Packages
|
|
251
279
|
|
|
280
|
+
### Internal Packages
|
|
281
|
+
|
|
252
282
|
- [`@jmlweb/eslint-config-base`](../eslint-config-base) - Base TypeScript ESLint config (extended by this package)
|
|
253
283
|
- [`@jmlweb/tsconfig-node`](../tsconfig-node) - TypeScript configuration for Node.js libraries
|
|
254
284
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
255
285
|
|
|
286
|
+
### External Tools
|
|
287
|
+
|
|
288
|
+
- [ESLint](https://eslint.org/) - Pluggable linting utility for JavaScript and TypeScript
|
|
289
|
+
- [Node.js](https://nodejs.org/) - JavaScript runtime built on Chrome's V8 engine
|
|
290
|
+
- [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) - ESLint rules for Node.js
|
|
291
|
+
- [tsx](https://github.com/privatenumber/tsx) - TypeScript execute (ts-node alternative)
|
|
292
|
+
|
|
293
|
+
## 🔄 Migration Guide
|
|
294
|
+
|
|
295
|
+
### Upgrading to a New Version
|
|
296
|
+
|
|
297
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
298
|
+
|
|
299
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
300
|
+
|
|
301
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
302
|
+
|
|
303
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
304
|
+
|
|
305
|
+
## 📜 Changelog
|
|
306
|
+
|
|
307
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
308
|
+
|
|
256
309
|
## 📄 License
|
|
257
310
|
|
|
258
311
|
MIT
|
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",
|