Skip to content

fix(lint): validate cspell-words.txt alphabetical sorting and duplicates - #486

Merged
dpologdvinity merged 2 commits into
mainfrom
fix/cspell-words-lint
Nov 24, 2026
Merged

dpologdvinity merged 2 commits into
mainfrom
fix/cspell-words-lint

Conversation

@dpologdvinity

@dpologdvinity dpologdvinity commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

What & Why

Validates cspell-words.txt alphabetical ordering and prevents duplicate word additions.

  • Adds scripts/check-cspell-words.ts and unit tests in scripts/check-cspell-words.test.ts to enforce unique, sorted words in cspell-words.txt.
  • Adds cspell-words job to lefthook.yml pre-commit hook.
  • Adds lint:spelling:words to npm run lint:spelling in package.json.
  • Sorts existing unsorted entries in cspell-words.txt.

How Checked

  • Unit tests: node --experimental-strip-types --test scripts/check-cspell-words.test.ts (5/5 passed)
  • Pre-commit: npx lefthook run pre-commit --file=cspell-words.txt
  • Format & lint: Prettier and ESLint passed cleanly
  • Spell check: npm run lint:spelling

Closes #478

Summary by CodeRabbit

  • Chores
    • Spelling dictionary entries are now alphabetized and include additional vocabulary.
    • Spelling checks now flag duplicate or incorrectly ordered dictionary entries, helping keep the dictionary consistent.
  • Tests
    • Added coverage for dictionary ordering, duplicate detection, and accepted blank lines and comments.

…mmit

Add scripts/check-cspell-words.ts and test suite to verify cspell-words.txt
is alphabetically sorted and contains no duplicate words (case-insensitive).
Wire check into lefthook pre-commit and npm run lint:spelling:words.
Sort existing unsorted entries in cspell-words.txt.

Closes #478
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0e5c065 and 72ae039.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds a checker for duplicate and unsorted entries in cspell-words.txt, updates the word list, and connects validation to spelling lint and pre-commit hooks.

Changes: Word-list validation

Layer / File(s) Summary
Implement and test word-list validation
scripts/check-cspell-words.ts, scripts/check-cspell-words.test.ts
The validator skips blank and comment lines, detects case-insensitive duplicates, and checks ASCII ordering. Tests cover valid lists, duplicates, and unsorted entries.
Update the spelling dictionary
cspell-words.txt
The word list gains entries in alphabetic positions. The appended block of entries is removed.
Run validation from lint and pre-commit
package.json, lefthook.yml
The spelling lint command runs the validator after cspell. Lefthook runs it when cspell-words.txt is staged.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Possibly related PRs

  • dpologdvinity/daydaze#348: Adds entries to the same dictionary file, which this pull request now validates for ordering and duplicates.
Merge Risk: Minimal · previous review 0e5c0

This change adds a check that rejects duplicate or unsorted spelling-dictionary entries, running in spelling lint and in pre-commit when the dictionary is staged. It affects only developer tooling and no production behavior. No merge-blocking risk was identified.

Security architecture risk: Minimal · up to 0e5c0

The change adds a read-only dictionary check to spelling lint and pre-commit. It does not change the application’s runtime, permissions, or stored state.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: validation of cspell-words.txt for alphabetical sorting and duplicate entries. It matches the changeset and PR objectives. The title is 72 characters, which is slightl…
Description check Passed The description covers the required intent and the main changes: the new validation script and tests, the pre-commit hook, the lint:spelling update, and the sorted word list. It also lists how the cha…
Linked Issues check Passed Issue #478 requires a check, in scripts/check-cspell-words.ts or the Lefthook config, that verifies sorting and uniqueness of cspell-words.txt. At head, validateCspellWords in scripts/check-cspell-wor…
Out of Scope Changes check Passed All changed files map to #478. scripts/check-cspell-words.ts and its test file implement the validation. lefthook.yml and package.json wire the validation into pre-commit and lint:spelling. cspell-wor…
Full details: Title check

Explanation

The title names the main change: validation of cspell-words.txt for alphabetical sorting and duplicate entries. It matches the changeset and PR objectives. The title is 72 characters, which is slightly long but still clear.

Full details: Description check

Explanation

The description covers the required intent and the main changes: the new validation script and tests, the pre-commit hook, the lint:spelling update, and the sorted word list. It also lists how the change was checked and links issue #478. The template's 'What and why' and 'How it was checked' sections are present. The template's other checklist items are not addressed: the npm run verify result, Playwright tests, screenshots, and the docs/assets.md and src/game/credits.ts asset recording. Those items may not apply to this change, but the author does not mark them as not applicable.

Resolution

Optionally state whether npm run verify was run, and mark the Playwright, screenshot, and asset-recording items as not applicable, or check them off if they apply.

Full details: Linked Issues check

Explanation

Issue #478 requires a check, in scripts/check-cspell-words.ts or the Lefthook config, that verifies sorting and uniqueness of cspell-words.txt. At head, validateCspellWords in scripts/check-cspell-words.ts ignores blank and # comment lines, reports duplicates case-insensitively with line numbers, and reports adjacent entries where the current word compares greater than the next word. Its CLI mode exits with status 1 on failure. lefthook.yml adds a cspell-words job (glob cspell-words.txt) that runs node --experimental-strip-types scripts/check-cspell-words.ts. package.json adds lint:spelling:words to lint:spelling. The unit tests in scripts/check-cspell-words.test.ts cover sorted input, duplicates, case-insensitive duplicates, and unsorted entries. Sorting uses ASCII code-point order, not locale-aware alphabetical order. The issue does not specify a collation, so this is a reasonable reading. Not verified: the test run result (5/5) is reported by the author and was not re-executed here.

Full details: Out of Scope Changes check

Explanation

All changed files map to #478. scripts/check-cspell-words.ts and its test file implement the validation. lefthook.yml and package.json wire the validation into pre-commit and lint:spelling. cspell-words.txt changes are +176/-176 lines, consistent with moving existing entries into sorted positions as the PR description states. The AI-generated summary says the file 'adds many dictionary entries', but equal addition and deletion counts indicate reordering, not new vocabulary. Full word-level diff of cspell-words.txt was not inspected, so this is inferred from line counts and the PR description.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7cb57dd and 0e5c065.

Files selected for processing: 5

  • cspell-words.txt
  • lefthook.yml
  • package.json
  • scripts/check-cspell-words.test.ts
  • scripts/check-cspell-words.ts

Limit details: You’ve used all 10 included reviews currently available.

@github-actions github-actions Bot added bug Something isn't working area: ci CI and tooling model: gemini-3.8-flash Antigravity (Gemini 3.8 Flash): small visual/UI/CI/logic fixes; no GitHub, Blender or Meshy MCP effort: low Low reasoning effort labels Nov 24, 2026
@dpologdvinity
dpologdvinity merged commit ad67ffa into main Nov 24, 2026
20 checks passed
@dpologdvinity
dpologdvinity deleted the fix/cspell-words-lint branch November 24, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI and tooling bug Something isn't working effort: low Low reasoning effort model: gemini-3.8-flash Antigravity (Gemini 3.8 Flash): small visual/UI/CI/logic fixes; no GitHub, Blender or Meshy MCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(lint): configure cspell-words.txt alphabetical and duplicate validation in pre-commit

1 participant