@haraka/eslint-config 2.0.4 → 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.
Files changed (4) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +48 -17
  3. package/index.js +31 -36
  4. package/package.json +10 -7
package/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
5
  ### Unreleased
6
6
 
7
+ ### [3.0.0] - 2026-05-24
8
+
9
+ - BREAKING: depend on eslint 10
10
+ - BREAKING: export a flat-config array from `index.js` (was a legacy `.eslintrc` object)
11
+ - package: `type: module`; ship as ESM
12
+ - deps: drop `@eslint/eslintrc` peer (consumers no longer need FlatCompat)
13
+ - deps: declare runtime deps on `@eslint/js` and `globals` (were peers)
14
+ - doc(README): document flat-config consumer pattern and 2.x→3.0 migration
15
+
7
16
  ### [2.0.4] - 2026-03-17
8
17
 
9
18
  - deps(all): added ^versions in package.json
@@ -143,3 +152,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
143
152
  [2.0.1]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.1
144
153
  [2.0.2]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.2
145
154
  [2.0.3]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.3
155
+ [2.0.4]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.4
156
+ [3.0.0]: https://github.com/haraka/haraka-eslint/releases/tag/v3.0.0
package/README.md CHANGED
@@ -9,24 +9,28 @@ In your Haraka module:
9
9
 
10
10
  1. Add to NPM dependencies:
11
11
 
12
- `npm install --save-dev @haraka/eslint-config`
13
-
14
- 2. Configure eslint:
15
-
16
- ```sh
17
- cat <<EOLINT > eslint.config.mjs
18
- env:
19
- node: true
20
- es6: true
21
- es2024: true
22
- extends: "@haraka"
23
- EOLINT
12
+ `npm install --save-dev @haraka/eslint-config eslint`
13
+
14
+ 2. Configure ESLint with a flat config (`eslint.config.mjs`):
15
+
16
+ ```js
17
+ import haraka from '@haraka/eslint-config'
18
+
19
+ export default [
20
+ ...haraka,
21
+ {
22
+ // project-specific overrides
23
+ rules: {
24
+ 'no-unused-vars': ['warn', { caughtErrorsIgnorePattern: '^ignore' }],
25
+ },
26
+ },
27
+ ]
24
28
  ```
25
29
 
26
30
  3. Add to the "scripts" section of `package.json`:
27
31
 
28
32
  ```json
29
- "lint": "npx eslint *.js test"
33
+ "lint": "npx eslint *.js test",
30
34
  "lint:fix": "npx eslint --fix *.js test"
