Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(web): lint not showing up on the web for #131
Elijah Potterb5c3dc4a5694
diff --git a/harper-core/src/linting/terminating_conjunctions.rs b/harper-core/src/linting/terminating_conjunctions.rsindex cc2af7d66..78de2150d 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<dyn Pattern>,@@ -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.tsindex 6402e6be6..3aa9a0167 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<Lint[]> {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;}