Skip to content

How to use cspell

Installation

Install cspell with the following commands.

In a terminal, execute the following command(s).
1
2
3
4
5
6
7
npm install --save-dev \
	cspell \
	@cspell/dict-bash \
	@cspell/dict-fr-fr \
	@cspell/dict-node \
	@cspell/dict-npm \
	@cspell/dict-typescript

Configuration

The configuration for Husky is located in the .cspell.yaml file. The custom dictionaries are in the .cspell directory.

Run cspell

You can run cspell from anywhere in the project with the following command.

In a terminal, execute the following command(s).
pnpm --workspace-root review:spellcheck

Common tasks

Add a word to dictionary

You can add any words to the available dictionaries in the .cspell directory.

Please be aware to add the word in the right dictionary (in alphabetical order) to keep things tidy. If you new word doesn't fit in one of the existing dictionary, add a new dictionary.

Add a new dictionary

Create a new dictionary file in the .cspell directory.

Add the definition of the dictionary in the .cspell.yaml file under the key dictionaryDefinitions.

.cspell.yaml
1
2
3
4
dictionaryDefinitions:
  - name: "example"
    path: "./.cspell/example.txt"
    addWords: true

Add the dictionary in the .cspell.yaml file under the key dictionaries.

.cspell.yaml
dictionaries:
  - "example"

These explanations are related to the current item (in alphabetical order).

None at the moment.

Resources and alternatives

These resources and alternatives are related to the current item (in alphabetical order).

None at the moment.