Skip to content

Commit 212c853

Browse files
authored
Add spellchecking to pre-commit hooks and linting workflow (#92)
* Install and configure cspell * Fix typos * Add spellcheck to lint-staged and github workflow * Add quotes around spellcheck glob pattern This is because npm lifetime scripts (such as npm run) execute in bash 3.2 on OSX by default, and you need bash 4 for globstar (**). Quotes prevent the shell from interpeting it and ensure it is passed to the program itself
1 parent d8abb79 commit 212c853

File tree

6 files changed

+1744
-46
lines changed

6 files changed

+1744
-46
lines changed

.github/workflows/lint.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
cache-dependency-path: "**/package-lock.json"
2828
node-version: "18"
2929

30-
- name: Run linter
30+
- name: Run linter and spellcheck
3131
run: |
3232
npm ci
3333
npm run lint
34+
npm run spellcheck

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ Please follow the following (very brief) style guide:
4747
- Use code blocks for all commands. Don't write them in-line.
4848
- Avoid long paragraphs - this documentation should be to-the-point and instructional.
4949

50+
### Spellchecker
51+
52+
We use `cspell` for spellchecking. It will run as a pre-commit hook and in the CI pipeline.
53+
Spellchecking ignores single and multi-line code snippets. If required, you can add custom words
54+
(e.g. proper nouns and technical terms) to `custom-words.txt`.
55+
5056
### Conditional Content
5157

5258
The Contributing Docs site is used both for internal and external contributors. To this end we've

cspell.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
dictionaries:
3+
- custom-words
4+
dictionaryDefinitions:
5+
- name: custom-words
6+
path: ./custom-words.txt
7+
addWords: true
8+
patterns:
9+
# Ignore multi-line code blocks
10+
# Ref: https://cspell.org/configuration/patterns/
11+
# Modified to avoid matching line breaks before/after which had unexpected results
12+
- name: markdown_code_block
13+
pattern: |
14+
/
15+
^[ \t]* # match optional whitespace before the ```
16+
(`{3}).* # match the ``` and any optional language specification afterwards
17+
[\s\S]*? # the block of code
18+
^[ \t]* # match optional whitespace before the ```
19+
\1 # end of the block
20+
/gmx
21+
22+
# Ignore inline code blocks
23+
- name: markdown_code_inline
24+
pattern: |
25+
/
26+
` # match the opening `
27+
.*? # match any characters, lazily (so that we stop at the next tilde)
28+
` # match the closing `
29+
/gx
30+
languageSettings:
31+
- languageId:
32+
- markdown
33+
- mdx
34+
ignoreRegExpList:
35+
- markdown_code_block
36+
- markdown_code_inline

custom-words.txt

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Custom dictionary for spellchecking
2+
# Before adding a word here, consider whether you can put it in a single (`) or multiline (```) code snippet instead,
3+
# as they are automatically ignored by the spellchecker
4+
5+
Bitwarden
6+
bytemark
7+
CQRS
8+
dockerized
9+
hotfix
10+
hotfixes
11+
hotfixed
12+
inet
13+
Iterm
14+
jslib
15+
jumpcloud
16+
keychain
17+
keyserver
18+
LDIF
19+
LLDB
20+
Mailcatcher
21+
minio
22+
MVVM
23+
NGRX
24+
Omnisharp
25+
opid
26+
passcode
27+
passwordless
28+
PNSs
29+
proxied
30+
roadmap
31+
roadmaps
32+
SCIM
33+
SDET
34+
signtool
35+
signup
36+
sqlcmd
37+
TOTP
38+
Yellowpages
39+
CODEOWNERS
40+
SDLC
41+
subprocessor
42+
Gitter
43+
IntelliJ
44+
WCAG
45+
pinentry
46+
refactorings
47+
toolset
48+
keypair
49+
onboarded
50+
OIDCS
51+
oktapreview
52+
Xcodes.app
53+
YubiKey
54+
Yubico

0 commit comments

Comments
 (0)