Configuration is read from the following (in precedence order)
- Command line arguments
- File specified via
--config PATH - Search parents of specified file / directory for one of
typos.toml,_typos.toml,.typos.toml,Cargo.toml, orpyproject.toml.- In
pyproject.toml, the below fields must be under the[tool.typos]section. If this section does not exist, the config file will be skipped. - In
Cargo.toml, the below fields must be under either[workspace.metadata.typos]or[package.metadata.typos]
- In
Summary of configuration (see below for details)
[files]
extend-exclude = []
ignore-hidden = true
ignore-files = true
ignore-dot = true
ignore-vcs = true
ignore-global = true
ignore-parent = true
[default]
binary = false
check-filename = true
check-file = true
unicode = true
locale = "en"
extend-ignore-re = []
extend-ignore-identifiers-re = []
extend-ignore-words-re = []
[default.extend-words]
# <typo> = "<correction>"
[default.extend-identifiers]
# <typo> = "<correction>"
[type.NAME]
extend-glob = []
# ... see `default`Notes:
- For the distinction between "words" and "identifiers", see design
- Type: list of strings
- CLI:
--exclude
Typos-specific ignore globs (gitignore syntax)
Note: the command-line overrides this by default.
See --force-exclude to ensure this field is always respected.
Example of an include list:
[files]
extend-exclude = [
"*",
"!something",
]files.ignore-hidden
- Type: bool
- Default: true
- CLI: --hidden
Skip hidden files and directories.
- Type: bool
- Default: true
- CLI: --ignore
Respect ignore files.
- Type: bool
- Default: true
- CLI:
--ignore-dot
Respect .ignore files.
- Type: bool
- Default: true
- CLI:
--ignore-vcs
Respect ignore files in vcs directories.
- Type: bool
- Default: true
- CLI:
--ignore-global
Respect global ignore files.
- Type: bool
- Default: true
- CLI:
--ignore-parent
Respect ignore files in parent directories.
- Type: bool
- Default: false
- CLI:
--binary
Check binary files as text.
- Type: bool
- Default: true
Verify spelling in file names.
Directory names are not checked.
- Type: bool
- Default: true
Verify spelling in files.
- Type: bool
- Default: true
- CLI:
--unicode
Allow unicode characters in identifiers (and not just ASCII).
- Type: String (
en,en-us,en-gb,en-ca,en-au) - Default:
en - CLI:
--locale
English dialect to correct to.
If set to en,
words will be corrected to the closest spelling,
regardless of which dialect that correction is part of.
- Type: list of regexes
Custom uncorrectable sections (e.g. markdown code fences, PGP signatures, etc)
- Type: table of strings
Map identifier typos to their corrections. When the correction is blank, the identifier is never valid. When the correction is the key, the identifier is always valid.
Example:
[default.extend-identifiers]
## Names
Hte = "Hte"
## External
ERROR_FILENAME_EXCED_RANGE = "ERROR_FILENAME_EXCED_RANGE"
ERROR_FILENAME_EXCEDE_RANGE = "ERROR_FILENAME_EXCED_RANGE"- Type: list of regexes
Pattern-match always-valid identifiers.
Example:
[default]
extend-ignore-identifiers-re = [
# identifiers with length <= 4 chars is likely noise
"^[a-zA-Z]{1,4}$",
]- Type: table of strings
Map word typos to their corrections. When the correction is blank, the word is never valid. When the correction is the key, the word is always valid.
Example:
[default.extend-words]
## Project-specific acronym
taits = "taits"
tais = "taits"- Type: list of regexes
Pattern-match always-valid words. Note: you must handle case insensitivity yourself.
Example:
[default]
extend-ignore-words-re = [
# words with length <= 4 chars is likely noise
"^[a-zA-Z]{1,4}$",
]- Type: list of strings
File globs for matching NAME. This is required when defining new file types.
When there are multiple globs that would match, the most specific glob is used.
Run with --type-list to see available NAMEs.
[default]
extend-ignore-re = [
# Ignore lines that end with `# spellchecker:disable-line`
"(?Rm)^.*(#|//)\\s*spellchecker:disable-line$",
# Ignore the line after `# spellchecker:ignore-next-line`:
"(#|//)\\s*spellchecker:ignore-next-line\\n.*",
# Ignore blocks between `# spellchecker:off` and `# spellchecker:on`
"(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on",
]
extend-ignore-identifiers-re = [
# Ignore identifiers that look like SSL cipher suites:
"\\bTLS_[A-Z0-9_]+(_anon_[A-Z0-9_]+)?\\b",
]You may also find the regexes in ripsecrets useful as examples for patterns to ignore.