Skip to content

fix(linting): add LifetimeLife rule to catch 'lifetime' where 'life' is meant#3789

Open
jlaportebot wants to merge 2 commits into
Automattic:masterfrom
jlaportebot:fix/lifetime-life-rebased-fresh
Open

fix(linting): add LifetimeLife rule to catch 'lifetime' where 'life' is meant#3789
jlaportebot wants to merge 2 commits into
Automattic:masterfrom
jlaportebot:fix/lifetime-life-rebased-fresh

Conversation

@jlaportebot

Copy link
Copy Markdown
Contributor

Summary

Add a new LifetimeLife lint rule to catch cases where lifetime is used after superlatives where life (lived experience) is the conventional word choice.

Problem

After superlative adjectives (best, worst, biggest, etc.) or certain intensifiers, "in my/your/their/etc. lifetime" should typically be "in my/your/their/etc. life" because the sentence refers to lived experience up to now, not the entire span of years.

Solution

Added a new LifetimeLife linter that:

  1. Detects superlative adjectives + noun gap + "in/of my/your/his/her/its/our/their lifetime"
  2. Suggests replacing lifetime with life
  3. Has exceptions for well-established idioms:
    • "once in a lifetime" / "once-in-a-lifetime"
    • "lifetime achievement"
    • "lifetime warranty/guarantee/access/membership/subscription"

Testing

  • 16 comprehensive tests added covering all variants
  • All existing tests pass
  • cargo check, cargo clippy, and cargo fmt all pass

Files Changed

  • harper-core/src/linting/lifetime_life.rs - New linter implementation with 16 tests
  • harper-core/src/linting/mod.rs - Module declaration
  • harper-core/src/linting/lint_group/mod.rs - Register the new linter
  • harper-core/default_config.json - Add to config (auto-generated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant