cspell-populate-words
v0.3.0
Published
Populates your cspell.json dictionary with existing unknown words. π
Downloads
1,291
Readme
Usage
Run cspell-populate-words
as a command in your CLI to add any words currently reported by cspell
as typos to the words
array in your cspell.json
.
npx cspell-populate-words "**/*"
If a cspell.json
doesn't yet exist, one will be created for you.
If the prettier
package is available, such as already being a dependency in your repository, it will be used to format the file.
Options
cspell-populate-words
takes in any non-zero number of file globs to look at.
The file globs are passed directly to the cspell
CLI.
For example, to look at all files, and opt into .github/
:
npx cspell \"**/*\" \".github/**/*\"
--words
Any number of --words
can be provided along with -or instead of- positional file globs.
These words will be passed to cspell
's stdin
option.
For example, providing mistake
, typo
, and zzz
as words:
npx cspell --words mistake --words "typo zzz"
Providing typo
alongside file globs:
npx cspell \"**/*\" --words typo
Node.js API
A populateWords
function is exported that you can use programmatically.
It takes in globs
and/or words
string[]
s similar to the CLI:
npm i cspell-populate-words
import { populateWords } from "cspell-populate-words";
await populateWords({ globs: ["**/*"] });
await populateWords({ words: ["mistake", "typo zzz"] });
await populateWords({ globs: ["**/*"], words: ["mistake", "typo zzz"] });
Contributors
π This package was templated with
create-typescript-app
.