Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cspell common dictionary and example snippet #44

Closed
wants to merge 9 commits into from
20 changes: 6 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,18 @@ on:
push:

jobs:

release-notes:
name: Release notes preview
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- uses: open-turo/actions-release/release-notes-preview@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
NPM_TOKEN: ${{ secrets.OPEN_TURO_NPM_TOKEN }}

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: open-turo/action-pre-commit@v1
- name: Pre-commit
uses: open-turo/action-pre-commit@v1
- name: Check release notes on pull_request
if: github.event_name == 'pull_request'
uses: open-turo/actions-release/lint-release-notes@v4

test:
name: Test
Expand Down
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
39 changes: 39 additions & 0 deletions cspell.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"allowCompoundWords": false,
"caseSensitive": true,
"dictionaries": [
"bash",
"css",
"en-gb",
"fonts",
"go",
"html",
"node",
"npm",
"powershell",
"python",
"turo-dictionary",
"typescript"
],
"dictionaryDefinitions": [
{
"addWords": true,
"name": "turo-dictionary",
"path": "./hooks/cspell/turo-dictionary.txt"
}
],
"ignoreRegExpList": ["^.*TODO.*"],
"ignorePaths": [
"./.gitignore",
"./.pre-commit-hooks.yaml",
"./containers/**",
"./docs/**",
"./hooks/**",
"./licenses/**",
"./README.md",
"./script/**",
"./versions.env"
]
}
40 changes: 40 additions & 0 deletions hooks/cspell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"allowCompoundWords": false,
"caseSensitive": true,
// https://cspell.org/docs/dictionaries/
"dictionaries": [
"bash",
"css",
"en-gb",
"fonts",
"go",
"html",
"node",
"npm",
"powershell",
"python",
"turo-dictionary",
"typescript"
],
"dictionaryDefinitions": [
{
"addWords": true,
"name": "turo-dictionary",
// TODO (@michaeljaltamirano): Update path
"path": "https://raw.githubusercontent.com/turo/pre-commit-hooks/spike/cspell-michael/hooks/cspell/turo-dictionary.txt",
}
],
"ignoreRegExpList": ["^.*TODO.*"],
"ignorePaths": ["./.gitignore"]
}
```

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.
133 changes: 133 additions & 0 deletions hooks/cspell/turo-dictionary.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# This is a comment
# "Forbidden" syntax: !forbiddenword
allstar
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the dictionary where we can add terms we run into in stand-alone repos to be used across all repos. Anything Turo-specific or Engineering-specific or general terminology can go here.

Any terms that are more likely to be repo-specific can go in an array maintained in the repo itself: https://github.com/turo/web-schumacher-app/pull/9234/files#diff-303b67a39635355281d1863a42d6648fbaab26cc0ea8c4c5f3bff37eea65cabb

appsflyer
autofilled
autofix
backroads
benn
blocklisted
bottomsheet
bugsnag
Bugsnag
camelcase
carculator
carfax
cargovan
carplay
centerpoint
checkin
checkins
classname
codegen
cohorting
cohosting
cohosts
commitlint
concat
concats
cooldown
datalayer
datepicker
datestring
datetimes
deeplink
deeplinking
devicer
dropoff
dtos
EIGHTYFIVEPLAN
EIGHTYPLAN
expedia
ezpass
figma
flagr
gdpr
giftcard
giftcards
grecaptcha
iata
Iata
intercardinal
itunes
jfrog
kustomer
latlng
librca
lngs
lurleen
mastercard
meineke
miata
millis
MISNAP
mitek
multisave
mvsc
mweb
NINETYPLAN
nissay
northpass
onelink
ouicar
owntheadventure
pageload
pasteable
paypal
pois
postmessage
preapproval
prechecked
prechecked
premade
prereq
prereqs
preseeding
pricepin
pricepins
pricings
prohost
promocode
publically
qrcode
recaptcha
refetches
relayrides
schemaorg
schu
schumi
screenshotted
SEVENTYFIVEPLAN
SEVENTYPLAN
signup
SIXTYFIVEPLAN
SIXTYPLAN
smartcar
snakecase
socure
storyblok
sublocality
subreason
subreasons
subroute
subroutes
subview
swipeable
teamcity
testcafe
timeframe
toggleable
totalloss
traveller
turo
twilio
twofactor
uber
unavailabilities
underinsured
unionpay
upsell
vals
webcal
yalc
youtube
Loading