Typos works differently from other spell checkers, and is easier to keep updated
I’ve been struggling with lots of typos on my articles. I tried a few solutions, and eventually found one that works for me called typos.
typos on this very blog shows that I have an embarrassing amount of typos. Anyway, check out how it’s been helpful here:
ArticleSubcribeBox is checked as “Article Subcribe Box”).
Unlike traditional spell checkers,
typos doesn’t use dictionaries of valid words. Instead, it maintains a list of typo corrections.
Typos maintains a large typo correction list (shown below). As of Dec 2023, it has 4291 entries, and is updated regularly.
You can argue Typos’s approach makes it less effective, but I’ve found that it makes it more practical.
My experience with dictionary-based spell checkers like cspell needed a lot of configuration to deal with false positives.
This is less of a problem with
One of the use cases I wanted this for is to add spell check to rstacruz/
I’d prefer to lower the barrier to contribution as much as possible. Typos seems like a good fit for this.
The typos GitHub Action finishes in 8 seconds in one moderately-sized repo I maintain. My experience with a code editor is seamless too… corrections happen as instantly as I typed.
typos to show changes
typos -w to apply changes to all files
Also: Typos comes with a
--diff option (and
--format brief, shown below) to inspect changes. Running
typos -w to apply the changes.
While false positives are rare, they do happen. The word
DotA above is one of such examples. Typos has a configuration file to deal with these.
Unfortunately, I couldn’t find integrations to other editors. In any case, it’s also implemented as an LSP, which means it should be possible to integrate it with other LSP-supporting editors.
codespell is another spell checker with very similar goals to Typos. It also uses a list of typo corrections. In my experience, it works very well. I ended up sticking to Typos for 2 reasons:
cspell is a dictionary-based spell checker. I’ve given this a try in some code bases I maintained, and usually produced good results.
Ultimately, I ended up not using it. While cspell can be very comprehensive if you took time to add the right dictionaries, my needs were a bit more modest and I preferred the low maintenance approach of Typos.
Typos is a spell checker that works on code and prose. It’s low maintenance, and works with my favourite editors. While I might consider cspell for when spell checking must be as strict as possible, I think Typos is a great fit for cases where convenience is more important.
Do you use a spell checker in your editor? Let me know your experiences in the comments below.