diff --git a/harper-core/src/linting/terminating_conjunctions.rs b/harper-core/src/linting/terminating_conjunctions.rs index cc2af7d6..78de2150 100644 --- a/harper-core/src/linting/terminating_conjunctions.rs +++ b/harper-core/src/linting/terminating_conjunctions.rs @@ -1,6 +1,5 @@ use super::{Lint, LintKind, PatternLinter}; -use crate::patterns::{ConsumesRemainingPattern, Pattern, SequencePattern}; -use crate::Lrc; +use crate::patterns::{ConsumesRemainingPattern, Pattern, SequencePattern, WordSet}; pub struct TerminatingConjunctions { pattern: Box, @@ -12,37 +11,33 @@ impl Default for TerminatingConjunctions { pattern: Box::new(ConsumesRemainingPattern::new(Box::new( SequencePattern::default() .then_anything_but_hyphen() - .then_any_word_in(Lrc::new( - [ - "although", - "as", - "because", - "if", - "lest", - "once", - "only", - "since", - "supposing", - "than", - "though", - "till", - "unless", - "until", - "when", - "whenever", - "where", - "whereas", - "wherever", - "whether", - "not", - "while", - "or", - "nor", - "and", - ] - .into_iter() - .collect(), - )) + .then_word_set(WordSet::all(&[ + "although", + "as", + "because", + "if", + "lest", + "once", + "only", + "since", + "supposing", + "than", + "though", + "till", + "unless", + "until", + "when", + "whenever", + "where", + "whereas", + "wherever", + "whether", + "not", + "while", + "or", + "nor", + "and", + ])) .then_comma(), ))), } @@ -55,7 +50,7 @@ impl PatternLinter for TerminatingConjunctions { } fn match_to_lint(&self, matched_tokens: &[crate::Token], source: &[char]) -> Lint { - let word_span = matched_tokens[0].span; + let word_span = matched_tokens[1].span; let word = word_span.get_content_string(source); Lint { diff --git a/packages/harper.js/src/LocalLinter.ts b/packages/harper.js/src/LocalLinter.ts index 6402e6be..3aa9a016 100644 --- a/packages/harper.js/src/LocalLinter.ts +++ b/packages/harper.js/src/LocalLinter.ts @@ -23,10 +23,7 @@ export default class LocalLinter implements Linter { async lint(text: string): Promise { await this.initialize(); - let lints = this.inner!.lint(text); - - // We only want to show fixable errors. - lints = lints.filter((lint) => lint.suggestion_count() > 0); + const lints = this.inner!.lint(text); return lints; }