Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(linting): stop OneOfTheSingular flagging 'one of the latter/former' (#4463)
yi111db1c30e6e6e5
diff --git a/harper-core/src/linting/one_of_the_singular.rs b/harper-core/src/linting/one_of_the_singular.rsindex bad802674..db813f5f5 100644--- a/harper-core/src/linting/one_of_the_singular.rs+++ b/harper-core/src/linting/one_of_the_singular.rs@@ -25,7 +25,9 @@ impl SeqExprExt for SequenceExpr {&& !t.kind.is_preposition() // "in" etc.&& !t.kind.is_pronoun() // "who" etc.&& !t.get_ch(s)- .eq_any_ignore_ascii_case_str(&["ah", "few", "first", "said", "uh"])+ .eq_any_ignore_ascii_case_str(&[+ "ah", "few", "first", "former", "latter", "said", "uh",+ ])})}}@@ -292,4 +294,20 @@ mod tests {OneOfTheSingular::new(FstDictionary::curated()),);}++ #[test]+ fn dont_flag_one_of_the_latter() {+ assert_no_lints(+ "He asked a few friends and others asked him to come give talks. One of the latter was Jeanne Russell, who lives with her husband, Ron.",+ OneOfTheSingular::new(FstDictionary::curated()),+ );+ }++ #[test]+ fn dont_flag_one_of_the_former() {+ assert_no_lints(+ "One of the former has to stay behind to lock up, so let them go first.",+ OneOfTheSingular::new(FstDictionary::curated()),+ );+ }}