Problem: Your dev team makes spelling mistakes in code


Problem: Your dev team makes spelling mistakes in code.

Solution: CSpell

CSpell has a command line interface. So, run it against your entire codebase on your CI server, or via precommit/prepush hooks.

Add words to the dictionary by creating cspell.json in your project root.

Here's a link: https://cspell.org/

Oh, and if you're using VS Code, you can see real-time line spelling errors via Code Spell Checker: https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker

You might think "Does spelling matter?"

Absolutely. It slows reading, and is often a sign of a bug.

Example: I'm auditing a project that has dozens of spelling errors. CSpell helped me find a few bugs related to URL search params with typos in them.
Update: I just used CSpell to resolve over 1000 spelling issues in a large codebase. It found many user-facing spelling issues, as well as 100's of misspelled comments, functions, types, and variables.

Now we can run CSpell via CI so we can protect ourselves from future typos!

View original on X