@hs-web-team/eslint-config-node 2.1.2 → 3.0.0-next.4

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.
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- node: [20, 22]
14
+ node: [24]
15
15
 
16
16
  name: Node ${{ matrix.node }} sample
17
17
  steps:
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- node: [20, 22]
14
+ node: [24]
15
15
 
16
16
  name: Node ${{ matrix.node }} sample
17
17
  steps:
@@ -10,9 +10,21 @@ jobs:
10
10
  - uses: actions/checkout@v4
11
11
  - uses: actions/setup-node@v4
12
12
  with:
13
- node-version: 22
13
+ node-version: 24
14
14
  registry-url: 'https://registry.npmjs.org'
15
15
  - run: npm install
16
- - run: npm publish
16
+ - name: Publish to npm
17
+ run: |
18
+ VERSION=$(node -p "require('./package.json').version")
19
+ if [[ "$VERSION" =~ -next\. ]]; then
20
+ echo "Publishing prerelease version $VERSION with tag 'next'"
21
+ npm publish --tag next
22
+ elif [[ "$VERSION" =~ -(alpha|beta|rc)\. ]]; then
23
+ echo "Publishing prerelease version $VERSION with tag 'next'"
24
+ npm publish --tag next
25
+ else
26
+ echo "Publishing stable version $VERSION"
27
+ npm publish
28
+ fi
17
29
  env:
18
30
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -19,23 +19,36 @@ This is a list of ESLint rules that are recommended for use with **Hubspot Marke
19
19
  npm i -D @hs-web-team/eslint-config-node@latest
20
20
  ```
21
21
 
22
- 2. Add to `.eslintrc` in project root directory
22
+ 2. Add to `eslint.config.js` in project root directory
23
23
 
24
- ```json
25
- {
26
- "extends": "@hs-web-team/eslint-config-node"
27
- }
28
- ```
24
+ ```typescript
25
+ import { defineConfig } from 'eslint/config';
26
+ import wtConfig from '@hs-web-team/eslint-config-node';
29
27
 
30
- 3. Extend the eslint on a project basis by adding rules to `.eslintrc` e.g.
28
+ export default defineConfig([
29
+ ...wtConfig,
30
+ ]);
31
+ ```
31
32
 
32
- ```json
33
- {
34
- "extends": "@hs-web-team/eslint-config-node",
35
- "settings": {
36
- "import/resolver": "webpack"
37
- }
38
- }
33
+ 3. Extend the eslint on a project basis by adding rules to `eslint.config.js` e.g.
34
+
35
+ ```typescript
36
+ import { defineConfig } from 'eslint/config';
37
+ import wtConfig from '@hs-web-team/eslint-config-node';
38
+
39
+ export default defineConfig([
40
+ // Add project-specific ignores here
41
+ {
42
+ ignores: ['dist/**'],
43
+ },
44
+ // Add project-specific rules here
45
+ {
46
+ rules: {
47
+ 'no-console': 'error',
48
+ },
49
+ },
50
+ ...wtConfig, // This will include the shared rules from @hs-web-team/eslint-config-node
51
+ ]);
39
52
  ```
40
53
 
41
54
  ## Where to use it
@@ -67,3 +80,7 @@ This package includes a utility script to automatically add Prettier configurati
67
80
  ## Migration from v1 to v2
68
81
 
69
82
  See [MIGRATION-V2.md](./docs/MIGRATION-V2.md)
