@hs-web-team/eslint-config-node 3.0.0-next.9 → 3.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/CLAUDE.md +7 -2
- package/README.md +4 -6
- package/docs/MIGRATION-V3.md +2 -2
- package/index.js +15 -12
- package/package.json +5 -4
package/CLAUDE.md
CHANGED
|
@@ -26,8 +26,13 @@ When testing changes to this package in downstream projects, you'll typically:
|
|
|
26
26
|
### Core Configuration File
|
|
27
27
|
- **`index.js`**: The main ESLint configuration export using ESLint 9's flat config format
|
|
28
28
|
- Uses `@eslint/js`, `typescript-eslint`, and `globals` packages
|
|
29
|
-
- Exports
|
|
30
|
-
-
|
|
29
|
+
- Exports an array of configuration objects (flat config format)
|
|
30
|
+
- Structure:
|
|
31
|
+
1. Global ignores object
|
|
32
|
+
2. `js.configs.recommended` for JavaScript baseline
|
|
33
|
+
3. JavaScript-specific config for `**/*.{js,mjs,cjs}` files
|
|
34
|
+
4. Spreads `tseslint.configs.recommended` for TypeScript baseline
|
|
35
|
+
5. TypeScript-specific config for `**/*.{ts,mts,cts,tsx}` files
|
|
31
36
|
- Includes Node.js, ES2022, and Jest globals
|
|
32
37
|
- Common ignores: `node_modules`, `.serverless`, `.webpack`, `dist`, `eslint.config.js`
|
|
33
38
|
- Key custom rules: `no-console` (allows info/warn/error), `max-len` (120 chars), camelcase disabled
|
package/README.md
CHANGED
|
@@ -22,21 +22,19 @@ This is a list of ESLint rules that are recommended for use with **Hubspot Marke
|
|
|
22
22
|
2. Add to `eslint.config.js` in project root directory
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import { defineConfig } from 'eslint/config';
|
|
26
25
|
import wtConfig from '@hs-web-team/eslint-config-node';
|
|
27
26
|
|
|
28
|
-
export default
|
|
27
|
+
export default [
|
|
29
28
|
...wtConfig,
|
|
30
|
-
]
|
|
29
|
+
];
|
|
31
30
|
```
|
|
32
31
|
|
|
33
32
|
3. Extend the eslint on a project basis by adding rules to `eslint.config.js` e.g.
|
|
34
33
|
|
|
35
34
|
```typescript
|
|
36
|
-
import { defineConfig } from 'eslint/config';
|
|
37
35
|
import wtConfig from '@hs-web-team/eslint-config-node';
|
|
38
36
|
|
|
39
|
-
export default
|
|
37
|
+
export default [
|
|
40
38
|
// Add project-specific ignores here
|
|
41
39
|
{
|
|
42
40
|
ignores: ['dist/**'],
|
|
@@ -48,7 +46,7 @@ This is a list of ESLint rules that are recommended for use with **Hubspot Marke
|
|
|
48
46
|
},
|
|
49
47
|
},
|
|
50
48
|
...wtConfig, // This will include the shared rules from @hs-web-team/eslint-config-node
|
|
51
|
-
]
|
|
49
|
+
];
|
|
52
50
|
```
|
|
53
51
|
|
|
54
52
|
## Where to use it
|
package/docs/MIGRATION-V3.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
> This migration requires Node.js v22 or higher and a **manual migration** from `.eslintrc` to `eslint.config.mjs`.
|
|
8
8
|
|
|
9
9
|
- [ ] Upgrade to Node.js v22 or higher
|
|
10
|
-
- [ ]
|
|
11
|
-
- [ ] Update the package: `npm install @hs-web-team/eslint-config-node@latest`
|
|
10
|
+
- [ ] Update the package: `npm install -D @hs-web-team/eslint-config-node@latest`
|
|
12
11
|
- [ ] **Remove** `@hs-web-team/eslint-config-ts` from dependencies (no longer needed - TypeScript support is now included)
|
|
12
|
+
- [ ] Remove the `--ext .js,.ts` flag from the ESLint command in your project's package.json
|
|
13
13
|
- [ ] Manually create `eslint.config.mjs` (see [Manual Migration Guide](#manual-migration-guide) below)
|
|
14
14
|
- [ ] Delete `.eslintrc` file
|
|
15
15
|
- [ ] Run `npm run lint` to check for any errors
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import js from '@eslint/js';
|
|
2
2
|
import globals from 'globals';
|
|
3
3
|
import tseslint from 'typescript-eslint';
|
|
4
|
-
import { defineConfig } from 'eslint/config';
|
|
5
4
|
|
|
6
5
|
// Base rules for all JavaScript files
|
|
7
6
|
const baseRules = {
|
|
@@ -47,26 +46,30 @@ const commonIgnores = [
|
|
|
47
46
|
'eslint.config.js',
|
|
48
47
|
];
|
|
49
48
|
|
|
50
|
-
export default
|
|
49
|
+
export default [
|
|
50
|
+
// Global ignores
|
|
51
|
+
{
|
|
52
|
+
ignores: commonIgnores,
|
|
53
|
+
},
|
|
51
54
|
// Base config for all JavaScript files
|
|
55
|
+
js.configs.recommended,
|
|
52
56
|
{
|
|
53
57
|
files: ['**/*.{js,mjs,cjs}'],
|
|
54
|
-
plugins: { js },
|
|
55
|
-
extends: ['js/recommended'],
|
|
56
58
|
languageOptions: {
|
|
57
59
|
globals: {...globals.node, ...globals.es2022, ...globals.jest},
|
|
58
60
|
},
|
|
59
|
-
ignores: commonIgnores,
|
|
60
61
|
rules: baseRules,
|
|
61
62
|
},
|
|
62
|
-
// TypeScript config
|
|
63
|
+
// TypeScript config - restrict to TypeScript files only
|
|
64
|
+
...tseslint.configs.recommended.map(config => ({
|
|
65
|
+
...config,
|
|
66
|
+
files: ['**/*.{ts,mts,cts,tsx}'],
|
|
67
|
+
})),
|
|
63
68
|
{
|
|
64
69
|
files: ['**/*.{ts,mts,cts,tsx}'],
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
rules: {
|
|
68
|
-
...baseRules,
|
|
69
|
-
// Add any TypeScript-specific rules here
|
|
70
|
+
languageOptions: {
|
|
71
|
+
globals: {...globals.node, ...globals.es2022, ...globals.jest},
|
|
70
72
|
},
|
|
73
|
+
rules: baseRules,
|
|
71
74
|
},
|
|
72
|
-
]
|
|
75
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hs-web-team/eslint-config-node",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "HubSpot Marketing WebTeam ESLint rules for Node.js",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,14 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/HubSpotWebTeam/wt-eslint-node#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@eslint/eslintrc": "^3.3.
|
|
31
|
+
"@eslint/eslintrc": "^3.3.3",
|
|
32
32
|
"@eslint/js": "^9.39.1",
|
|
33
33
|
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
34
34
|
"@typescript-eslint/parser": "^8.46.3",
|
|
35
|
+
"eslint": "^9.39.1",
|
|
35
36
|
"eslint-formatter-checkstyle": "^9.0.1",
|
|
36
37
|
"globals": "^16.5.0",
|
|
37
38
|
"jiti": "^2.6.1",
|
|
38
|
-
"prettier": "^3.
|
|
39
|
-
"typescript-eslint": "^8.
|
|
39
|
+
"prettier": "^3.7.3",
|
|
40
|
+
"typescript-eslint": "^8.48.0"
|
|
40
41
|
}
|
|
41
42
|
}
|