Haraka ESLint Plugin
raw JSON → 1.0.16 verified Sat Apr 25 auth: no javascript
ESLint plugin providing Haraka-specific rules and recommended configuration for Haraka projects. Current stable version is 2.0.4 (as of 2025), with a major breaking change in v2.0.0 that depends on ESLint 9. The plugin enforces best practices for Haraka plugin development, including environment globals, ECMAScript version (es2024), and custom rules like no-unused-vars. It is actively maintained with frequent releases, typically following Haraka core updates. Key differentiators: tailored for Haraka's plugin architecture, includes a 'recommended' config, and integrates with flat config in ESLint 9.
Common errors
error Error: Cannot find module 'eslint-plugin-haraka' ↓
cause Plugin not installed or not listed in package.json.
fix
Run 'npm install --save-dev eslint-plugin-haraka' and ensure it's in devDependencies.
error Configuration for rule 'haraka/no-unused-vars' is invalid ↓
cause Rule no longer exists or has been renamed in a newer version.
fix
Check the plugin version; no-unused-vars was added in v1.1.4 but may be removed in later versions. Use eslint's built-in no-unused-vars instead.
error ESLint couldn't find the config 'plugin:haraka/recommended'. ↓
cause The config name is incorrect or the plugin is not properly loaded.
fix
Ensure your .eslintrc uses 'extends: ["plugin:haraka/recommended"]' and the plugin is installed.
Warnings
breaking v2.0.0 drops support for ESLint 8 and below. Requires ESLint 9 or higher. ↓
fix Upgrade ESLint to v9+ and migrate to flat config if needed. See ESLint migration guide.
breaking v2.0.0 removed deprecated formatting rules that were previously included. ↓
fix Remove any references to removed rules from your config. Use separate formatting tools like Prettier.
breaking v1.1.1 removed the 'haraka:recommended' config and rules included in eslint:recommended. ↓
fix Use 'plugin:haraka/recommended' instead of 'haraka:recommended' and ensure eslint:recommended is also extended.
deprecated The no-unused-vars rule now includes 'caughtErrorsIgnorePattern' in v2.0.3. ↓
fix If you customize no-unused-vars, you may need to update your config to respect caught exceptions.
gotcha Globals are now specified as 'readonly' by default since v2.0.2; previously they were set to true. ↓
fix If you modify globals in your config, ensure they are consistent with 'readonly' or 'writable'.
Install
npm install eslint-plugin-haraka yarn add eslint-plugin-haraka pnpm add eslint-plugin-haraka Imports
- plugin:haraka/recommended wrong
extends: ['haraka/recommended']correctextends: ['plugin:haraka/recommended'] - default (plugin) wrong
const haraka = require('eslint-plugin-haraka')correctimport haraka from 'eslint-plugin-haraka' - configs.recommended wrong
import haraka from 'eslint-plugin-haraka'; export default [...haraka.recommended]correctimport { configs } from 'eslint-plugin-haraka'; export default [...configs.recommended]
Quickstart
// .eslintrc.yaml
plugins:
- haraka
extends:
- eslint:recommended
- plugin:haraka/recommended
// package.json
{
"scripts": {
"lint": "npx eslint *.js test",
"lintfix": "npx eslint --fix *.js test"
}
}
// Install
npm install --save-dev eslint eslint-plugin-haraka
// Run lint
npm run lint