In your Haraka module:
- Add to NPM dependencies:
npm install --save-dev @haraka/eslint-config eslint
- Configure ESLint with a flat config (
eslint.config.mjs):
import haraka from '@haraka/eslint-config'
export default [
...haraka,
{
// project-specific overrides
rules: {
'no-unused-vars': ['warn', { caughtErrorsIgnorePattern: '^ignore' }],
},
},
]- Add to the "scripts" section of
package.json:
"lint": "npx eslint *.js test",
"lint:fix": "npx eslint --fix *.js test"- Within your CI workflow:
npm run lint
The 3.x release migrates @haraka/eslint-config from the legacy .eslintrc
shape to a flat-config array. Consumers no longer need @eslint/eslintrc /
FlatCompat. Replace the old wrapper:
// before
import { FlatCompat } from '@eslint/eslintrc'
const compat = new FlatCompat({ baseDirectory: __dirname, ... })
export default [...compat.extends('@haraka'), { /* overrides */ }]with:
// after
import haraka from '@haraka/eslint-config'
export default [
...haraka,
{
/* overrides */
},
]Peer dependency is now eslint@^10.
To check your project against lint rules:
npm run lint
If you agree with the lint suggestions, run npm run lint:fix and the
changes will be made to your files automatically.
Custom rules can be added directly in the consumer's eslint.config.mjs.