Automattic / Automattic/harper

feat: Flag uses of "<preposition> which ... <preposition>"

Open
#524 5 comments 0 reactions 0 assignees View on GitHub
enhancement grammar harper-core linting prepositions
Dominant language
Rust
Stars
15.4k
Forks
627
Avg merge
1d 15h
Merged PRs (30d)
106

Description

In traditional formal English grammar artificially based on Latin there's an old rule that sentences can't end with a preposition. The advice is to instead move the preposition from the end to before the which.

But more recently this rule has largely been ignored as we see English is not like Latin, and it's now OK to end sentences with a preposition.

This is perhaps what has led to the phenomenon of some writers putting a preposition in both positions. Sometimes redundantly and sometimes conflicting.

**I'll maintain this list of examples from the wild here:**
- ... a foundation of support **from which** they could build **on**
→ a foundation of support **on which** they could build
→ a foundation of support **from which** they could build (questionable in this example)
→ a foundation of support **which** they could build **on**
→ a foundation of support which they could build **from** (worse than just questionable!)
- real change might occur that would upset the current order **in which** they benefited **from**
- It found kind of the exact commit that was touching uh this exact kind of area **in which** it's looking **into**.
- Both tracks are stopped from head-on collision by buffer stops, **of which** I'll come back **to** shortly.
- ..., but I was not expecting to have to fight for my life for a job **in which** I have experience **for**.
- But it is an undeniable reality that a wealthy family owns the entirety of the land **for which** these people are living **upon**.
- We see dash d is going to be the directory **in which** we extract the file **to**.

Note that often the second word is not a preposition but an adverb. People without linguistics training often mix these up which is easy to do because many words are in both categories. It's a preposition if it can be used directly before a noun in the same sense. Many phrasal verbs or at least collocations consist of a verb followed by either a preposition or such an adverb, as "build on" in the example, which we can contrast with "build from", which just does not sound right. A great implementation of this lint would probably first generate all 4 suggestions then prune combinations that sound wrong.

I was going to modify https://github.com/Automattic/harper/issues/464 to cover this case but I decided this is a distinct, older, and more common case than the other.

Contributor guide

Open the contributing guide

Research direction

Use the examples in this issue as acceptance cases, and compare the proposed scope with issue #464, which the author says is related but distinct. Then locate the project's existing grammar-lint entry points and tests; done means duplicated prepositions are flagged without treating ordinary sentence-final prepositions as errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.