Skip to content

[Idea]: Enforce American spelling with a spell checker #35

Open

Description

@troychaplin

In #19, @joedolson caught normalise and asked to follow core's spelling guidelines:

I'm only going to call it out this once for the purpose of the review, but it's going to ultimately be easier if we follow the same consistency rules as core does.

Fair ask, and a signal that catching these by hand doesn't scale. Nothing in CI checks spelling today, so it lands on whoever reviews.

What's still out there

Fixed in #19 (validation framework). Still outstanding, 8 instances across 5 files:

File Word
README.md:3 labelled
includes/Modules/Features/ValidationSettings/Rest_Controller.php:145 recognised
src/settings/style.scss:154 grey
src/media-view-config/style.scss:4,5,159,164 colour ×2, behaviour, unlabelled
src/validation-settings/types.ts:8 labelled

All in comments and docs — no API names, so it's low risk whenever we get to it.

The catch: it needs an allowlist on day one

Two legitimate strings look like British spellings and must not be "corrected":

  • phpstan analyse (composer.json:25) — PHPStan's actual CLI command. Changing it breaks composer phpstan.
  • aria-labelledby (src/media-view-config/index.ts:155,445) — a real ARIA attribute.

Any tool we pick needs both allowlisted before it's turned on, or it'll "fix" the build and an accessibility attribute.

Options

cspell — npm-native, fits alongside our existing wp-scripts lint steps, has a WordPress dictionary and per-word inline ignores. Config is a bit verbose.

typos — much faster, near-zero false positives, single binary with a GitHub Action. Targets typos rather than dialect, so it may not flag colour/behaviour by default and would need a custom word list to do what we want.

cspell is probably the better fit given we want dialect enforcement, not just typo detection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions