-
-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Problem
We want to use @cspell/eslint-plugin for AST-aware spellchecking (identifiers / strings / template strings / JSX text / comments) in a codebase, but only report likely typos (the equivalent of cspell lint --report typos / config unknownWords: report-common-typos).
Today the ESLint plugin reports lots of “Unknown word” findings (proper nouns, product names, acronyms, etc.) unless a large allowlist is maintained. The CLI’s typos-only modes are a perfect fit, but they don’t seem available in the plugin.
What we tried
Configured the rule with a configFile plus attempted to pass unknownWords through the rule options. ESLint fails config validation because the plugin schema does not allow it.
Example config
'@cspell/spellchecker': ['warn', {
configFile: "./tooling/spellcheck/cspell.json",
checkComments: true,
checkIdentifiers: true,
checkStrings: true,
checkStringTemplates: true,
checkJSXText: true,
ignoreImports: true,
ignoreImportProperties: true,
cspell: {
unknownWords: "report-common-typos",
},
}],ESLint error
Unexpected property "unknownWords". Expected properties: "allowCompoundWords", "caseSensitive", "dictionaries", "dictionaryDefinitions", "enabled", "flagWords", "ignoreRegExpList", "ignoreWords", "import", "includeRegExpList", "language", "words".
Evidence from plugin code
In the published package (we had @cspell/[email protected]), the autogenerated options schema sets additionalProperties: false and the cspell sub-options do not include any report/unknownWords control.
packages/cspell-eslint-pluginbuilt schema (published):dist/generated/schema.cjsadditionalProperties: falseat the topcspelloption object includeswords,flagWords,ignoreWords, etc. but nounknownWords/report
Also, the rule appears to report all issues returned by spellCheckAST without filtering beyond Forbidden vs Unknown.
Requested feature
Expose a way to enable CLI-equivalent typos-only reporting in the ESLint plugin. For example:
- new rule option:
report: "all" | "simple" | "typos" | "flagged"(matching CLI--report) - or allow passing through
unknownWordssettings (likereport-common-typos) into the underlying checker
This would make the plugin usable in real-world codebases without maintaining huge allowlists, while still catching genuine typos like fragement→fragment, preceeding→preceding, etc.
Environment
- ESLint:
9.39.2 @cspell/eslint-plugin:9.4.0- Node:
22.x