31
35
  ```
32
36
 
@@ -34,17 +38,44 @@ EOLINT
34
38
 
35
39
  `npm run lint`
36
40
 
41
+ ## Upgrading from 2.x
42
+
43
+ The 3.x release migrates `@haraka/eslint-config` from the legacy `.eslintrc`
44
+ shape to a flat-config array. Consumers no longer need `@eslint/eslintrc` /
45
+ `FlatCompat`. Replace the old wrapper:
46
+
47
+ ```js
48
+ // before
49
+ import { FlatCompat } from '@eslint/eslintrc'
50
+ const compat = new FlatCompat({ baseDirectory: __dirname, ... })
51
+ export default [...compat.extends('@haraka'), { /* overrides */ }]
52
+ ```
53
+
54
+ with:
55
+
56
+ ```js
57
+ // after
58
+ import haraka from '@haraka/eslint-config'
59
+ export default [
60
+ ...haraka,
61
+ {
62
+ /* overrides */
63
+ },
64
+ ]
65
+ ```
66
+
67
+ Peer dependency is now `eslint@^10`.
68
+
37
69
  ## Usage
38
70
 
39
71
  To check your project against lint rules:
40
72
 
41
73
  `npm run lint`
42
74
 
43
- Step #4 above does this automatically when CI tests are set up.
44
-
45
- If you agree with the lint suggestions, you can run `npm run lint:fix` and the changes will be made to your files automatically.
75
+ If you agree with the lint suggestions, run `npm run lint:fix` and the
76
+ changes will be made to your files automatically.
46
77
 
47
- Custom rules can be added to the eslint config file.
78
+ Custom rules can be added directly in the consumer's `eslint.config.mjs`.
48
79
 
49
80
  <!-- leave these buried at the bottom of the document -->
50
81
 
package/index.js CHANGED
@@ -1,38 +1,33 @@
1
- 'use strict'
1
+ import globals from 'globals'
2
+ import js from '@eslint/js'
2
3
 
3
- module.exports = {
4
- env: {
5
- node: true,
6
- es6: true,
7
- mocha: true,
8
- es2024: true,
9
- // es2023: true, /* enable with mocha 9 */
10
- // es2024: true, /* enable after 2024-04-30, when node 18 LTS ends */
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ ecmaVersion: 'latest',
9
+ globals: {
10
+ ...globals.node,
11
+ ...globals.mocha,
12
+ CONT: 'readonly',
13
+ STOP: 'readonly',
14
+ DENY: 'readonly',
15
+ DENYSOFT: 'readonly',
16
+ DENYDISCONNECT: 'readonly',
17
+ DISCONNECT: 'readonly',
18
+ OK: 'readonly',
19
+ NEXT_HOOK: 'readonly',
20
+ DELAY: 'readonly',
21
+ DENYSOFTDISCONNECT: 'readonly',
22
+ },
23
+ },
24
+ rules: {
25
+ 'no-empty': ['error', { allowEmptyCatch: true }],
26
+ 'no-undef': 'warn',
27
+ 'no-console': 'off',
28
+ 'no-constant-condition': ['error', { checkLoops: false }],
29
+ 'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
30
+ 'no-unused-vars': ['warn', { caughtErrorsIgnorePattern: 'ignore' }],
31
+ },
11
32
  },
12
- root: true,
13
- extends: ['eslint:recommended'],
14
- globals: {
15
- CONT: 'readonly',
16
- STOP: 'readonly',
17
- DENY: 'readonly',
18
- DENYSOFT: 'readonly',
19
- DENYDISCONNECT: 'readonly',
20
- DISCONNECT: 'readonly',
21
- OK: 'readonly',
22
- NEXT_HOOK: 'readonly',
23
- DELAY: 'readonly',
24
- DENYSOFTDISCONNECT: 'readonly',
25
- },
26
- parserOptions: {
27
- ecmaVersion: 'latest',
28
- },
29
- rules: {
30
- // 0 = off // 1 = warn // 2 = error
31
- 'no-empty': ['error', { allowEmptyCatch: true }],
32
- 'no-undef': 'warn',
33
- 'no-console': 'off',
34
- 'no-constant-condition': ['error', { checkLoops: false }],
35
- 'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
36
- 'no-unused-vars': ['warn', { caughtErrorsIgnorePattern: 'ignore' }],
37
- },
38
- }
33
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haraka/eslint-config",
3
- "version": "2.0.4",
3
+ "version": "3.0.0",
4
4
  "description": "eslint config for Haraka projects",
5
5
  "keywords": [
6
6
  "haraka",
@@ -9,6 +9,7 @@
9
9
  "eslintconfig",
10
10
  "test"
11
11
  ],
12
+ "type": "module",
12
13
  "main": "index.js",
13
14
  "files": [
14
15
  "CHANGELOG.md",
@@ -22,8 +23,9 @@
22
23
  "prettier": "npx prettier . --check",
23
24
  "prettier:fix": "npx prettier . --write --log-level=warn",
24
25
  "test": "node index.js",
25
- "versions": "npx dependency-version-checker check",
26
- "versions:fix": "npx dependency-version-checker update"
26
+ "test:coverage": "npx c8 --reporter=text --reporter=text-summary npm test",
27
+ "versions": "npx npm-dep-mgr check",
28
+ "versions:fix": "npx npm-dep-mgr update"
27
29
  },
28
30
  "repository": {
29
31
  "type": "git",
@@ -35,11 +37,12 @@
35
37
  "url": "https://github.com/haraka/haraka-eslint/issues"
36
38
  },
37
39
  "homepage": "https://github.com/haraka/haraka-eslint#readme",
38
- "devDependencies": {},
40
+ "dependencies": {
41
+ "@eslint/js": "^10.0.1",
42
+ "globals": "^17.6.0"
43
+ },
39
44
  "peerDependencies": {
40
- "eslint": "^9.39.4",
41
- "@eslint/js": "^9.39.4",
42
- "@eslint/eslintrc": "^3.3.5"
45
+ "eslint": "^10.0.0"
43
46
  },
44
47
  "prettier": {
45
48
  "singleQuote": true,