eslint-plugin-spellcheck
raw JSON → 0.0.20 verified Sat Apr 25 auth: no javascript maintenance
ESLint plugin (v0.0.20, last updated 2022, low release cadence) that checks spelling in identifiers, strings, comments, and templates of JavaScript files using Hunspell dictionaries. Supports multiple English locales (en_US, en_CA, en_AU, en_GB), custom skip words, regex pattern exclusions, and minimum word length. The plugin is lightweight but infrequently maintained; it has no security incidents but the underlying hunspell-spellchecker dependency (v0.4.1) is dated. Alternative with more active development: eslint-plugin-spellcheck (different package) or cspell.
Common errors
error Error: Failed to load plugin 'spellcheck': Cannot find module 'eslint-plugin-spellcheck' ↓
cause Plugin not installed or missing from node_modules.
fix
Run 'npm install --save-dev eslint-plugin-spellcheck'
error ESLint: Configuration for rule "spellcheck/spell-checker" is invalid: Value "[object Object]" is not a valid severity. ↓
cause Rule options passed as object directly, not as array element.
fix
Use array syntax: ["warn", { ... }]
error Error: Cannot find module 'hunspell-spellchecker' ↓
cause hunspell-spellchecker not installed (plugin should install it automatically).
fix
Run 'npm install' or manually add 'hunspell-spellchecker' to devDependencies.
Warnings
gotcha The plugin uses the 'hunspell-spellchecker' package which is outdated (v0.4.1) and may produce false positives for modern JavaScript identifiers (e.g., camelCase words, JSX). ↓
fix Add frequently used words to 'skipWords' or use 'skipIfMatch' for patterns.
breaking The plugin requires ESLint >=0.8.0, but does not support ESLint 9.x or flat config natively (requires manual plugin import for flat config). ↓
fix For ESLint >=9 use flat config: import spellcheck from 'eslint-plugin-spellcheck' and add to plugins object.
gotcha Setting 'comments: false' or 'strings: false' may be ignored if the parsed node type includes both (e.g., JSDoc comments with string-like content). ↓
fix Use 'skipIfMatch' to exclude specific patterns, or test each node individually.
deprecated The 'enableUpperCaseUnderscoreCheck' option (default false) is poorly documented; setting it false may still check some uppercase underscores. ↓
fix Set to true to enable checking, or rely on default behavior with 'skipWords' for known patterns.
gotcha The 'langDir' option expects a path to a directory containing .aff and .dic files for Hunspell; using an invalid path silently falls back to default language files. ↓
fix Ensure the directory contains both 'en_US.aff' and 'en_US.dic' (for en_US) or corresponding files for other locales.
Install
npm install eslint-plugin-spellcheck yarn add eslint-plugin-spellcheck pnpm add eslint-plugin-spellcheck Imports
- default config wrong
Using 'spellcheck' as rule name without prefixcorrect// In .eslintrc: "plugins": ["spellcheck"], "rules": { "spellcheck/spell-checker": "warn" } - Rule with options wrong
"spellcheck/spell-checker": "error" // missing options objectcorrect"spellcheck/spell-checker": ["error", { "comments": true, "strings": true, "identifiers": true }] - ESLint flat config (eslint.config.js) wrong
Using 'spellcheck' directly as plugin name in flat configcorrectimport spellcheck from 'eslint-plugin-spellcheck'; export default [ { plugins: { spellcheck }, rules: { 'spellcheck/spell-checker': 'warn' } } ];
Quickstart
// Install: npm install --save-dev eslint eslint-plugin-spellcheck
// .eslintrc.json:
{
"plugins": ["spellcheck"],
"rules": {
"spellcheck/spell-checker": ["warn", {
"comments": true,
"strings": true,
"identifiers": true,
"templates": true,
"lang": "en_US",
"skipWords": ["eslint", "plugin", "spellcheck"],
"skipIfMatch": ["http://[^s]*"],
"skipWordIfMatch": ["^foobar.*$"],
"minLength": 3
}]
}
}