Skip to content

Commit

Permalink
feat: add cspell common dictionary and example snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljaltamirano committed Feb 13, 2024
1 parent 6e945a7 commit 18422ec
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ repos:
entry: ./hooks/yaml/yaml-extension.sh
language: script
files: \.yml$
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.3.0
hooks:
- id: cspell
29 changes: 29 additions & 0 deletions cspell.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"allowCompoundWords": false,
"caseSensitive": true,
"dictionaries": [
"bash",
"turo-dictionary",
"css",
"en-gb",
"fonts",
"html",
"powershell",
"node",
"npm",
"typescript"
],
"dictionaryDefinitions": [
{
"addWords": true,
"name": "turo-dictionary",
"path": "./hooks/cspell/turo-dictionary.txt"
}
],
"ignoreRegExpList": ["^.*TODO.*"],
"ignorePaths": [
"./hooks/cspell/turo-dictionary.txt",
],
}
22 changes: 22 additions & 0 deletions hooks/cspell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Cspell Dictionary

This `hooks/cspell` directory is not an actual `pre-commit` hook to be referenced by `id`, but a common dictionary that can be extended in repos that use `pre-commit` to avoid duplicating frequent (and Turo-specific) terminology.

```json
// cspell.jsonc
{
"dictionaries": [
"turo-dictionary"
],
"dictionaryDefinitions": [
{
"name": "turo-dictionary",
// TODO (@michaeljaltamirano): Update path
"path": "https://raw.githubusercontent.com/turo/pre-commit-hooks/spike/testing-cspell-integration-michael/hooks/cspell/turo-dictionary.txt",
"addWords": true
}
],
}
```

It's a requirement for the dictionary to be referenced at the project-level `cspell.json` file, so we cannot bake a Turo-specific configuration within this repo as a `pre-commit` hook. The next best option is making the dictionary available via HTTP GET to be pulled into repo-specific configurations. This repo has a file in `~/cspell.jsonc` that can be used as a reference.
48 changes: 48 additions & 0 deletions hooks/cspell/turo-dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This is a comment
# "Forbidden" syntax: !forbiddenword
autofix
benn
bugsnag
Bugsnag
carculator
checkin
cohorting
cohosts
commitlint
dtos
expedia
ezpass
figma
flagr
gdpr
grecaptcha
Iata
iata
itunes
jfrog
kustomer
latlng
lngs
lurleen
miata
michaeljaltamirano
mitek
mvsc
mweb
nissay
pois
prereqs
pricings
qrcode
schu
schumi
signup
storyblok
teamcity
toolo
# Note: "traveller" is a misspelling of "traveler"
traveller
turo
twilio
uber
vals

0 comments on commit 18422ec

Please sign in to comment.