@haraka/eslint-config 2.0.4 → 3.0.1

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 +17 -0
  2. package/README.md +46 -19
  3. package/index.js +31 -36
  4. package/package.json +12 -7
package/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
5
  ### Unreleased
6
6
 
7
+ ### [3.0.1] - 2026-11-21
8
+
9
+ - packaging / meta updates (#42)
10
+ - deps: bump globals version
11
+
12
+ ### [3.0.0] - 2026-05-24
13
+
14
+ - BREAKING: depend on eslint 10
15
+ - BREAKING: export a flat-config array from `index.js` (was a legacy `.eslintrc` object)
16
+ - package: `type: module`; ship as ESM
17
+ - deps: drop `@eslint/eslintrc` peer (consumers no longer need FlatCompat)
18
+ - deps: declare runtime deps on `@eslint/js` and `globals` (were peers)
19
+ - doc(README): document flat-config consumer pattern and 2.x→3.0 migration
20
+
7
21
  ### [2.0.4] - 2026-03-17
8
22
 
9
23
  - deps(all): added ^versions in package.json
@@ -143,3 +157,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
143
157
  [2.0.1]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.1
144
158
  [2.0.2]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.2
145
159
  [2.0.3]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.3
160
+ [2.0.4]: https://github.com/haraka/haraka-eslint/releases/tag/v2.0.4
161
+ [3.0.0]: https://github.com/haraka/haraka-eslint/releases/tag/v3.0.0
162
+ [3.0.1]: https://github.com/haraka/haraka-eslint/releases/tag/v3.0.1
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # haraka-eslint
2
2
 
3
- [![Build Status][ci-img]][ci-url]
4
- [![Code Climate][clim-img]][clim-url]
3
+ [![Build][ci-img]][ci-url] [![Cover][cov-img]][cov-url] [![Qlty][qlty-img]][qlty-url]
5
4
 
6
5
  ## Install
7
6
 
@@ -9,24 +8,28 @@ In your Haraka module:
9
8
 
10
9
  1. Add to NPM dependencies:
11
10
 
12
- `npm install --save-dev @haraka/eslint-config`
11
+ `npm install --save-dev @haraka/eslint-config eslint`
13
12
 
14
- 2. Configure eslint:
13
+ 2. Configure ESLint with a flat config (`eslint.config.mjs`):
15
14
 
16
- ```sh
17
- cat <<EOLINT > eslint.config.mjs
18
- env:
19
- node: true
20
- es6: true
21
- es2024: true
22
- extends: "@haraka"
23
- EOLINT
15
+ ```js
16
+ import haraka from '@haraka/eslint-config'
17
+
18
+ export default [
19
+ ...haraka,
20
+ {
21
+ // project-specific overrides
22
+ rules: {
23
+ 'no-unused-vars': ['warn', { caughtErrorsIgnorePattern: '^ignore' }],
24
+ },
25
+ },
26
+ ]
24
27
  ```
25
28
 
26
29
  3. Add to the "scripts" section of `package.json`:
27
30
 
28
31
  ```json
29
- "lint": "npx eslint *.js test"
32
+ "lint": "npx eslint *.js test",
30
33
  "lint:fix": "npx eslint --fix *.js test"
31
34
  ```
32
35
 
@@ -34,21 +37,45 @@ EOLINT
34
37
 
35
38
  `npm run lint`
36
39
 
40
+ ## Upgrading from 2.x
41
+
42
+ The 3.x release migrates `@haraka/eslint-config` from the legacy `.eslintrc`
43
+ shape to a flat-config array. Consumers no longer need `@eslint/eslintrc` /
44
+ `FlatCompat`. Replace the old wrapper:
45
+
46
+ ```js
47
+ // before
48
+ import { FlatCompat } from '@eslint/eslintrc'
49
+ const compat = new FlatCompat({ baseDirectory: __dirname, ... })
50
+ export default [...compat.extends('@haraka'), { /* overrides */ }]
51
+ ```
52
+
53
+ with:
54
+
55
+ ```js
56
+ // after
57
+ import haraka from '@haraka/eslint-config'
58
+ export default [...haraka, {/* overrides */}]
59
+ ```
60
+
61
+ Peer dependency is now `eslint@^10`.
62
+
37
63
  ## Usage
38
64
 
39
65
  To check your project against lint rules:
40
66
 
41
67
  `npm run lint`
42
68
 
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.
69
+ If you agree with the lint suggestions, run `npm run lint:fix` and the
70
+ changes will be made to your files automatically.
46
71
 
47
- Custom rules can be added to the eslint config file.
72
+ Custom rules can be added directly in the consumer's `eslint.config.mjs`.
48
73
 
49
74
  <!-- leave these buried at the bottom of the document -->
50
75
 
51
76
  [ci-img]: https://github.com/haraka/haraka-eslint/actions/workflows/ci.yml/badge.svg
52
77
  [ci-url]: https://github.com/haraka/haraka-eslint/actions/workflows/ci.yml
53
- [clim-img]: https://codeclimate.com/github/haraka/haraka-eslint/badges/gpa.svg
54
- [clim-url]: https://codeclimate.com/github/haraka/haraka-eslint
78
+ [cov-img]: https://codecov.io/github/haraka/haraka-eslint/coverage.svg
79
+ [cov-url]: https://codecov.io/github/haraka/haraka-eslint
80
+ [qlty-img]: https://qlty.sh/gh/haraka/projects/haraka-eslint/maintainability.svg
81
+ [qlty-url]: https://qlty.sh/gh/haraka/projects/haraka-eslint
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.1",
4
4
  "description": "eslint config for Haraka projects",
5
5
  "keywords": [
6
6
  "haraka",
@@ -9,21 +9,25 @@
9
9
  "eslintconfig",
10
10
  "test"
11
11
  ],
12
+ "type": "module",
12
13
  "main": "index.js",
13
14
  "files": [
14
15
  "CHANGELOG.md",
15
16
  "rules"
16
17
  ],
17
18
  "scripts": {
19
+ "prepare": "git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks || true",
18
20
  "format": "npm run prettier:fix && npm run lint:fix",
19
21
  "format:check": "npm run prettier && npm run lint",
20
22
  "lint": "npx eslint *.js",
21
23
  "lint:fix": "npx eslint *.js --fix",
22
24
  "prettier": "npx prettier . --check",
23
25
  "prettier:fix": "npx prettier . --write --log-level=warn",
26
+ "qlty": "qlty smells --all",
24
27
  "test": "node index.js",
25
- "versions": "npx dependency-version-checker check",
26
- "versions:fix": "npx dependency-version-checker update"
28
+ "test:coverage": "npx c8 --reporter=text --reporter=text-summary npm test",
29
+ "versions": "npx npm-dep-mgr check",
30
+ "versions:fix": "npx npm-dep-mgr update"
27
31
  },
28
32
  "repository": {
29
33
  "type": "git",
@@ -35,11 +39,12 @@
35
39
  "url": "https://github.com/haraka/haraka-eslint/issues"
36
40
  },
37
41
  "homepage": "https://github.com/haraka/haraka-eslint#readme",
38
- "devDependencies": {},
42
+ "dependencies": {
43
+ "@eslint/js": "^10.0.1",
44
+ "globals": "^17.14.0"
45
+ },
39
46
  "peerDependencies": {
40
- "eslint": "^9.39.4",
41
- "@eslint/js": "^9.39.4",
42
- "@eslint/eslintrc": "^3.3.5"
47
+ "eslint": "^10.0.0"
43
48
  },
44
49
  "prettier": {
45
50
  "singleQuote": true,