diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c864b97..d772e6f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0e7eb30..2b33bb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/cspell.jsonc b/cspell.jsonc new file mode 100644 index 0000000..34f5ef0 --- /dev/null +++ b/cspell.jsonc @@ -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" + ] +} diff --git a/hooks/cspell/README.md b/hooks/cspell/README.md new file mode 100644 index 0000000..00e3039 --- /dev/null +++ b/hooks/cspell/README.md @@ -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. diff --git a/hooks/cspell/turo-dictionary.txt b/hooks/cspell/turo-dictionary.txt new file mode 100644 index 0000000..9210541 --- /dev/null +++ b/hooks/cspell/turo-dictionary.txt @@ -0,0 +1,133 @@ +# This is a comment +# "Forbidden" syntax: !forbiddenword +allstar +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