Skip to content

haraka/haraka-eslint

Repository files navigation

haraka-eslint

Build Cover Qlty

Install

In your Haraka module:

  1. Add to NPM dependencies:

npm install --save-dev @haraka/eslint-config eslint

  1. 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' }],
    },
  },
]
  1. Add to the "scripts" section of package.json:
"lint": "npx eslint *.js test",
"lint:fix": "npx eslint --fix *.js test"
  1. Within your CI workflow:

npm run lint

Upgrading from 2.x

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.

Usage

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.

About

eslint rules for Haraka projects

Topics

Resources

License

Code of conduct

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Contributors