@codelaw/rules-spell
v0.4.3
Published
codelaw's spell checker: known typos fixed unattended, in every L3 language; word data generated from SCOWL (SR-SPELL)
Maintainers
Readme
@codelaw/rules-spell
codelaw's spell checker — one of the first-party rule packs
(SR-RULE-PACKS), on npm and PyPI
(codelaw-rules-spell). It reads the prose of every L3 language from the tree
the engine parsed: comments and docstrings, prose strings, Markdown and HTML
text, the string values of JSON, YAML and TOML, and the names a file
declares — identifiers, keys, classes and ids. It is codelaw's own
code and codelaw's own word data, generated from SCOWL
(SR-SPELL); it does not wrap CSpell.
codelaw init never adds it: a team installs it on purpose.
# codelaw.toml
extends = ["codelaw:spell/recommended"]
preview = true # every rule is `preview` until a corpus run promotes itnpm i -D @codelaw/rules-spell # or
pip install codelaw-rules-spellPresets
| preset | rules | ported from |
|---|---|---|
| spell/recommended | 3 | codelaw's own: known typos from a list generated from SCOWL, fixed unattended |
| spell/strict | 6 | spell/recommended plus the dictionary check, one spelling per word across the project and the [spell] words check |
Rules
| rule | fix | flags |
|---|---|---|
| spell/known-typo | auto | a word on the known-typo list in a comment, a doc, a prose string or Markdown |
| spell/known-typo-identifier | auto | a known typo in a JS, TS or Python name where it is declared; renamed only when the name is provably file-local |
| spell/known-typo-key | manual | a known typo in a JSON, YAML or TOML key, a CSS or SCSS class, id or custom property, or an HTML id |
| spell/unknown-word | suggest | a word of prose in no word list; the nearest dictionary word as the edit, up to three named (spell/strict) |
| spell/locale-variant | auto | the other locale's spelling (colour under en-US), while [spell] locale is set (in no preset) |
| spell/inconsistent-term | suggest | one word spelled two ways across the project (canceled / cancelled); the spelling the project uses most as the edit (spell/strict, a project rule) |
| spell/suspicious-word | manual | a [spell] words entry that is a known typo or one edit from a common word (spell/strict) |
Config
# codelaw.toml (the root config only)
[spell]
locale = "en-US" # or "en-GB"; spell/locale-variant reports the other one
words = ["kubectl", "Acme"] # accepted by every spell/* rule; spell/suspicious-word checks them
[rules]
"spell/locale-variant" = "warn"The word data
data/spell/ is written by scripts/spell-data.py and committed; the same
sources write the same bytes: typos.json (188,138 generated known typos),
words.json (92,758 words: SCOWL's US and British English to size 60, and the
software terms) and locale.json (VarCon's one-to-one US and British pairs). Sources and their notices: NOTICE.
