Automattic / Automattic/harper
Improve `TransposedSpace` linter
- Dominant language
- Rust
- Stars
- 15.4k
- Forks
- 627
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 106
Description
**Describe the bug**
One of my most common misspellings is a "transposed space", e.g.
I type `I think you think to omuch of me` instead of `I think you think too much of me`
It would be great if harper got better at catching this.
**To Reproduce**
With a bit of AI help, I generated/cleaned up a bunch of cases where the `TransposedSpace` linter is either not suggested at all, or a different, worse/unrelated/incorrect linter takes precedence. See:
```
Not suggested/Incorrect suggestion:
I think you think to omuch of me
I saw a ca trun across the street.
We need to tal kabout the issue.
He needed to us ethe loo.
ar eyou coming with us?
The book is o nthe table.
Can you pass me th ebutter?
He ran fastt o catch the bus.
I'd like a cu pof tea please.
She is al lalone tonight.
I can't find m ykeys anywhere.
He put it o nthe shelf yesterday.
She sh ewalked home.
We need to fi xthis immediately.
Can you tur noff the light?
I'll meet you a tthe park.
He bought a ne wcar yesterday.
Suggests `TransposedSpace` correctly:
she'sa lways late
I can't believe you said tha tto me.
She gave me a nic epresent.
Please leav eme out of this.
I saw a bi rdfly away.
I think it's ove rthere by the fence.
He was s oangry he couldn't speak.
She is ver yhappy today.
What are you doin ghere?
It's ove rnow we can relax.
```
I tested this using: https://kraxen72.github.io/local-harper/ - you can just paste it there. I tried verifying it in writewithharper.com/editor, but it won't load for me.
**Expected behavior**
The TransposedSpace linter should come up and have precedence over other, less related linters in (at least) the cases I mentioned. feel free to make more tests/fuzzing beyond this.
**Screenshots**
N/A
**Platform**
https://kraxen72.github.io/local-harper/, but I made sure I updated harper.js to latest and also the official editor at writewithharper.com/editor didn't work for me.
**Additional context**
Thank you. I love harper. <3
Contributor guide
Research direction
Start by locating the TransposedSpace linter and its existing tests in the Harper repository. Add regression cases from the report, then run the linter tests to verify that transposed spaces are detected and take precedence over less-related suggestions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100