diff --git a/.gitattributes b/.gitattributes index e36130d7e..39492eeac 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,6 +21,7 @@ /.husky export-ignore /.lintstagedrc.json export-ignore /.stylelintrc export-ignore +/.typos.toml export-ignore /.wp-env.json export-ignore /CHANGELOG.md export-ignore /CODE_OF_CONDUCT.md export-ignore diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 000000000..391ed7d4a --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,20 @@ +name: Typos + +on: + pull_request: + branches: + - develop + +permissions: + contents: read + +jobs: + typos: + name: Spell check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run typos + uses: crate-ci/typos@master diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 000000000..d9425aac9 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,43 @@ +[files] +extend-exclude = [ + ".git/", + "node_modules/", + "vendor/", + "dist/", + "build/", + "tests/", + "lang/", +] +ignore-hidden = false + +[default] +extend-ignore-re = [ + "@[A-Za-z0-9_-]+", + "Fabian Marz", + "Tung Du", + "github:[^\"\\s]+", + "'[a-z][a-zA-Z0-9_]*'", + "\"[a-z][a-zA-Z0-9_]*\"", +] +# Only flag typos in standalone words. Compound identifiers (snake_case, +# kebab-case, camelCase, PascalCase mixed) often contain WordPress or +# Elasticsearch terminology baked into public APIs that can't be renamed. +extend-ignore-identifiers-re = [ + ".*[_-].*", + ".*[a-z][A-Z].*", +] + +[default.extend-words] +# Typos previously found in this codebase +"utilitary" = "utility" +"heirarchal" = "hierarchical" +"mimcs" = "mimics" +"santitize" = "sanitize" +"warnngs" = "warnings" +"versino" = "version" +"degister" = "deregister" +"quries" = "queries" + +[default.extend-identifiers] +"Automattic" = "Automattic" +"stati" = "stati"