83
+
84
+ ## Migration from v2 to v3
85
+
86
+ See [MIGRATION-V3.md](./docs/MIGRATION-V3.md)
@@ -0,0 +1,24 @@
1
+ # Migration from v2 to v3
2
+
3
+ ## Steps to migrate
4
+
5
+ > **Note**
6
+ >
7
+ > This migration requires a manual review of the changes and also that you run your project in Node.js v22 or higher.
8
+
9
+ - [ ] Upgrade to Node.js v22 or higher
10
+ - [ ] Upgrade all dependencies to the latest version
11
+ - [ ] Update the package `npm install @hs-web-team/eslint-config-node@latest`
12
+ - [ ] Run the script `npx @eslint/migrate-config .eslintrc`
13
+ - [ ] Run `npm run lint` to check for any errors
14
+ - [ ] Commit the changes
15
+ - [ ] Create a PR
16
+ - [ ] Get it approved
17
+ - [ ] Merge it into `main`
18
+ - [ ] Test everything in QA
19
+ - [ ] Celebrate! 🎉
20
+
21
+ > **Important**
22
+ >
23
+ > Bear in mind that this migration will remove the `.eslintrc` file and replace it with `eslint.config.js`.
24
+ > Also the automated migration might fail to migrate some of the rules, so you may need to manually adjust the `eslint.config.js` file.
package/index.js CHANGED
@@ -1,45 +1,56 @@
1
- module.exports = {
2
- env: {
3
- commonjs: true,
4
- es2021: true,
5
- node: true,
6
- },
7
- ignorePatterns: ['/node_modules/', '/.serverless/', '/.eslintrc.js', '/.webpack/'],
8
- extends: ['airbnb-base'],
9
- parserOptions: {
10
- ecmaVersion: 'latest',
11
- },
12
- rules: {
13
- 'no-console': [
14
- 'error',
15
- {
16
- allow: ['info', 'warn', 'error'],
17
- },
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+ import tseslint from 'typescript-eslint';
4
+ import { defineConfig } from 'eslint/config';
5
+
6
+ export default defineConfig([
7
+ {
8
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
9
+ plugins: { js },
10
+ extends: ['js/recommended'],
11
+ languageOptions: {
12
+ globals: {...globals.node, ...globals.es2022},
13
+ },
14
+ ignores: [
15
+ '**/node_modules/**',
16
+ '**/.serverless/**',
17
+ '**/.webpack/**',
18
+ '**/dist/**',
19
+ 'eslint.config.js',
18
20
  ],
19
- camelcase: 0,
20
- 'comma-dangle': 1,
21
- 'arrow-parens': 0,
22
- 'no-plusplus': 0,
23
- 'no-underscore-dangle': 0,
24
- 'no-confusing-arrow': 0,
25
- 'import/no-unresolved': 0,
26
- 'import/prefer-default-export': 0,
27
- 'no-trailing-spaces': [2, { skipBlankLines: true }],
28
- 'no-unused-expressions': [1, { allowTernary: true }],
29
- 'max-len': [
30
- 2,
31
- {
32
- code: 120,
33
- ignoreStrings: true,
34
- ignoreTemplateLiterals: true,
35
- },
36
- ],
37
- 'operator-linebreak': 0,
38
- 'implicit-arrow-linebreaks': 0,
39
- 'implicit-arrow-linebreak': 0,
40
- 'object-curly-newline': 0,
41
- 'newline-per-chained-call': 0,
42
- indent: 0,
43
- 'function-paren-newline': 0,
21
+ rules: {
22
+ 'no-console': [
23
+ 'error',
24
+ {
25
+ allow: ['info', 'warn', 'error'],
26
+ },
27
+ ],
28
+ camelcase: 'off',
29
+ 'comma-dangle': ['warn', 'always-multiline'],
30
+ 'arrow-parens': 0,
31
+ 'no-plusplus': 0,
32
+ 'no-underscore-dangle': 0,
33
+ 'no-confusing-arrow': 0,
34
+ 'import/no-unresolved': 0,
35
+ 'import/prefer-default-export': 0,
36
+ 'no-trailing-spaces': ['error', { skipBlankLines: true }],
37
+ 'no-unused-expressions': ['warn', { allowTernary: true }],
38
+ 'max-len': [
39
+ 2,
40
+ {
41
+ code: 120,
42
+ ignoreStrings: true,
43
+ ignoreTemplateLiterals: true,
44
+ },
45
+ ],
46
+ 'operator-linebreak': 0,
47
+ 'implicit-arrow-linebreaks': 0,
48
+ 'implicit-arrow-linebreak': 0,
49
+ 'object-curly-newline': 0,
50
+ 'newline-per-chained-call': 0,
51
+ indent: 0,
52
+ 'function-paren-newline': 0,
53
+ },
44
54
  },
45
- };
55
+ tseslint.configs.recommended,
56
+ ]);
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@hs-web-team/eslint-config-node",
3
- "version": "2.1.2",
3
+ "version": "3.0.0-next.4",
4
4
  "description": "HubSpot Marketing WebTeam ESLint rules for Node.js",
5
5
  "main": "index.js",
6
+ "type": "module",
6
7
  "scripts": {
7
8
  "lint": "npx eslint -c ./index.js *.js --fix",
8
9
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -11,7 +12,7 @@
11
12
  "node": ">=22"
12
13
  },
13
14
  "bin": {
14
- "add-prettier": "./bin/add-prettier-scripts.js"
15
+ "add-prettier": "bin/add-prettier-scripts.js"
15
16
  },
16
17
  "repository": {
17
18
  "type": "git",
@@ -27,9 +28,13 @@
27
28
  },
28
29
  "homepage": "https://github.com/HubSpotWebTeam/wt-eslint-node#readme",
29
30
  "dependencies": {
30
- "eslint": "^8.57.1",
31
- "eslint-config-airbnb-base": "^15.0.0",
32
- "eslint-plugin-import": "^2.32.0",
33
- "prettier": "^3.6.2"
31
+ "@eslint/eslintrc": "^3.3.1",
32
+ "@eslint/js": "^9.39.1",
33
+ "@typescript-eslint/eslint-plugin": "^8.46.3",
34
+ "@typescript-eslint/parser": "^8.46.3",
35
+ "globals": "^16.5.0",
36
+ "prettier": "^3.6.2",
37
+ "jiti": "^2.6.1",
38
+ "typescript-eslint": "^8.46.3"
34
39
  }
35
40
  }