Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

build: format workspace

Asuka1095db79889e3c4
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7c394e2d2..ea9a96fc1 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,3 @@
{
- "typescript.tsdk": "packages/harper.js/node_modules/typescript/lib"
+ "typescript.tsdk": "packages/harper.js/node_modules/typescript/lib"
}
diff --git a/harper-core/affixes.json b/harper-core/affixes.json
index 37f567396..e0378fe1e 100644
--- a/harper-core/affixes.json
+++ b/harper-core/affixes.json
@@ -1,756 +1,756 @@
{
- "affixes": {
- "K": {
- "#": "'pro-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "pro",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "L": {
- "#": "'-ment' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "ment",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "E": {
- "#": "'dis-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "dis",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "Y": {
- "#": "'-ly' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "ly",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "U": {
- "#": "'un-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "un",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "H": {
- "#": "'-ieth' suffix",
- "suffix": true,
- "cross_product": false,
- "replacements": [
- {
- "remove": "y",
- "add": "ieth",
- "condition": "y"
- },
- {
- "remove": "",
- "add": "th",
- "condition": "[^y]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "T": {
- "#": "'-(i)est' suffix",
- "suffix": true,
- "cross_product": false,
- "replacements": [
- {
- "remove": "",
- "add": "st",
- "condition": "e"
- },
- {
- "remove": "y",
- "add": "iest",
- "condition": "[^aeiou]y"
- },
- {
- "remove": "",
- "add": "est",
- "condition": "[aeiou]y"
- },
- {
- "remove": "",
- "add": "est",
- "condition": "[^ey]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "R": {
- "#": "'-(i)er' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "r",
- "condition": "e"
- },
- {
- "remove": "y",
- "add": "ier",
- "condition": "[^aeiou]y"
- },
- {
- "remove": "",
- "add": "er",
- "condition": "[aeiou]y"
- },
- {
- "remove": "",
- "add": "er",
- "condition": "[^ey]"
- }
- ],
- "adds_metadata": {
- "adjective": {}
- },
- "gifts_metadata": {}
- },
- "C": {
- "#": "'de-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "de",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "V": {
- "#": "'-ive' suffix",
- "suffix": true,
- "cross_product": false,
- "replacements": [
- {
- "remove": "e",
- "add": "ive",
- "condition": "e"
- },
- {
- "remove": "",
- "add": "ive",
- "condition": "[^e]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "N": {
- "#": "nominalization suffixes: -ion, -ication, -en",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "e",
- "add": "ion",
- "condition": "e"
- },
- {
- "remove": "y",
- "add": "ication",
- "condition": "y"
- },
- {
- "remove": "",
- "add": "en",
- "condition": "[^ey]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "A": {
- "#": "'re-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "re",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "Z": {
- "#": "'-(i)(e)rs' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "rs",
- "condition": "e"
- },
- {
- "remove": "y",
- "add": "iers",
- "condition": "[^aeiou]y"
- },
- {
- "remove": "",
- "add": "ers",
- "condition": "[aeiou]y"
- },
- {
- "remove": "",
- "add": "ers",
- "condition": "[^ey]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "P": {
- "#": "'-(i)ness' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "y",
- "add": "iness",
- "condition": "[^aeiou]y"
- },
- {
- "remove": "",
- "add": "ness",
- "condition": "[aeiou]y"
- },
- {
- "remove": "",
- "add": "ness",
- "condition": "[^y]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "M": {
- "#": "-'s possessive suffix; contraction of 'has' and 'is",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "'s",
- "condition": "."
- }
- ],
- "adds_metadata": {
- "noun": {
- "is_possessive": true
- }
- },
- "gifts_metadata": {
- "noun": {}
- }
- },
- "F": {
- "#": "'con-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "con",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "B": {
- "#": "'-able' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "able",
- "condition": "[^aeiou]"
- },
- {
- "remove": "",
- "add": "able",
- "condition": "ee"
- },
- {
- "remove": "e",
- "add": "able",
- "condition": "[^aeiou]e"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "S": {
- "#": "'-(i)(e)s' plural suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "y",
- "add": "ies",
- "condition": "[^aeiou]y"
- },
- {
- "remove": "",
- "add": "s",
- "condition": "[aeiou]y"
- },
- {
- "remove": "",
- "add": "es",
- "condition": "[sxzh]"
- },
- {
- "remove": "",
- "add": "s",
- "condition": "[^sxzhy]"
- }
- ],
- "adds_metadata": {
- "noun": {
- "is_plural": true
- }
- },
- "gifts_metadata": {}
- },
- "D": {
- "#": "'-(e)d' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "d",
- "condition": "e"
- },
- {
- "remove": "y",
- "add": "ied",
- "condition": "[^aeiou]y"
- },
- {
- "remove": "",
- "add": "ed",
- "condition": "[^ey]"
- },
- {
- "remove": "",
- "add": "ed",
- "condition": "[aeiou]y"
- }
- ],
- "adds_metadata": {
- "kind": {
- "kind": "Adjective"
- }
- },
- "gifts_metadata": {}
- },
- "G": {
- "#": "'-ing' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "e",
- "add": "ing",
- "condition": "e"
- },
- {
- "remove": "",
- "add": "ing",
- "condition": "[^e]"
- }
- ],
- "adds_metadata": {
- "verb": {},
- "noun": null,
- "adjective": null
- },
- "gifts_metadata": {}
- },
- "Q": {
- "#": "'-ally' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "ally",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "O": {
- "#": "'-ful' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "ful",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "I": {
- "#": "'in-' prefix",
- "suffix": false,
- "cross_product": true,
- "replacements": [
- {
- "remove": "",
- "add": "in",
- "condition": "."
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "X": {
- "#": "'-ions', '-ications', '-ens' suffixes",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "e",
- "add": "ions",
- "condition": "e"
- },
- {
- "remove": "y",
- "add": "ications",
- "condition": "y"
- },
- {
- "remove": "",
- "add": "ens",
- "condition": "[^ey]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "J": {
- "#": "'-ings' suffix",
- "suffix": true,
- "cross_product": true,
- "replacements": [
- {
- "remove": "e",
- "add": "ings",
- "condition": "e"
- },
- {
- "remove": "",
- "add": "ings",
- "condition": "[^e]"
- }
- ],
- "adds_metadata": {},
- "gifts_metadata": {}
- },
- "1": {
- "#": "singular noun property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "noun": {
- "is_plural": false
- }
- }
- },
- "2": {
- "#": "proper noun property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "noun": {
- "is_proper": true
- }
- }
- },
- "3": {
- "#": "linking verb property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "verb": {
- "is_linking": true
- }
- }
- },
- "4": {
- "#": "verb property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "verb": {}
- }
- },
- "5": {
- "#": "adjective property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "adjective": {}
- }
- },
- "6": {
- "#": "swear word property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {
- "swear": true
- },
- "gifts_metadata": {
- "swear": true
- }
- },
- "7": {
- "#": "conjunction property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "conjunction": {}
- }
- },
- "8": {
- "#": "pronoun property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {}
- }
- },
- "9": {
- "#": "plural noun property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "noun": {
- "is_plural": true
- }
- }
- },
- "~": {
- "#": "common word property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "common": true
- }
- },
- "+": {
- "#": "preposition property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "preposition": true
- }
- },
- "-": {
- "#": "determiner property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "determiner": true
- }
- },
- "j": {
- "#": "adverb property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "adverb": {}
- }
- },
- "s": {
- "#": "subject case property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {}
- }
- },
- "o": {
- "#": "object case property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {}
- }
- },
- "f": {
- "#": "first-person property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {}
- }
- },
- "n": {
- "#": "second-person property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {}
- }
- },
- "t": {
- "#": "third-person property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {}
- }
- },
- "c": {
- "#": "comparative property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "adjective": {}
- }
- },
- "u": {
- "#": "superlative property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "adjective": {}
- }
- },
- "*": {
- "#": "singular third-person pronoun property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {
- "is_plural": false,
- "person": "Third"
- }
- }
- },
- ":": {
- "#": "plural pronoun property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "pronoun": {
- "is_plural": true
- }
- }
- },
- "m": {
- "#": "auxiliary verb property",
- "suffix": true,
- "cross_product": true,
- "replacements": [],
- "adds_metadata": {},
- "gifts_metadata": {
- "verb": {
- "is_auxiliary": true
- }
- }
- }
- }
+ "affixes": {
+ "K": {
+ "#": "'pro-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "pro",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "L": {
+ "#": "'-ment' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "ment",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "E": {
+ "#": "'dis-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "dis",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "Y": {
+ "#": "'-ly' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "ly",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "U": {
+ "#": "'un-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "un",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "H": {
+ "#": "'-ieth' suffix",
+ "suffix": true,
+ "cross_product": false,
+ "replacements": [
+ {
+ "remove": "y",
+ "add": "ieth",
+ "condition": "y"
+ },
+ {
+ "remove": "",
+ "add": "th",
+ "condition": "[^y]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "T": {
+ "#": "'-(i)est' suffix",
+ "suffix": true,
+ "cross_product": false,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "st",
+ "condition": "e"
+ },
+ {
+ "remove": "y",
+ "add": "iest",
+ "condition": "[^aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "est",
+ "condition": "[aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "est",
+ "condition": "[^ey]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "R": {
+ "#": "'-(i)er' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "r",
+ "condition": "e"
+ },
+ {
+ "remove": "y",
+ "add": "ier",
+ "condition": "[^aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "er",
+ "condition": "[aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "er",
+ "condition": "[^ey]"
+ }
+ ],
+ "adds_metadata": {
+ "adjective": {}
+ },
+ "gifts_metadata": {}
+ },
+ "C": {
+ "#": "'de-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "de",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "V": {
+ "#": "'-ive' suffix",
+ "suffix": true,
+ "cross_product": false,
+ "replacements": [
+ {
+ "remove": "e",
+ "add": "ive",
+ "condition": "e"
+ },
+ {
+ "remove": "",
+ "add": "ive",
+ "condition": "[^e]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "N": {
+ "#": "nominalization suffixes: -ion, -ication, -en",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "e",
+ "add": "ion",
+ "condition": "e"
+ },
+ {
+ "remove": "y",
+ "add": "ication",
+ "condition": "y"
+ },
+ {
+ "remove": "",
+ "add": "en",
+ "condition": "[^ey]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "A": {
+ "#": "'re-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "re",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "Z": {
+ "#": "'-(i)(e)rs' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "rs",
+ "condition": "e"
+ },
+ {
+ "remove": "y",
+ "add": "iers",
+ "condition": "[^aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "ers",
+ "condition": "[aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "ers",
+ "condition": "[^ey]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "P": {
+ "#": "'-(i)ness' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "y",
+ "add": "iness",
+ "condition": "[^aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "ness",
+ "condition": "[aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "ness",
+ "condition": "[^y]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "M": {
+ "#": "-'s possessive suffix; contraction of 'has' and 'is",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "'s",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {
+ "noun": {
+ "is_possessive": true
+ }
+ },
+ "gifts_metadata": {
+ "noun": {}
+ }
+ },
+ "F": {
+ "#": "'con-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "con",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "B": {
+ "#": "'-able' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "able",
+ "condition": "[^aeiou]"
+ },
+ {
+ "remove": "",
+ "add": "able",
+ "condition": "ee"
+ },
+ {
+ "remove": "e",
+ "add": "able",
+ "condition": "[^aeiou]e"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "S": {
+ "#": "'-(i)(e)s' plural suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "y",
+ "add": "ies",
+ "condition": "[^aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "s",
+ "condition": "[aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "es",
+ "condition": "[sxzh]"
+ },
+ {
+ "remove": "",
+ "add": "s",
+ "condition": "[^sxzhy]"
+ }
+ ],
+ "adds_metadata": {
+ "noun": {
+ "is_plural": true
+ }
+ },
+ "gifts_metadata": {}
+ },
+ "D": {
+ "#": "'-(e)d' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "d",
+ "condition": "e"
+ },
+ {
+ "remove": "y",
+ "add": "ied",
+ "condition": "[^aeiou]y"
+ },
+ {
+ "remove": "",
+ "add": "ed",
+ "condition": "[^ey]"
+ },
+ {
+ "remove": "",
+ "add": "ed",
+ "condition": "[aeiou]y"
+ }
+ ],
+ "adds_metadata": {
+ "kind": {
+ "kind": "Adjective"
+ }
+ },
+ "gifts_metadata": {}
+ },
+ "G": {
+ "#": "'-ing' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "e",
+ "add": "ing",
+ "condition": "e"
+ },
+ {
+ "remove": "",
+ "add": "ing",
+ "condition": "[^e]"
+ }
+ ],
+ "adds_metadata": {
+ "verb": {},
+ "noun": null,
+ "adjective": null
+ },
+ "gifts_metadata": {}
+ },
+ "Q": {
+ "#": "'-ally' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "ally",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "O": {
+ "#": "'-ful' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "ful",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "I": {
+ "#": "'in-' prefix",
+ "suffix": false,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "",
+ "add": "in",
+ "condition": "."
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "X": {
+ "#": "'-ions', '-ications', '-ens' suffixes",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "e",
+ "add": "ions",
+ "condition": "e"
+ },
+ {
+ "remove": "y",
+ "add": "ications",
+ "condition": "y"
+ },
+ {
+ "remove": "",
+ "add": "ens",
+ "condition": "[^ey]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "J": {
+ "#": "'-ings' suffix",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [
+ {
+ "remove": "e",
+ "add": "ings",
+ "condition": "e"
+ },
+ {
+ "remove": "",
+ "add": "ings",
+ "condition": "[^e]"
+ }
+ ],
+ "adds_metadata": {},
+ "gifts_metadata": {}
+ },
+ "1": {
+ "#": "singular noun property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "noun": {
+ "is_plural": false
+ }
+ }
+ },
+ "2": {
+ "#": "proper noun property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "noun": {
+ "is_proper": true
+ }
+ }
+ },
+ "3": {
+ "#": "linking verb property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "verb": {
+ "is_linking": true
+ }
+ }
+ },
+ "4": {
+ "#": "verb property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "verb": {}
+ }
+ },
+ "5": {
+ "#": "adjective property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "adjective": {}
+ }
+ },
+ "6": {
+ "#": "swear word property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {
+ "swear": true
+ },
+ "gifts_metadata": {
+ "swear": true
+ }
+ },
+ "7": {
+ "#": "conjunction property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "conjunction": {}
+ }
+ },
+ "8": {
+ "#": "pronoun property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {}
+ }
+ },
+ "9": {
+ "#": "plural noun property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "noun": {
+ "is_plural": true
+ }
+ }
+ },
+ "~": {
+ "#": "common word property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "common": true
+ }
+ },
+ "+": {
+ "#": "preposition property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "preposition": true
+ }
+ },
+ "-": {
+ "#": "determiner property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "determiner": true
+ }
+ },
+ "j": {
+ "#": "adverb property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "adverb": {}
+ }
+ },
+ "s": {
+ "#": "subject case property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {}
+ }
+ },
+ "o": {
+ "#": "object case property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {}
+ }
+ },
+ "f": {
+ "#": "first-person property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {}
+ }
+ },
+ "n": {
+ "#": "second-person property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {}
+ }
+ },
+ "t": {
+ "#": "third-person property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {}
+ }
+ },
+ "c": {
+ "#": "comparative property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "adjective": {}
+ }
+ },
+ "u": {
+ "#": "superlative property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "adjective": {}
+ }
+ },
+ "*": {
+ "#": "singular third-person pronoun property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {
+ "is_plural": false,
+ "person": "Third"
+ }
+ }
+ },
+ ":": {
+ "#": "plural pronoun property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "pronoun": {
+ "is_plural": true
+ }
+ }
+ },
+ "m": {
+ "#": "auxiliary verb property",
+ "suffix": true,
+ "cross_product": true,
+ "replacements": [],
+ "adds_metadata": {},
+ "gifts_metadata": {
+ "verb": {
+ "is_auxiliary": true
+ }
+ }
+ }
+ }
}
diff --git a/harper-core/proper_noun_rules.json b/harper-core/proper_noun_rules.json
index 85dbab37a..999398760 100644
--- a/harper-core/proper_noun_rules.json
+++ b/harper-core/proper_noun_rules.json
@@ -1,526 +1,511 @@
{
- "Americas": {
- "canonical": [
- "South America",
- "North America",
- "Central America"
- ],
- "description": "When referring to North, Central, and South America, make sure to treat them as a proper noun."
- },
- "Australia": {
- "canonical": [
- "Australian Capital Territory",
- "New South Wales",
- "Northern Territory",
- "South Australia",
- "Western Australia",
- "Alice Springs",
- "Gold Coast",
- "Sunshine Coast"
- ],
- "description": "When referring to the states of Australia, make sure to treat them as a proper noun."
- },
- "OceansAndSeas": {
- "canonical": [
- "Atlantic Ocean",
- "Pacific Ocean",
- "Indian Ocean",
- "Southern Ocean",
- "Arctic Ocean",
- "Mediterranean Sea",
- "Caribbean Sea",
- "Baltic Sea",
- "Red Sea",
- "Black Sea",
- "Caspian Sea",
- "Coral Sea",
- "Bering Sea",
- "North Sea",
- "South China Sea"
- ],
- "description": "When referring to the world's oceans and seas, ensure they are treated as proper nouns."
- },
- "Canada": {
- "canonical": [
- "British Columbia",
- "New Brunswick",
- "Northwest Territories",
- "Nova Scotia",
- "Prince Edward Island",
- "Quebec City"
- ],
- "description": "When referring to the provinces of Canada, make sure to treat them as a proper noun."
- },
- "Malaysia": {
- "canonical": [
- "Negeri Sembilan",
- "Alor Setar",
- "George Town",
- "Johor Bahru",
- "Kota Bahru",
- "Kota Kinabalu",
- "Kuala Lumpur",
- "Kuala Terengganu",
- "Shah Alam"
- ],
- "description": "When referring to the states of Malaysia and their capitals, make sure to treat them as a proper noun."
- },
- "Countries": {
- "canonical": [
- "Equatorial Guinea",
- "Papua New Guinea",
- "Cayman Islands",
- "Falkland Islands",
- "Marshall Islands",
- "Solomon Islands",
- "British Virgin Islands",
- "United States Virgin Islands",
- "Northern Mariana Islands",
- "New Caledonia",
- "New Zealand",
- "Northern Cyprus",
- "Northern Ireland",
- "Central African Republic",
- "Czech Republic",
- "Dominican Republic",
- "Saint Helena",
- "Saint Lucia",
- "Saint Martin",
- "South Africa",
- "South Ossetia",
- "South Sudan",
- "American Samoa",
- "Antigua and Barbuda",
- "Bosnia and Herzegovina",
- "Burkina Faso",
- "Cape Verde",
- "Costa Rica",
- "Democratic Republic of the Congo",
- "East Timor",
- "El Salvador",
- "French Polynesia",
- "Guinea-Bissau",
- "Isle of Man",
- "Ivory Coast",
- "North Macedonia",
- "Puerto Rico",
- "São Tomé and Príncipe",
- "Saudi Arabia",
- "Sierra Leone",
- "Sint Maarten",
- "Sri Lanka",
- "Trinidad and Tobago",
- "Western Sahara"
- ],
- "description": "When referring to Countries, make sure to treat it as a proper noun."
- },
- "NationalCapitals": {
- "canonical": [
- "Belize City",
- "Guatemala City",
- "Kuwait City",
- "Mexico City",
- "Panama City",
- "Vatican City",
- "Ho Chi Minh City",
- "Saint Kitts and Nevis",
- "Saint Pierre and Miquelon",
- "Saint Vincent and the Grenadines",
- "San José",
- "San Juan",
- "San Marino",
- "San Salvador",
- "Cape Town",
- "George Town",
- "Abu Dhabi",
- "Addis Ababa",
- "Bandar Seri Begawan",
- "Buenos Aires",
- "Diego Garcia",
- "La Paz",
- "New Delhi",
- "Pago Pago",
- "Phnom Penh",
- "Port Louis",
- "Port Moresby",
- "Port Vila",
- "Port of Spain",
- "Porto-Novo",
- "Santo Domingo",
- "São Tomé",
- "The Bahamas",
- "The Hague"
- ],
- "description": "When referring to national capitals, make sure to treat it as a proper noun."
- },
- "ChineseCommunistParty": {
- "canonical": [
- "Chinese Communist Party"
- ],
- "description": "When referring to the political party, make sure to treat them as a proper noun."
- },
- "UnitedOrganizations": {
- "canonical": [
- "United Nations",
- "United States",
- "United Kingdom",
- "United Airlines",
- "United Arab Emirates"
- ],
- "description": "When referring to national or international organizations, make sure to treat them as a proper noun."
- },
- "Holidays": {
- "canonical": [
- "Absolution Day",
- "Admission Day",
- "Alaska Day",
- "Anzac Day",
- "Arbor Day",
- "Armistice Day",
- "Ascension Day",
- "Australia Day",
- "Bastille Day",
- "Boxing Day",
- "Canada Day",
- "Christmas Day",
- "Columbus Day",
- "Commonwealth Day",
- "Darwin Day",
- "Discovery Day",
- "Dominion Day",
- "Earth Day",
- "Easter Day",
- "Election Day",
- "Emancipation Day",
- "Empire Day",
- "Father's Day",
- "Flag Day",
- "Freedom Day",
- "Galentine's Day",
- "Groundhog Day",
- "Halloween",
- "Independence Day",
- "Jamhuri Day",
- "Jubilee Day",
- "Kamehameha Day",
- "Kenyatta Day",
- "Labor Day",
- "Labour Day",
- "Madaraka Day",
- "Mashujaa Day",
- "May Day",
- "Memorial Day",
- "Merdeka Day",
- "Mother's Day",
- "National Freedom Day",
- "New Year's Day",
- "Patrick's Day",
- "Presidents' Day",
- "Remembrance Day",
- "Republic Day",
- "Rizal Day",
- "Thanksgiving Day",
- "Ulster Day",
- "Valentine's Day",
- "Veterans Day",
- "Victoria Day",
- "Victory Day",
- "Waitangi Day",
- "Wattle Day",
- "Year's Day",
- "Youth Day",
- "Black Friday",
- "Cyber Monday"
- ],
- "description": "When referring to holidays, make sure to treat them as a proper noun."
- },
- "Koreas": {
- "canonical": [
- "South Korea",
- "North Korea"
- ],
- "description": "When referring to the nations, make sure to treat them as a proper noun."
- },
- "AmazonNames": {
- "canonical": [
- "Amazon Shopping",
- "Amazon Web Services",
- "Amazon Lambda",
- "Amazon RDS",
- "Amazon DynamoDB",
- "Amazon SageMaker",
- "Amazon Rekognition",
- "Amazon CloudFront",
- "Amazon ECS",
- "Amazon EKS",
- "Amazon CloudWatch",
- "Amazon IAM",
- "Amazon Prime",
- "Amazon Kindle"
- ],
- "description": "When referring to the various products of Amazon.com, make sure to treat them as a proper noun."
- },
- "GoogleNames": {
- "canonical": [
- "Google Search",
- "Google Cloud",
- "Google Maps",
- "Google Docs",
- "Google Sheets",
- "Google Slides",
- "Google Drive",
- "Google Meet",
- "Google Gmail",
- "Google Calendar",
- "Google Chrome",
- "Google ChromeOS",
- "Google Android",
- "Google Play",
- "Google Bard",
- "Google Gemini",
- "Google YouTube",
- "Google Photos",
- "Google Analytics",
- "Google AdSense",
- "Google Pixel",
- "Google Nest",
- "Google Workspace"
- ],
- "description": "When referring to Google products and services, make sure to treat them as proper nouns."
- },
- "AzureNames": {
- "canonical": [
- "Azure DevOps",
- "Azure Functions",
- "Azure Cosmos DB",
- "Azure SQL Database",
- "Azure Kubernetes Service",
- "Azure Virtual Machines",
- "Azure Monitor",
- "Azure Storage",
- "Azure Active Directory",
- "Azure App Service",
- "Azure Key Vault",
- "Azure Cognitive Services",
- "Azure Service Bus",
- "Azure Event Hub"
- ],
- "description": "When referring to Azure cloud services, make sure to treat them as proper nouns."
- },
- "MicrosoftNames": {
- "canonical": [
- "Microsoft Windows",
- "Microsoft Office",
- "Microsoft Teams",
- "Microsoft Excel",
- "Microsoft PowerPoint",
- "Microsoft Word",
- "Microsoft Outlook",
- "Microsoft OneDrive",
- "Microsoft SharePoint",
- "Microsoft Xbox",
- "Microsoft Surface",
- "Microsoft Edge",
- "Microsoft Bing",
- "Microsoft Dynamics",
- "Microsoft Visual Studio"
- ],
- "description": "When referring to Microsoft products and services, make sure to treat them as proper nouns."
- },
- "AppleNames": {
- "canonical": [
- "Apple iPhone",
- "Apple iPad",
- "Apple iMac",
- "Apple MacBook",
- "Apple Watch",
- "Apple TV",
- "Apple Music",
- "Apple Arcade",
- "Apple iCloud",
- "Apple Safari",
- "Apple HomeKit",
- "Apple CarPlay",
- "Apple MacBook Pro",
- "Apple MacBook Air",
- "Apple Mac Pro",
- "Apple Mac Mini",
- "Apple AirPods",
- "Apple AirPods Pro",
- "Apple AirPods Max",
- "Apple Vision Pro"
- ],
- "description": "When referring to Apple products and services, make sure to treat them as proper nouns."
- },
- "MetaNames": {
- "canonical": [
- "Meta Oculus",
- "Meta Portals",
- "Meta Quest",
- "Meta Gaming",
- "Meta Horizon",
- "Meta Reality Labs"
- ],
- "description": "When referring to Meta products and services, make sure to treat them as proper nouns."
- },
- "JetpackNames": {
- "canonical": [
- "Jetpack VaultPress Backup",
- "Jetpack VaultPress",
- "Jetpack Scan",
- "Jetpack Akismet Anti-spam",
- "Jetpack Stats",
- "Jetpack Social",
- "Jetpack Blaze",
- "Jetpack AI Assistant",
- "Jetpack Site Search",
- "Jetpack Boost",
- "Jetpack VideoPress",
- "Jetpack For Agencies",
- "Jetpack CRM"
- ],
- "description": "Ensure proper capitalization of Jetpack-related terms."
- },
- "TumblrNames": {
- "canonical": [
- "Tumblr Blaze",
- "Tumblr Pro",
- "Tumblr Live",
- "Tumblr Ads",
- "Tumblr Communities",
- "Tumblr Shop",
- "Tumblr Dashboard"
- ],
- "description": "Ensure proper capitalization of Tumblr-related terms."
- },
- "PocketCastsNames": {
- "canonical": [
- "Pocket Casts",
- "Pocket Casts Plus"
- ],
- "description": "Ensure proper capitalization of Pocket Casts and Pocket Casts Plus as brand names."
- },
- "DayOneNames": {
- "canonical": [
- "Day One",
- "Day One Premium"
- ],
- "description": "Ensure proper capitalization of Day One and Day One Premium as brand names."
- },
- "USUniversities": {
- "canonical": [
- "Harvard University",
- "Stanford University",
- "Massachusetts Institute of Technology",
- "California Institute of Technology",
- "Princeton University",
- "Yale University",
- "Columbia University",
- "University of Chicago",
- "University of Pennsylvania",
- "Johns Hopkins University",
- "Duke University",
- "Northwestern University",
- "University of California",
- "University of Michigan",
- "University of Virginia",
- "University of North Carolina",
- "University of Wisconsin",
- "University of Texas",
- "University of Florida",
- "University of Washington",
- "University of Southern California",
- "New York University",
- "Cornell University",
- "Brown University",
- "Dartmouth College",
- "Carnegie Mellon University",
- "Georgetown University",
- "Rice University",
- "Vanderbilt University",
- "Washington University",
- "Emory University",
- "University of Notre Dame",
- "Boston University",
- "Boston College",
- "University of Miami",
- "University of Illinois",
- "Ohio State University",
- "Pennsylvania State University",
- "Purdue University",
- "Texas A&M University",
- "Georgia Institute of Technology",
- "University of Minnesota",
- "Michigan State University",
- "Indiana University",
- "University of Colorado",
- "University of Arizona",
- "University of Pittsburgh",
- "University of Maryland",
- "Rutgers University",
- "University of Rochester",
- "University of Connecticut",
- "University of Georgia",
- "University of Iowa",
- "University of Kansas",
- "University of Kentucky",
- "University of Missouri",
- "University of Nebraska",
- "University of Tennessee",
- "University of Utah",
- "University of Oklahoma",
- "University of Oregon",
- "University of South Carolina",
- "University of Alabama",
- "University of Central Florida",
- "University of Houston",
- "University of Delaware",
- "University of Mississippi",
- "University of Arkansas",
- "Florida State University",
- "Arizona State University",
- "Colorado State University",
- "North Carolina State University",
- "Iowa State University",
- "Kansas State University",
- "Louisiana State University",
- "Oregon State University",
- "South Carolina State University",
- "Virginia Tech",
- "Auburn University",
- "Temple University",
- "University of Massachusetts",
- "Baylor University",
- "Southern Methodist University",
- "Wake Forest University",
- "George Washington University",
- "American University",
- "Villanova University",
- "Marquette University",
- "Pepperdine University",
- "Loyola Marymount University",
- "Santa Clara University",
- "Fordham University",
- "DePaul University",
- "Syracuse University",
- "Rensselaer Polytechnic Institute",
- "Stevens Institute of Technology",
- "Illinois Institute of Technology",
- "Clark University",
- "Tufts University",
- "Brandeis University",
- "Case Western Reserve University",
- "Drexel University",
- "Lehigh University",
- "Howard University",
- "Spelman College",
- "Morehouse College",
- "Hampton University",
- "Xavier University of Louisiana",
- "Tuskegee University",
- "Florida A&M University",
- "Colorado School of Mines"
- ],
- "description": "Ensure proper capitalization of major universities in the United States."
- }
+ "Americas": {
+ "canonical": ["South America", "North America", "Central America"],
+ "description": "When referring to North, Central, and South America, make sure to treat them as a proper noun."
+ },
+ "Australia": {
+ "canonical": [
+ "Australian Capital Territory",
+ "New South Wales",
+ "Northern Territory",
+ "South Australia",
+ "Western Australia",
+ "Alice Springs",
+ "Gold Coast",
+ "Sunshine Coast"
+ ],
+ "description": "When referring to the states of Australia, make sure to treat them as a proper noun."
+ },
+ "OceansAndSeas": {
+ "canonical": [
+ "Atlantic Ocean",
+ "Pacific Ocean",
+ "Indian Ocean",
+ "Southern Ocean",
+ "Arctic Ocean",
+ "Mediterranean Sea",
+ "Caribbean Sea",
+ "Baltic Sea",
+ "Red Sea",
+ "Black Sea",
+ "Caspian Sea",
+ "Coral Sea",
+ "Bering Sea",
+ "North Sea",
+ "South China Sea"
+ ],
+ "description": "When referring to the world's oceans and seas, ensure they are treated as proper nouns."
+ },
+ "Canada": {
+ "canonical": [
+ "British Columbia",
+ "New Brunswick",
+ "Northwest Territories",
+ "Nova Scotia",
+ "Prince Edward Island",
+ "Quebec City"
+ ],
+ "description": "When referring to the provinces of Canada, make sure to treat them as a proper noun."
+ },
+ "Malaysia": {
+ "canonical": [
+ "Negeri Sembilan",
+ "Alor Setar",
+ "George Town",
+ "Johor Bahru",
+ "Kota Bahru",
+ "Kota Kinabalu",
+ "Kuala Lumpur",
+ "Kuala Terengganu",
+ "Shah Alam"
+ ],
+ "description": "When referring to the states of Malaysia and their capitals, make sure to treat them as a proper noun."
+ },
+ "Countries": {
+ "canonical": [
+ "Equatorial Guinea",
+ "Papua New Guinea",
+ "Cayman Islands",
+ "Falkland Islands",
+ "Marshall Islands",
+ "Solomon Islands",
+ "British Virgin Islands",
+ "United States Virgin Islands",
+ "Northern Mariana Islands",
+ "New Caledonia",
+ "New Zealand",
+ "Northern Cyprus",
+ "Northern Ireland",
+ "Central African Republic",
+ "Czech Republic",
+ "Dominican Republic",
+ "Saint Helena",
+ "Saint Lucia",
+ "Saint Martin",
+ "South Africa",
+ "South Ossetia",
+ "South Sudan",
+ "American Samoa",
+ "Antigua and Barbuda",
+ "Bosnia and Herzegovina",
+ "Burkina Faso",
+ "Cape Verde",
+ "Costa Rica",
+ "Democratic Republic of the Congo",
+ "East Timor",
+ "El Salvador",
+ "French Polynesia",
+ "Guinea-Bissau",
+ "Isle of Man",
+ "Ivory Coast",
+ "North Macedonia",
+ "Puerto Rico",
+ "São Tomé and Príncipe",
+ "Saudi Arabia",
+ "Sierra Leone",
+ "Sint Maarten",
+ "Sri Lanka",
+ "Trinidad and Tobago",
+ "Western Sahara"
+ ],
+ "description": "When referring to Countries, make sure to treat it as a proper noun."
+ },
+ "NationalCapitals": {
+ "canonical": [
+ "Belize City",
+ "Guatemala City",
+ "Kuwait City",
+ "Mexico City",
+ "Panama City",
+ "Vatican City",
+ "Ho Chi Minh City",
+ "Saint Kitts and Nevis",
+ "Saint Pierre and Miquelon",
+ "Saint Vincent and the Grenadines",
+ "San José",
+ "San Juan",
+ "San Marino",
+ "San Salvador",
+ "Cape Town",
+ "George Town",
+ "Abu Dhabi",
+ "Addis Ababa",
+ "Bandar Seri Begawan",
+ "Buenos Aires",
+ "Diego Garcia",
+ "La Paz",
+ "New Delhi",
+ "Pago Pago",
+ "Phnom Penh",
+ "Port Louis",
+ "Port Moresby",
+ "Port Vila",
+ "Port of Spain",
+ "Porto-Novo",
+ "Santo Domingo",
+ "São Tomé",
+ "The Bahamas",
+ "The Hague"
+ ],
+ "description": "When referring to national capitals, make sure to treat it as a proper noun."
+ },
+ "ChineseCommunistParty": {
+ "canonical": ["Chinese Communist Party"],
+ "description": "When referring to the political party, make sure to treat them as a proper noun."
+ },
+ "UnitedOrganizations": {
+ "canonical": [
+ "United Nations",
+ "United States",
+ "United Kingdom",
+ "United Airlines",
+ "United Arab Emirates"
+ ],
+ "description": "When referring to national or international organizations, make sure to treat them as a proper noun."
+ },
+ "Holidays": {
+ "canonical": [
+ "Absolution Day",
+ "Admission Day",
+ "Alaska Day",
+ "Anzac Day",
+ "Arbor Day",
+ "Armistice Day",
+ "Ascension Day",
+ "Australia Day",
+ "Bastille Day",
+ "Boxing Day",
+ "Canada Day",
+ "Christmas Day",
+ "Columbus Day",
+ "Commonwealth Day",
+ "Darwin Day",
+ "Discovery Day",
+ "Dominion Day",
+ "Earth Day",
+ "Easter Day",
+ "Election Day",
+ "Emancipation Day",
+ "Empire Day",
+ "Father's Day",
+ "Flag Day",
+ "Freedom Day",
+ "Galentine's Day",
+ "Groundhog Day",
+ "Halloween",
+ "Independence Day",
+ "Jamhuri Day",
+ "Jubilee Day",
+ "Kamehameha Day",
+ "Kenyatta Day",
+ "Labor Day",
+ "Labour Day",
+ "Madaraka Day",
+ "Mashujaa Day",
+ "May Day",
+ "Memorial Day",
+ "Merdeka Day",
+ "Mother's Day",
+ "National Freedom Day",
+ "New Year's Day",
+ "Patrick's Day",
+ "Presidents' Day",
+ "Remembrance Day",
+ "Republic Day",
+ "Rizal Day",
+ "Thanksgiving Day",
+ "Ulster Day",
+ "Valentine's Day",
+ "Veterans Day",
+ "Victoria Day",
+ "Victory Day",
+ "Waitangi Day",
+ "Wattle Day",
+ "Year's Day",
+ "Youth Day",
+ "Black Friday",
+ "Cyber Monday"
+ ],
+ "description": "When referring to holidays, make sure to treat them as a proper noun."
+ },
+ "Koreas": {
+ "canonical": ["South Korea", "North Korea"],
+ "description": "When referring to the nations, make sure to treat them as a proper noun."
+ },
+ "AmazonNames": {
+ "canonical": [
+ "Amazon Shopping",
+ "Amazon Web Services",
+ "Amazon Lambda",
+ "Amazon RDS",
+ "Amazon DynamoDB",
+ "Amazon SageMaker",
+ "Amazon Rekognition",
+ "Amazon CloudFront",
+ "Amazon ECS",
+ "Amazon EKS",
+ "Amazon CloudWatch",
+ "Amazon IAM",
+ "Amazon Prime",
+ "Amazon Kindle"
+ ],
+ "description": "When referring to the various products of Amazon.com, make sure to treat them as a proper noun."
+ },
+ "GoogleNames": {
+ "canonical": [
+ "Google Search",
+ "Google Cloud",
+ "Google Maps",
+ "Google Docs",
+ "Google Sheets",
+ "Google Slides",
+ "Google Drive",
+ "Google Meet",
+ "Google Gmail",
+ "Google Calendar",
+ "Google Chrome",
+ "Google ChromeOS",
+ "Google Android",
+ "Google Play",
+ "Google Bard",
+ "Google Gemini",
+ "Google YouTube",
+ "Google Photos",
+ "Google Analytics",
+ "Google AdSense",
+ "Google Pixel",
+ "Google Nest",
+ "Google Workspace"
+ ],
+ "description": "When referring to Google products and services, make sure to treat them as proper nouns."
+ },
+ "AzureNames": {
+ "canonical": [
+ "Azure DevOps",
+ "Azure Functions",
+ "Azure Cosmos DB",
+ "Azure SQL Database",
+ "Azure Kubernetes Service",
+ "Azure Virtual Machines",
+ "Azure Monitor",
+ "Azure Storage",
+ "Azure Active Directory",
+ "Azure App Service",
+ "Azure Key Vault",
+ "Azure Cognitive Services",
+ "Azure Service Bus",
+ "Azure Event Hub"
+ ],
+ "description": "When referring to Azure cloud services, make sure to treat them as proper nouns."
+ },
+ "MicrosoftNames": {
+ "canonical": [
+ "Microsoft Windows",
+ "Microsoft Office",
+ "Microsoft Teams",
+ "Microsoft Excel",
+ "Microsoft PowerPoint",
+ "Microsoft Word",
+ "Microsoft Outlook",
+ "Microsoft OneDrive",
+ "Microsoft SharePoint",
+ "Microsoft Xbox",
+ "Microsoft Surface",
+ "Microsoft Edge",
+ "Microsoft Bing",
+ "Microsoft Dynamics",
+ "Microsoft Visual Studio"
+ ],
+ "description": "When referring to Microsoft products and services, make sure to treat them as proper nouns."
+ },
+ "AppleNames": {
+ "canonical": [
+ "Apple iPhone",
+ "Apple iPad",
+ "Apple iMac",
+ "Apple MacBook",
+ "Apple Watch",
+ "Apple TV",
+ "Apple Music",
+ "Apple Arcade",
+ "Apple iCloud",
+ "Apple Safari",
+ "Apple HomeKit",
+ "Apple CarPlay",
+ "Apple MacBook Pro",
+ "Apple MacBook Air",
+ "Apple Mac Pro",
+ "Apple Mac Mini",
+ "Apple AirPods",
+ "Apple AirPods Pro",
+ "Apple AirPods Max",
+ "Apple Vision Pro"
+ ],
+ "description": "When referring to Apple products and services, make sure to treat them as proper nouns."
+ },
+ "MetaNames": {
+ "canonical": [
+ "Meta Oculus",
+ "Meta Portals",
+ "Meta Quest",
+ "Meta Gaming",
+ "Meta Horizon",
+ "Meta Reality Labs"
+ ],
+ "description": "When referring to Meta products and services, make sure to treat them as proper nouns."
+ },
+ "JetpackNames": {
+ "canonical": [
+ "Jetpack VaultPress Backup",
+ "Jetpack VaultPress",
+ "Jetpack Scan",
+ "Jetpack Akismet Anti-spam",
+ "Jetpack Stats",
+ "Jetpack Social",
+ "Jetpack Blaze",
+ "Jetpack AI Assistant",
+ "Jetpack Site Search",
+ "Jetpack Boost",
+ "Jetpack VideoPress",
+ "Jetpack For Agencies",
+ "Jetpack CRM"
+ ],
+ "description": "Ensure proper capitalization of Jetpack-related terms."
+ },
+ "TumblrNames": {
+ "canonical": [
+ "Tumblr Blaze",
+ "Tumblr Pro",
+ "Tumblr Live",
+ "Tumblr Ads",
+ "Tumblr Communities",
+ "Tumblr Shop",
+ "Tumblr Dashboard"
+ ],
+ "description": "Ensure proper capitalization of Tumblr-related terms."
+ },
+ "PocketCastsNames": {
+ "canonical": ["Pocket Casts", "Pocket Casts Plus"],
+ "description": "Ensure proper capitalization of Pocket Casts and Pocket Casts Plus as brand names."
+ },
+ "DayOneNames": {
+ "canonical": ["Day One", "Day One Premium"],
+ "description": "Ensure proper capitalization of Day One and Day One Premium as brand names."
+ },
+ "USUniversities": {
+ "canonical": [
+ "Harvard University",
+ "Stanford University",
+ "Massachusetts Institute of Technology",
+ "California Institute of Technology",
+ "Princeton University",
+ "Yale University",
+ "Columbia University",
+ "University of Chicago",
+ "University of Pennsylvania",
+ "Johns Hopkins University",
+ "Duke University",
+ "Northwestern University",
+ "University of California",
+ "University of Michigan",
+ "University of Virginia",
+ "University of North Carolina",
+ "University of Wisconsin",
+ "University of Texas",
+ "University of Florida",
+ "University of Washington",
+ "University of Southern California",
+ "New York University",
+ "Cornell University",
+ "Brown University",
+ "Dartmouth College",
+ "Carnegie Mellon University",
+ "Georgetown University",
+ "Rice University",
+ "Vanderbilt University",
+ "Washington University",
+ "Emory University",
+ "University of Notre Dame",
+ "Boston University",
+ "Boston College",
+ "University of Miami",
+ "University of Illinois",
+ "Ohio State University",
+ "Pennsylvania State University",
+ "Purdue University",
+ "Texas A&M University",
+ "Georgia Institute of Technology",
+ "University of Minnesota",
+ "Michigan State University",
+ "Indiana University",
+ "University of Colorado",
+ "University of Arizona",
+ "University of Pittsburgh",
+ "University of Maryland",
+ "Rutgers University",
+ "University of Rochester",
+ "University of Connecticut",
+ "University of Georgia",
+ "University of Iowa",
+ "University of Kansas",
+ "University of Kentucky",
+ "University of Missouri",
+ "University of Nebraska",
+ "University of Tennessee",
+ "University of Utah",
+ "University of Oklahoma",
+ "University of Oregon",
+ "University of South Carolina",
+ "University of Alabama",
+ "University of Central Florida",
+ "University of Houston",
+ "University of Delaware",
+ "University of Mississippi",
+ "University of Arkansas",
+ "Florida State University",
+ "Arizona State University",
+ "Colorado State University",
+ "North Carolina State University",
+ "Iowa State University",
+ "Kansas State University",
+ "Louisiana State University",
+ "Oregon State University",
+ "South Carolina State University",
+ "Virginia Tech",
+ "Auburn University",
+ "Temple University",
+ "University of Massachusetts",
+ "Baylor University",
+ "Southern Methodist University",
+ "Wake Forest University",
+ "George Washington University",
+ "American University",
+ "Villanova University",
+ "Marquette University",
+ "Pepperdine University",
+ "Loyola Marymount University",
+ "Santa Clara University",
+ "Fordham University",
+ "DePaul University",
+ "Syracuse University",
+ "Rensselaer Polytechnic Institute",
+ "Stevens Institute of Technology",
+ "Illinois Institute of Technology",
+ "Clark University",
+ "Tufts University",
+ "Brandeis University",
+ "Case Western Reserve University",
+ "Drexel University",
+ "Lehigh University",
+ "Howard University",
+ "Spelman College",
+ "Morehouse College",
+ "Hampton University",
+ "Xavier University of Louisiana",
+ "Tuskegee University",
+ "Florida A&M University",
+ "Colorado School of Mines"
+ ],
+ "description": "Ensure proper capitalization of major universities in the United States."
+ }
}
diff --git a/packages/harper.js/examples/commonjs-simple/index.js b/packages/harper.js/examples/commonjs-simple/index.js
index 718a2ed7d..d6a09b1b4 100644
--- a/packages/harper.js/examples/commonjs-simple/index.js
+++ b/packages/harper.js/examples/commonjs-simple/index.js
@@ -7,17 +7,17 @@ async function main() {
console.log('Here are the results of linting the above text:');
- for (let lint of lints) {
+ for (const lint of lints) {
console.log(' - ', lint.span().start, ':', lint.span().end, lint.message());
- if (lint.suggestion_count() != 0) {
+ if (lint.suggestion_count() !== 0) {
console.log('Suggestions:');
- for (let sug of lint.suggestions()) {
+ for (const sug of lint.suggestions()) {
console.log(
'\t - ',
sug.kind() == 1 ? 'Remove' : 'Replace with',
- sug.get_replacement_text()
+ sug.get_replacement_text(),
);
}
}
diff --git a/packages/harper.js/package.json b/packages/harper.js/package.json
index 1ff4f27ce..8a59f633b 100644
--- a/packages/harper.js/package.json
+++ b/packages/harper.js/package.json
@@ -40,7 +40,5 @@
"main": "dist/harper.js",
"types": "dist/harper.d.ts",
"sideEffects": false,
- "files": [
- "dist"
- ]
+ "files": ["dist"]
}
diff --git a/packages/harper.js/src/Linter.bench.ts b/packages/harper.js/src/Linter.bench.ts
index 5c8f317e0..e542730fd 100644
--- a/packages/harper.js/src/Linter.bench.ts
+++ b/packages/harper.js/src/Linter.bench.ts
@@ -5,7 +5,7 @@ import { binary } from './binary';
const linters = {
WorkerLinter: WorkerLinter,
- LocalLinter: LocalLinter
+ LocalLinter: LocalLinter,
};
for (const [linterName, Linter] of Object.entries(linters)) {
diff --git a/packages/harper.js/src/Linter.test.ts b/packages/harper.js/src/Linter.test.ts
index 30e5f576e..0ddfba9d9 100644
--- a/packages/harper.js/src/Linter.test.ts
+++ b/packages/harper.js/src/Linter.test.ts
@@ -1,11 +1,11 @@
import { expect, test } from 'vitest';
-import WorkerLinter from './WorkerLinter';
import LocalLinter from './LocalLinter';
+import WorkerLinter from './WorkerLinter';
import { binary } from './binary';
const linters = {
WorkerLinter: WorkerLinter,
- LocalLinter: LocalLinter
+ LocalLinter: LocalLinter,
};
for (const [linterName, Linter] of Object.entries(linters)) {
@@ -23,7 +23,7 @@ for (const [linterName, Linter] of Object.entries(linters)) {
const promises = [
linter.lint('The problem is that that...'),
linter.lint('The problem is...'),
- linter.lint('The the problem is...')
+ linter.lint('The the problem is...'),
];
const results = await Promise.all(promises);
@@ -40,7 +40,7 @@ for (const [linterName, Linter] of Object.entries(linters)) {
const promises = [
linter.lint('The problem is that that...'),
linter.lint('The problem is...'),
- linter.lint('The the problem is...')
+ linter.lint('The the problem is...'),
];
const results = await Promise.all(promises);
@@ -55,7 +55,7 @@ for (const [linterName, Linter] of Object.entries(linters)) {
const linter = new Linter({ binary });
const result = await linter.isLikelyEnglish(
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
);
expect(result).toBeTypeOf('boolean');
diff --git a/packages/harper.js/src/Linter.ts b/packages/harper.js/src/Linter.ts
index d5bc9ddf0..acb7961b9 100644
--- a/packages/harper.js/src/Linter.ts
+++ b/packages/harper.js/src/Linter.ts
@@ -1,6 +1,6 @@
import type { Lint, Span, Suggestion } from 'harper-wasm';
-import { LintConfig, LintOptions } from './main';
-import { BinaryModule } from './binary';
+import type { BinaryModule } from './binary';
+import type { LintConfig, LintOptions } from './main';
/** An interface for an object that can perform linting actions. */
export default interface Linter {
diff --git a/packages/harper.js/src/LocalLinter.ts b/packages/harper.js/src/LocalLinter.ts
index 406ec1be7..4d1abb848 100644
--- a/packages/harper.js/src/LocalLinter.ts
+++ b/packages/harper.js/src/LocalLinter.ts
@@ -1,9 +1,10 @@
import type { Lint, Span, Suggestion, Linter as WasmLinter } from 'harper-wasm';
import { Language } from 'harper-wasm';
import LazyPromise from 'p-lazy';
-import Linter, { LinterInit } from './Linter';
-import { LintConfig, LintOptions } from './main';
-import { BinaryModule } from './binary';
+import type Linter from './Linter';
+import type { LinterInit } from './Linter';
+import type { BinaryModule } from './binary';
+import type { LintConfig, LintOptions } from './main';
/** A Linter that runs in the current JavaScript context (meaning it is allowed to block the event loop). */
export default class LocalLinter implements Linter {
diff --git a/packages/harper.js/src/WorkerLinter/index.ts b/packages/harper.js/src/WorkerLinter/index.ts
index 040a81825..291722224 100644
--- a/packages/harper.js/src/WorkerLinter/index.ts
+++ b/packages/harper.js/src/WorkerLinter/index.ts
@@ -1,8 +1,9 @@
-import type { Lint, Suggestion, Span } from 'harper-wasm';
-import Linter, { LinterInit } from '../Linter';
+import type { Lint, Span, Suggestion } from 'harper-wasm';
+import type Linter from '../Linter';
+import type { LinterInit } from '../Linter';
+import type { BinaryModule, DeserializedRequest } from '../binary';
+import type { LintConfig, LintOptions } from '../main';
import Worker from './worker.ts?worker&inline';
-import { LintConfig, LintOptions } from '../main';
-import { BinaryModule, DeserializedRequest } from '../binary';
/** The data necessary to complete a request once the worker has responded. */
export interface RequestItem {
@@ -144,7 +145,7 @@ export default class WorkerLinter implements Linter {
this.requestQueue.push({
resolve,
reject,
- request: { procName, args }
+ request: { procName, args },
});
this.submitRemainingRequests();
diff --git a/packages/harper.js/src/WorkerLinter/worker.ts b/packages/harper.js/src/WorkerLinter/worker.ts
index 4a18dec01..46a5dd9ac 100644
--- a/packages/harper.js/src/WorkerLinter/worker.ts
+++ b/packages/harper.js/src/WorkerLinter/worker.ts
@@ -1,7 +1,7 @@
/// <reference lib="webworker" />
import './shims';
-import { isSerializedRequest, SerializedRequest, BinaryModule } from '../binary';
import LocalLinter from '../LocalLinter';
+import { BinaryModule, type SerializedRequest, isSerializedRequest } from '../binary';
// Notify the main thread that we are ready
self.postMessage('ready');
diff --git a/packages/harper.js/src/binary.test.ts b/packages/harper.js/src/binary.test.ts
index 5f192bafe..e07ef6ed6 100644
--- a/packages/harper.js/src/binary.test.ts
+++ b/packages/harper.js/src/binary.test.ts
@@ -1,5 +1,5 @@
-import { expect, test } from 'vitest';
import { Span } from 'harper-wasm';
+import { expect, test } from 'vitest';
import LocalLinter from './LocalLinter';
import { binary } from './binary';
diff --git a/packages/harper.js/src/binary.ts b/packages/harper.js/src/binary.ts
index 4a2142fda..742cc258a 100644
--- a/packages/harper.js/src/binary.ts
+++ b/packages/harper.js/src/binary.ts
@@ -1,10 +1,10 @@
-import { default as binaryUrl } from 'harper-wasm/harper_wasm_bg.wasm?no-inline';
-import { default as binaryInlinedUrl } from 'harper-wasm/harper_wasm_bg.wasm?inline';
import type { InitInput, Span, Suggestion, Linter as WasmLinter } from 'harper-wasm';
-import pMemoize from 'p-memoize';
+import { default as binaryInlinedUrl } from 'harper-wasm/harper_wasm_bg.wasm?inline';
+import { default as binaryUrl } from 'harper-wasm/harper_wasm_bg.wasm?no-inline';
import LazyPromise from 'p-lazy';
+import pMemoize from 'p-memoize';
+import type { LintConfig } from './main';
import { assert } from './utils';
-import { LintConfig } from './main';
export const loadBinary = pMemoize(async (binary: string) => {
const exports = await import('harper-wasm');
@@ -72,7 +72,7 @@ export class BinaryModule {
constructor(url: string | URL) {
this.url = url;
this.inner = LazyPromise.from(() =>
- loadBinary(typeof this.url === 'string' ? this.url : this.url.href)
+ loadBinary(typeof this.url === 'string' ? this.url : this.url.href),
);
}
@@ -112,7 +112,7 @@ export class BinaryModule {
if (Array.isArray(arg)) {
return {
json: JSON.stringify(await Promise.all(arg.map((a) => this.serializeArg(a)))),
- type: 'Array'
+ type: 'Array',
};
}
@@ -150,7 +150,7 @@ export class BinaryModule {
async serialize(req: DeserializedRequest): Promise<SerializedRequest> {
return {
procName: req.procName,
- args: await Promise.all(req.args.map((arg) => this.serializeArg(arg)))
+ args: await Promise.all(req.args.map((arg) => this.serializeArg(arg))),
};
}
@@ -183,7 +183,7 @@ export class BinaryModule {
async deserialize(request: SerializedRequest): Promise<DeserializedRequest> {
return {
procName: request.procName,
- args: await Promise.all(request.args.map((arg) => this.deserializeArg(arg)))
+ args: await Promise.all(request.args.map((arg) => this.deserializeArg(arg))),
};
}
}
diff --git a/packages/harper.js/src/main.ts b/packages/harper.js/src/main.ts
index d76dd4b3f..a9b2faca8 100644
--- a/packages/harper.js/src/main.ts
+++ b/packages/harper.js/src/main.ts
@@ -11,7 +11,7 @@ export {
BinaryModule,
binary,
binaryInlined,
- isSerializedRequest
+ isSerializedRequest,
} from './binary';
/** A linting rule configuration dependent on upstream Harper's available rules.
diff --git a/packages/harper.js/vite.config.ts b/packages/harper.js/vite.config.ts
index 5982a349a..f8cf71d0d 100644
--- a/packages/harper.js/vite.config.ts
+++ b/packages/harper.js/vite.config.ts
@@ -1,8 +1,8 @@
/// <reference types="vitest" />
import { resolve } from 'path';
+import { type Plugin, defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import apiExtractorConfig from './api-extractor.json';
-import { defineConfig, type Plugin } from 'vite';
function removeAssetsPlugin(options: { test: RegExp }): Plugin {
return {
@@ -13,7 +13,7 @@ function removeAssetsPlugin(options: { test: RegExp }): Plugin {
delete bundle[file];
}
}
- }
+ },
};
}
@@ -21,9 +21,9 @@ export default defineConfig({
build: {
lib: {
entry: resolve(__dirname, 'src/main.ts'),
- fileName: `harper`,
+ fileName: 'harper',
name: 'harper',
- formats: ['es']
+ formats: ['es'],
},
minify: false,
assetsInlineLimit: 0,
@@ -31,35 +31,35 @@ export default defineConfig({
external: [/^node:/, 'fs'],
output: {
minifyInternalExports: false,
- inlineDynamicImports: true
+ inlineDynamicImports: true,
},
treeshake: {
moduleSideEffects: false,
- propertyReadSideEffects: false
- }
- }
+ propertyReadSideEffects: false,
+ },
+ },
},
base: './',
plugins: [
dts({
...apiExtractorConfig,
rollupTypes: true,
- tsconfigPath: './tsconfig.json'
- })
+ tsconfigPath: './tsconfig.json',
+ }),
],
worker: {
format: 'es',
plugins: () => [removeAssetsPlugin({ test: /\.wasm$/ })],
rollupOptions: {
output: {
- inlineDynamicImports: true
- }
- }
+ inlineDynamicImports: true,
+ },
+ },
},
server: {
fs: {
- allow: ['../../harper-wasm/pkg']
- }
+ allow: ['../../harper-wasm/pkg'],
+ },
},
test: {
retry: process.env.CI ? 5 : 0,
@@ -69,10 +69,10 @@ export default defineConfig({
headless: true,
screenshotFailures: false,
instances: [
- { browser: 'chromium' }
+ { browser: 'chromium' },
// { browser: 'firefox' },
- ]
- }
+ ],
+ },
},
- assetsInclude: ['**/*.wasm']
+ assetsInclude: ['**/*.wasm'],
});
diff --git a/packages/obsidian-plugin/rollup.config.mjs b/packages/obsidian-plugin/rollup.config.mjs
index ab7345270..195c081e5 100644
--- a/packages/obsidian-plugin/rollup.config.mjs
+++ b/packages/obsidian-plugin/rollup.config.mjs
@@ -1,23 +1,23 @@
-import { wasm } from '@rollup/plugin-wasm';
+import { nodeResolve } from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
+import { wasm } from '@rollup/plugin-wasm';
import external from 'rollup-plugin-peer-deps-external';
-import { nodeResolve } from '@rollup/plugin-node-resolve';
import svg from 'rollup-plugin-svg-import';
export default {
input: 'src/index.ts',
output: {
file: 'main.js',
- format: 'cjs'
+ format: 'cjs',
},
external: ['obsidian', 'electron'],
plugins: [
svg({
- stringify: true
+ stringify: true,
}),
external(),
wasm({ maxFileSize: Math.pow(2, 32), publicPath: './' }),
nodeResolve(),
- typescript({ compilerOptions: { lib: ['es5', 'es6', 'dom'], target: 'es5' } })
- ]
+ typescript({ compilerOptions: { lib: ['es5', 'es6', 'dom'], target: 'es5' } }),
+ ],
};
diff --git a/packages/obsidian-plugin/src/HarperSettingTab.ts b/packages/obsidian-plugin/src/HarperSettingTab.ts
index 318b61118..650cdaa90 100644
--- a/packages/obsidian-plugin/src/HarperSettingTab.ts
+++ b/packages/obsidian-plugin/src/HarperSettingTab.ts
@@ -1,7 +1,8 @@
import './index.js';
import { startCase } from 'lodash-es';
-import { App, PluginSettingTab, Setting } from 'obsidian';
-import HarperPlugin, { Settings } from './index.js';
+import { type App, PluginSettingTab, Setting } from 'obsidian';
+import type HarperPlugin from './index.js';
+import type { Settings } from './index.js';
export class HarperSettingTab extends PluginSettingTab {
private plugin: HarperPlugin;
@@ -34,7 +35,7 @@ export class HarperSettingTab extends PluginSettingTab {
toggle.setValue(this.settings.useWebWorker).onChange(async (value) => {
this.settings.useWebWorker = value;
await this.plugin.initializeFromSettings(this.settings);
- })
+ }),
);
for (const setting of Object.keys(this.settings.lintSettings)) {
@@ -53,7 +54,7 @@ export class HarperSettingTab extends PluginSettingTab {
.onChange(async (value) => {
this.settings.lintSettings[setting] = stringToValue(value);
await this.plugin.initializeFromSettings(this.settings);
- })
+ }),
);
}
diff --git a/packages/obsidian-plugin/src/index.ts b/packages/obsidian-plugin/src/index.ts
index 348eed14a..534170a77 100644
--- a/packages/obsidian-plugin/src/index.ts
+++ b/packages/obsidian-plugin/src/index.ts
@@ -1,11 +1,11 @@
+import type { Extension } from '@codemirror/state';
+import type { LintConfig, Linter, Suggestion } from 'harper.js';
+import { LocalLinter, SuggestionKind, WorkerLinter, binary } from 'harper.js';
import { toArray } from 'lodash-es';
+import { type App, Menu, Notice, Plugin, type PluginManifest } from 'obsidian';
import logoSvg from '../logo.svg';
-import { Plugin, Menu, PluginManifest, App, Notice } from 'obsidian';
-import { LintConfig, Linter, Suggestion } from 'harper.js';
-import { LocalLinter, SuggestionKind, WorkerLinter, binary } from 'harper.js';
-import { linter } from './lint';
-import { Extension } from '@codemirror/state';
import { HarperSettingTab } from './HarperSettingTab';
+import { linter } from './lint';
function suggestionToLabel(sug: Suggestion) {
if (sug.kind() == SuggestionKind.Remove) {
@@ -83,7 +83,7 @@ export default class HarperPlugin extends Plugin {
ignoredLints: await this.harper.exportIgnoredLints(),
useWebWorker: usingWebWorker,
lintSettings: await this.harper.getLintConfig(),
- userDictionary: await this.harper.exportWords()
+ userDictionary: await this.harper.exportWords(),
};
}
@@ -125,7 +125,7 @@ export default class HarperPlugin extends Plugin {
.setIcon('documents')
.onClick(() => {
this.toggleAutoLint();
- })
+ }),
);
menu.showAtMouseEvent(event);
@@ -138,7 +138,7 @@ export default class HarperPlugin extends Plugin {
this.addCommand({
id: 'harper-toggle-auto-lint',
name: 'Toggle automatic grammar checking',
- callback: () => this.toggleAutoLint()
+ callback: () => this.toggleAutoLint(),
});
}
@@ -193,27 +193,27 @@ export default class HarperPlugin extends Plugin {
changes: {
from: span.start,
to: span.end,
- insert: ''
- }
+ insert: '',
+ },
});
} else if (sug.kind() === SuggestionKind.Replace) {
view.dispatch({
changes: {
from: span.start,
to: span.end,
- insert: sug.get_replacement_text()
- }
+ insert: sug.get_replacement_text(),
+ },
});
} else if (sug.kind() === SuggestionKind.InsertAfter) {
view.dispatch({
changes: {
from: span.end,
to: span.end,
- insert: sug.get_replacement_text()
- }
+ insert: sug.get_replacement_text(),
+ },
});
}
- }
+ },
};
});
@@ -225,7 +225,7 @@ export default class HarperPlugin extends Plugin {
apply: (view) => {
this.harper.importWords([word]);
this.reinitialize();
- }
+ },
});
}
@@ -239,13 +239,13 @@ export default class HarperPlugin extends Plugin {
await this.harper.ignoreLint(lint);
await this.reinitialize();
},
- actions
+ actions,
};
});
},
{
- delay: -1
- }
+ delay: -1,
+ },
);
}
}
diff --git a/packages/obsidian-plugin/src/lint.ts b/packages/obsidian-plugin/src/lint.ts
index 544be37e7..13255773c 100644
--- a/packages/obsidian-plugin/src/lint.ts
+++ b/packages/obsidian-plugin/src/lint.ts
@@ -1,25 +1,25 @@
import {
+ type EditorState,
+ type Extension,
+ Facet,
+ RangeSet,
+ StateEffect,
+ StateField,
+ type Transaction,
+ type TransactionSpec,
+ combineConfig,
+} from '@codemirror/state';
+import {
+ Decoration,
+ type DecorationSet,
EditorView,
+ type Tooltip,
ViewPlugin,
- Decoration,
- DecorationSet,
+ type ViewUpdate,
WidgetType,
- ViewUpdate,
- logException,
hoverTooltip,
- Tooltip
+ logException,
} from '@codemirror/view';
-import {
- StateEffect,
- StateField,
- Extension,
- TransactionSpec,
- Transaction,
- EditorState,
- Facet,
- combineConfig,
- RangeSet
-} from '@codemirror/state';
import elt from 'crelt';
type Severity = 'hint' | 'info' | 'warning' | 'error';
@@ -96,14 +96,14 @@ class SelectedDiagnostic {
constructor(
readonly from: number,
readonly to: number,
- readonly diagnostic: Diagnostic
+ readonly diagnostic: Diagnostic,
) {}
}
class LintState {
constructor(
readonly diagnostics: DecorationSet,
- readonly selected: SelectedDiagnostic | null
+ readonly selected: SelectedDiagnostic | null,
) {}
static init(diagnostics: readonly Diagnostic[], state: EditorState) {
@@ -118,17 +118,19 @@ class LintState {
return d.from == d.to || (d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from)
? Decoration.widget({
widget: new DiagnosticWidget(d),
- diagnostic: d
+ diagnostic: d,
}).range(d.from)
: Decoration.mark({
attributes: {
class:
- 'cm-lintRange cm-lintRange-' + d.severity + (d.markClass ? ' ' + d.markClass : '')
+ 'cm-lintRange cm-lintRange-' +
+ d.severity +
+ (d.markClass ? ' ' + d.markClass : ''),
},
- diagnostic: d
+ diagnostic: d,
}).range(d.from, d.to);
}),
- true
+ true,
);
return new LintState(ranges, findDiagnostic(ranges));
}
@@ -137,7 +139,7 @@ class LintState {
function findDiagnostic(
diagnostics: DecorationSet,
diagnostic: Diagnostic | null = null,
- after = 0
+ after = 0,
): SelectedDiagnostic | null {
let found: SelectedDiagnostic | null = null;
diagnostics.between(after, 1e9, (from, to, { spec }) => {
@@ -171,10 +173,10 @@ function maybeEnableLint(state: EditorState, effects: readonly StateEffect<unkno
/// active.
export function setDiagnostics(
state: EditorState,
- diagnostics: readonly Diagnostic[]
+ diagnostics: readonly Diagnostic[],
): TransactionSpec {
return {
- effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)])
+ effects: maybeEnableLint(state, [setDiagnosticsEffect.of(diagnostics)]),
};
}
@@ -211,7 +213,7 @@ const lintState = StateField.define<LintState>({
return value;
},
- provide: (f) => [EditorView.decorations.from(f, (s) => s.diagnostics)]
+ provide: (f) => [EditorView.decorations.from(f, (s) => s.diagnostics)],
});
const activeMark = Decoration.mark({ class: 'cm-lintRange cm-lintRange-active' });
@@ -244,7 +246,7 @@ function lintTooltip(view: EditorView, pos: number, side: -1 | 1) {
above: view.state.doc.lineAt(stackStart).to < stackEnd,
create() {
return { dom: diagnosticsTooltip(view, found) };
- }
+ },
};
}
@@ -252,13 +254,13 @@ function diagnosticsTooltip(view: EditorView, diagnostics: readonly Diagnostic[]
return elt(
'ul',
{ class: 'cm-tooltip-lint' },
- diagnostics.map((d) => renderDiagnostic(view, d, false))
+ diagnostics.map((d) => renderDiagnostic(view, d, false)),
);
}
/// The type of a function that produces diagnostics.
export type LintSource = (
- view: EditorView
+ view: EditorView,
) => readonly Diagnostic[] | Promise<readonly Diagnostic[]>;
const lintPlugin = ViewPlugin.fromClass(
@@ -292,7 +294,7 @@ const lintPlugin = ViewPlugin.fromClass(
},
(error) => {
logException(this.view.state, error);
- }
+ },
);
}
}
@@ -322,7 +324,7 @@ const lintPlugin = ViewPlugin.fromClass(
destroy() {
clearTimeout(this.timeout);
}
- }
+ },
);
const lintConfig = Facet.define<
@@ -339,14 +341,14 @@ const lintConfig = Facet.define<
markerFilter: null,
tooltipFilter: null,
needsRefresh: null,
- hideOn: () => null
+ hideOn: () => null,
},
{
- needsRefresh: (a, b) => (!a ? b : !b ? a : (u) => a(u) || b(u))
- }
- )
+ needsRefresh: (a, b) => (!a ? b : !b ? a : (u) => a(u) || b(u)),
+ },
+ ),
};
- }
+ },
});
/// Given a diagnostic source, this function returns an extension that
@@ -389,7 +391,7 @@ function renderDiagnostic(view: EditorView, diagnostic: Diagnostic, inPanel: boo
elt(
'span',
{ class: 'cm-diagnosticText' },
- diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message
+ diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message,
),
diagnostic.actions?.map((action, i) => {
let fired = false;
@@ -408,7 +410,7 @@ function renderDiagnostic(view: EditorView, diagnostic: Diagnostic, inPanel: boo
: [
name.slice(0, keyIndex),
elt('u', name.slice(keyIndex, keyIndex + 1)),
- name.slice(keyIndex + 1)
+ name.slice(keyIndex + 1),
];
return elt(
'button',
@@ -417,9 +419,9 @@ function renderDiagnostic(view: EditorView, diagnostic: Diagnostic, inPanel: boo
class: 'cm-diagnosticAction',
onclick: click,
onmousedown: click,
- 'aria-label': ` Action: ${name}${keyIndex < 0 ? '' : ` (access key "${keys[i]})"`}.`
+ 'aria-label': ` Action: ${name}${keyIndex < 0 ? '' : ` (access key "${keys[i]})"`}.`,
},
- nameElt
+ nameElt,
);
}),
diagnostic.ignore &&
@@ -432,11 +434,11 @@ function renderDiagnostic(view: EditorView, diagnostic: Diagnostic, inPanel: boo
if (diagnostic.ignore) {
diagnostic.ignore();
}
- }
+ },
},
- 'Ignore Diagnostic'
+ 'Ignore Diagnostic',
),
- diagnostic.source && elt('div', { class: 'cm-diagnosticSource' }, diagnostic.source)
+ diagnostic.source && elt('div', { class: 'cm-diagnosticSource' }, diagnostic.source),
);
}
@@ -461,7 +463,7 @@ function svg(content: string, attrs = `viewBox="0 0 40 40"`) {
function underline(color: string) {
return svg(
`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${color}" fill="none" stroke-width="1"/>`,
- `width="6" height="3"`
+ `width="6" height="3"`,
);
}
@@ -471,17 +473,17 @@ const baseTheme = EditorView.baseTheme({
marginLeft: '0px',
display: 'flex',
flexDirection: 'column',
- whiteSpace: 'pre-wrap'
+ whiteSpace: 'pre-wrap',
},
'.cm-diagnosticTitle': {
boxShadow: 'inset 0 -2px #DB2B39',
width: 'max-content',
- fontWeight: 'bold'
+ fontWeight: 'bold',
},
'.cm-diagnosticText': {
- marginTop: '8px'
+ marginTop: '8px',
},
'.cm-diagnosticAction': {
@@ -496,7 +498,7 @@ const baseTheme = EditorView.baseTheme({
fontSize: 'var(--font-ui-small)',
borderRadius: 'var(--radius-s)',
whiteSpace: 'nowrap',
- width: '100%'
+ width: '100%',
},
'.cm-tooltip': {
@@ -508,27 +510,27 @@ const baseTheme = EditorView.baseTheme({
zIndex: 'var(--layer-menu) !important',
userSelect: 'none !important',
maxHeight: 'calc(100% - var(--header-height)) !important',
- overflow: 'hidden !important'
+ overflow: 'hidden !important',
},
'.cm-diagnosticSource': {
fontSize: '70%',
- opacity: 0.7
+ opacity: 0.7,
},
'.cm-diagnosticIgnore': {
padding: 'var(--size-4-1) 0px',
- fontSize: 'var(--font-ui-small)'
+ fontSize: 'var(--font-ui-small)',
},
'.cm-diagnosticIgnore:hover': {
- textDecoration: 'underline'
+ textDecoration: 'underline',
},
'.cm-lintRange': {
backgroundPosition: 'left bottom',
backgroundRepeat: 'repeat-x',
- paddingBottom: '0.7px'
+ paddingBottom: '0.7px',
},
'.cm-lintRange-error': { backgroundImage: underline('#d11') },
@@ -539,7 +541,7 @@ const baseTheme = EditorView.baseTheme({
'.cm-tooltip-lint': {
padding: 0,
- margin: 0
+ margin: 0,
},
'.cm-lintPoint': {
@@ -552,18 +554,18 @@ const baseTheme = EditorView.baseTheme({
left: '-2px',
borderLeft: '3px solid transparent',
borderRight: '3px solid transparent',
- borderBottom: '4px solid #d11'
- }
+ borderBottom: '4px solid #d11',
+ },
},
'.cm-lintPoint-warning': {
- '&:after': { borderBottomColor: 'orange' }
+ '&:after': { borderBottomColor: 'orange' },
},
'.cm-lintPoint-info': {
- '&:after': { borderBottomColor: '#999' }
+ '&:after': { borderBottomColor: '#999' },
},
'.cm-lintPoint-hint': {
- '&:after': { borderBottomColor: '#66d' }
+ '&:after': { borderBottomColor: '#66d' },
},
'.cm-panel.cm-panel-lint': {
@@ -573,17 +575,17 @@ const baseTheme = EditorView.baseTheme({
overflowY: 'auto',
'& [aria-selected]': {
backgroundColor: '#ddd',
- '& u': { textDecoration: 'underline' }
+ '& u': { textDecoration: 'underline' },
},
'&:focus [aria-selected]': {
background_fallback: '#bdf',
backgroundColor: 'Highlight',
color_fallback: 'white',
- color: 'HighlightText'
+ color: 'HighlightText',
},
'& u': { textDecoration: 'none' },
padding: 0,
- margin: 0
+ margin: 0,
},
'& [name=close]': {
position: 'absolute',
@@ -593,9 +595,9 @@ const baseTheme = EditorView.baseTheme({
border: 'none',
font: 'inherit',
padding: 0,
- margin: 0
- }
- }
+ margin: 0,
+ },
+ },
});
const lintExtensions = [
@@ -607,7 +609,7 @@ const lintExtensions = [
: Decoration.set([activeMark.range(selected.from, selected.to)]);
}),
hoverTooltip(lintTooltip, { hideOn: hideTooltip }),
- baseTheme
+ baseTheme,
];
/// Iterate over the marked diagnostics for the given editor state,
@@ -617,7 +619,7 @@ const lintExtensions = [
/// arguments hold the diagnostic's current position.
export function forEachDiagnostic(
state: EditorState,
- f: (d: Diagnostic, from: number, to: number) => void
+ f: (d: Diagnostic, from: number, to: number) => void,
) {
const lState = state.field(lintState, false);
if (lState && lState.diagnostics.size)
diff --git a/packages/vscode-plugin/esbuild.cjs b/packages/vscode-plugin/esbuild.cjs
index c7a7af345..95e4c81db 100644
--- a/packages/vscode-plugin/esbuild.cjs
+++ b/packages/vscode-plugin/esbuild.cjs
@@ -20,7 +20,7 @@ const esbuildProblemMatcherPlugin = {
});
console.log('[watch] build finished');
});
- }
+ },
};
async function main() {
@@ -37,8 +37,8 @@ async function main() {
logLevel: 'silent',
plugins: [
/* Add to the end of plugins array */
- esbuildProblemMatcherPlugin
- ]
+ esbuildProblemMatcherPlugin,
+ ],
});
if (watch) {
await ctx.watch();
diff --git a/packages/vscode-plugin/src/extension.ts b/packages/vscode-plugin/src/extension.ts
index 4a7f26651..ed9dba522 100644
--- a/packages/vscode-plugin/src/extension.ts
+++ b/packages/vscode-plugin/src/extension.ts
@@ -1,7 +1,7 @@
import type { ExtensionContext } from 'vscode';
import type { Executable, LanguageClientOptions } from 'vscode-languageclient/node';
-import { commands, Uri, window, workspace } from 'vscode';
+import { Uri, commands, window, workspace } from 'vscode';
import { LanguageClient, ResponseError, TransportKind } from 'vscode-languageclient/node';
// There's no publicly available extension manifest type except for the internal one from VSCode's
@@ -22,7 +22,7 @@ export async function activate(context: ExtensionContext): Promise<void> {
let manifest: ExtensionManifest;
try {
manifest = JSON.parse(
- (await workspace.fs.readFile(Uri.joinPath(context.extensionUri, 'package.json'))).toString()
+ (await workspace.fs.readFile(Uri.joinPath(context.extensionUri, 'package.json'))).toString(),
);
} catch (error) {
showError('Failed to read manifest file', error);
@@ -47,14 +47,14 @@ export async function activate(context: ExtensionContext): Promise<void> {
if (configs.find((c) => event.affectsConfiguration(c))) {
await client?.sendNotification('workspace/didChangeConfiguration', {
- settings: { 'harper-ls': workspace.getConfiguration('harper') }
+ settings: { 'harper-ls': workspace.getConfiguration('harper') },
});
}
- })
+ }),
);
context.subscriptions.push(
- commands.registerCommand('harper.languageserver.restart', startLanguageServer)
+ commands.registerCommand('harper.languageserver.restart', startLanguageServer),
);
await startLanguageServer();
@@ -70,7 +70,7 @@ function getExecutablePath(context: ExtensionContext): string {
return Uri.joinPath(
context.extensionUri,
'bin',
- `harper-ls${process.platform === 'win32' ? '.exe' : ''}`
+ `harper-ls${process.platform === 'win32' ? '.exe' : ''}`,
).fsPath;
}
@@ -100,7 +100,7 @@ async function startLanguageServer(): Promise<void> {
}
return [{ 'harper-ls': response[0].harper }];
- }
+ },
};
await client.start();
@@ -122,7 +122,7 @@ function showError(message: string, error: Error | unknown): void {
clientOptions.outputChannel?.appendLine(message);
clientOptions.outputChannel?.appendLine(info);
clientOptions.outputChannel?.appendLine(
- 'If the issue persists, please report at https://github.com/automattic/harper/issues'
+ 'If the issue persists, please report at https://github.com/automattic/harper/issues',
);
clientOptions.outputChannel?.appendLine('---');
clientOptions.outputChannel?.show();
diff --git a/packages/vscode-plugin/src/tests/runTests.ts b/packages/vscode-plugin/src/tests/runTests.ts
index 19cd34495..947acc9c7 100644
--- a/packages/vscode-plugin/src/tests/runTests.ts
+++ b/packages/vscode-plugin/src/tests/runTests.ts
@@ -1,5 +1,5 @@
-import { runTests } from '@vscode/test-electron';
import path from 'node:path';
+import { runTests } from '@vscode/test-electron';
(async () => {
try {
@@ -8,8 +8,8 @@ import path from 'node:path';
extensionTestsPath: path.join(__dirname, 'suite'),
launchArgs: [
'--disable-extensions',
- path.join(__dirname, '..', '..', 'src', 'tests', 'fixtures')
- ]
+ path.join(__dirname, '..', '..', 'src', 'tests', 'fixtures'),
+ ],
});
} catch (error) {
console.error('Failed to run tests', error);
diff --git a/packages/vscode-plugin/src/tests/suite/helper.ts b/packages/vscode-plugin/src/tests/suite/helper.ts
index aa5904ae3..ce7c731aa 100644
--- a/packages/vscode-plugin/src/tests/suite/helper.ts
+++ b/packages/vscode-plugin/src/tests/suite/helper.ts
@@ -2,13 +2,13 @@ import type { Diagnostic, Extension } from 'vscode';
import {
DiagnosticSeverity,
- extensions,
- languages,
Position,
Range,
Uri,
+ extensions,
+ languages,
window,
- workspace
+ workspace,
} from 'vscode';
export async function activateHarper(): Promise<Extension<void>> {
@@ -39,7 +39,7 @@ export function createExpectedDiagnostics(
export function compareActualVsExpectedDiagnostics(
actual: Diagnostic[],
- expected: Diagnostic[]
+ expected: Diagnostic[],
): void {
expect(actual.length).toBe(expected.length);
for (let i = 0; i < actual.length; i++) {
@@ -54,7 +54,7 @@ export function createRange(
startRow: number,
startColumn: number,
endRow: number,
- endColumn: number
+ endColumn: number,
): Range {
return new Range(new Position(startRow, startColumn), new Position(endRow, endColumn));
}
diff --git a/packages/vscode-plugin/src/tests/suite/index.ts b/packages/vscode-plugin/src/tests/suite/index.ts
index 0e7c6c002..391b6f449 100644
--- a/packages/vscode-plugin/src/tests/suite/index.ts
+++ b/packages/vscode-plugin/src/tests/suite/index.ts
@@ -1,5 +1,5 @@
-import Jasmine from 'jasmine';
import path from 'node:path';
+import Jasmine from 'jasmine';
export async function run(): Promise<void> {
const jasmine = new Jasmine();
@@ -7,7 +7,7 @@ export async function run(): Promise<void> {
jasmine.loadConfig({
spec_dir: path.relative(process.cwd(), __dirname),
spec_files: ['*.test.js'],
- random: false
+ random: false,
});
const result = await jasmine.execute();
diff --git a/packages/vscode-plugin/src/tests/suite/integration.test.ts b/packages/vscode-plugin/src/tests/suite/integration.test.ts
index f51cc1fa3..ddec7cad8 100644
--- a/packages/vscode-plugin/src/tests/suite/integration.test.ts
+++ b/packages/vscode-plugin/src/tests/suite/integration.test.ts
@@ -1,6 +1,6 @@
import type { Extension } from 'vscode';
-import { commands, ConfigurationTarget, Uri, workspace } from 'vscode';
+import { ConfigurationTarget, type Uri, commands, workspace } from 'vscode';
import {
activateHarper,
@@ -9,7 +9,7 @@ import {
createRange,
getActualDiagnostics,
openFile,
- sleep
+ sleep,
} from './helper';
describe('Integration >', () => {
@@ -34,13 +34,13 @@ describe('Integration >', () => {
createExpectedDiagnostics(
{
message: 'Did you mean to repeat this word?',
- range: createRange(2, 39, 2, 48)
+ range: createRange(2, 39, 2, 48),
},
{
message: 'Did you mean to spell “errorz” this way?',
- range: createRange(2, 26, 2, 32)
- }
- )
+ range: createRange(2, 26, 2, 32),
+ },
+ ),
);
});
@@ -54,8 +54,8 @@ describe('Integration >', () => {
getActualDiagnostics(markdownUri),
createExpectedDiagnostics({
message: 'Did you mean to spell “errorz” this way?',
- range: createRange(2, 26, 2, 32)
- })
+ range: createRange(2, 26, 2, 32),
+ }),
);
// Set config back to default value
@@ -73,7 +73,7 @@ describe('Integration >', () => {
compareActualVsExpectedDiagnostics(
getActualDiagnostics(markdownUri),
- createExpectedDiagnostics()
+ createExpectedDiagnostics(),
);
// Restore and reopen deleted file
@@ -89,7 +89,7 @@ describe('Integration >', () => {
compareActualVsExpectedDiagnostics(
getActualDiagnostics(markdownUri),
- createExpectedDiagnostics()
+ createExpectedDiagnostics(),
);
// Restore and reopen deleted file
diff --git a/packages/vscode-plugin/src/tests/suite/languages.test.ts b/packages/vscode-plugin/src/tests/suite/languages.test.ts
index 87f780e88..8a49801d5 100644
--- a/packages/vscode-plugin/src/tests/suite/languages.test.ts
+++ b/packages/vscode-plugin/src/tests/suite/languages.test.ts
@@ -5,7 +5,7 @@ import {
createRange,
getActualDiagnostics,
openFile,
- sleep
+ sleep,
} from './helper';
describe('Languages >', () => {
@@ -51,7 +51,7 @@ describe('Languages >', () => {
{ type: 'Shellscript with .sh extension', file: 'shellscript.sh', row: 0, column: 22 },
{ type: 'Swift', file: 'swift.swift', row: 9, column: 26 },
{ type: 'TypeScript', file: 'typescript.ts', row: 0, column: 32 },
- { type: 'TypeScript JSX', file: 'typescriptreact.tsx', row: 3, column: 7 }
+ { type: 'TypeScript JSX', file: 'typescriptreact.tsx', row: 3, column: 7 },
].forEach((testCase) => {
it(`gives correct diagnostics for ${testCase.type} files`, async () => {
const uri = await openFile('languages', testCase.file);
@@ -63,8 +63,8 @@ describe('Languages >', () => {
getActualDiagnostics(uri),
createExpectedDiagnostics({
message: 'Did you mean to spell “Errorz” this way?',
- range: createRange(testCase.row, testCase.column, testCase.row, testCase.column + 6)
- })
+ range: createRange(testCase.row, testCase.column, testCase.row, testCase.column + 6),
+ }),
);
});
});
diff --git a/packages/web/postcss.config.js b/packages/web/postcss.config.js
index 0f7721681..7b75c83af 100644
--- a/packages/web/postcss.config.js
+++ b/packages/web/postcss.config.js
@@ -1,6 +1,6 @@
export default {
plugins: {
tailwindcss: {},
- autoprefixer: {}
- }
+ autoprefixer: {},
+ },
};
diff --git a/packages/web/src/app.css b/packages/web/src/app.css
index 99f33f1c9..c7f84571f 100644
--- a/packages/web/src/app.css
+++ b/packages/web/src/app.css
@@ -49,12 +49,12 @@
}
code {
- font-family: 'JetBrains Mono' !important;
+ font-family: "JetBrains Mono" !important;
word-break: keep-all;
}
code * {
- font-family: 'JetBrains Mono' !important;
+ font-family: "JetBrains Mono" !important;
}
.underlinespecial {
@@ -66,7 +66,7 @@ code * {
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
- content: '';
+ content: "";
display: block;
width: 100%;
height: var(--line-width);
@@ -105,10 +105,10 @@ textarea {
top: 6px !important;
}
-th[align='center'] {
+th[align="center"] {
text-align: center;
}
-th[align='right'] {
+th[align="right"] {
text-align: right;
}
diff --git a/packages/web/src/lib/AutomatticLogo.svelte b/packages/web/src/lib/AutomatticLogo.svelte
index 6bdd28132..c236e62e0 100644
--- a/packages/web/src/lib/AutomatticLogo.svelte
+++ b/packages/web/src/lib/AutomatticLogo.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- export let width = '100%';
- export let height = '100%';
+export let width = '100%';
+export let height = '100%';
</script>
<svg
diff --git a/packages/web/src/lib/CheckMark.svelte b/packages/web/src/lib/CheckMark.svelte
index 40cdf2ad3..ee364c1e9 100644
--- a/packages/web/src/lib/CheckMark.svelte
+++ b/packages/web/src/lib/CheckMark.svelte
@@ -1,8 +1,8 @@
<script lang="ts">
- import { draw } from 'svelte/transition';
+import { draw } from 'svelte/transition';
- export let width = '100%';
- export let height = '100%';
+export let width = '100%';
+export let height = '100%';
</script>
<svg
diff --git a/packages/web/src/lib/CodeLogo.svelte b/packages/web/src/lib/CodeLogo.svelte
index 330ec2207..74eea8dc2 100644
--- a/packages/web/src/lib/CodeLogo.svelte
+++ b/packages/web/src/lib/CodeLogo.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- export let width = '100%';
- export let height = '100%';
+export let width = '100%';
+export let height = '100%';
</script>
<svg {width} {height} viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
diff --git a/packages/web/src/lib/DefaultNeovimConfig.svelte b/packages/web/src/lib/DefaultNeovimConfig.svelte
index 93dc821a7..2e5a69e81 100644
--- a/packages/web/src/lib/DefaultNeovimConfig.svelte
+++ b/packages/web/src/lib/DefaultNeovimConfig.svelte
@@ -1,34 +1,34 @@
<script>
- import { LocalLinter, binary } from 'harper.js';
- import { Button } from 'flowbite-svelte';
+import { Button } from 'flowbite-svelte';
+import { LocalLinter, binary } from 'harper.js';
- let linter = new LocalLinter({ binary });
+let linter = new LocalLinter({ binary });
- let head = `lspconfig.harper_ls.setup {
+let head = `lspconfig.harper_ls.setup {
settings = {
["harper-ls"] = {
linters = {
`;
- let tail = ` }
+let tail = ` }
}
},
}`;
- async function generateConfig() {
- let default_config = await linter.getDefaultLintConfig();
+async function generateConfig() {
+ let default_config = await linter.getDefaultLintConfig();
- let rows = Object.entries(default_config)
- .map(([key, value]) => `\t\t\t${key} = ${value},`)
- .reduce((prev, cur) => prev + '\n' + cur);
+ let rows = Object.entries(default_config)
+ .map(([key, value]) => `\t\t\t${key} = ${value},`)
+ .reduce((prev, cur) => prev + '\n' + cur);
- return head + rows + tail;
- }
+ return head + rows + tail;
+}
- async function copyConfig() {
- let defaultConfig = await generateConfig();
- navigator.clipboard.writeText(defaultConfig);
- }
+async function copyConfig() {
+ let defaultConfig = await generateConfig();
+ navigator.clipboard.writeText(defaultConfig);
+}
</script>
<Button onclick={copyConfig}>Copy Default Config to Clipboard</Button>
diff --git a/packages/web/src/lib/Editor.svelte b/packages/web/src/lib/Editor.svelte
index 91b6da64f..99a291b29 100644
--- a/packages/web/src/lib/Editor.svelte
+++ b/packages/web/src/lib/Editor.svelte
@@ -1,54 +1,54 @@
<script lang="ts">
- import { Card } from 'flowbite-svelte';
- import demo from '../../../../demo.md?raw';
- import Underlines from '$lib/Underlines.svelte';
- import { Button } from 'flowbite-svelte';
- import { type Lint, type WorkerLinter, SuggestionKind } from 'harper.js';
- import CheckMark from '$lib/CheckMark.svelte';
- import { fly } from 'svelte/transition';
- import lintKindColor from './lintKindColor';
+import CheckMark from '$lib/CheckMark.svelte';
+import Underlines from '$lib/Underlines.svelte';
+import { Card } from 'flowbite-svelte';
+import { Button } from 'flowbite-svelte';
+import { type Lint, SuggestionKind, type WorkerLinter } from 'harper.js';
+import { fly } from 'svelte/transition';
+import demo from '../../../../demo.md?raw';
+import lintKindColor from './lintKindColor';
- export let content = demo;
+export let content = demo;
- let lints: Lint[] = [];
- let lintCards: HTMLButtonElement[] = [];
- let focused: number | undefined;
- let editor: HTMLTextAreaElement | null;
- let linter: WorkerLinter;
+let lints: Lint[] = [];
+let lintCards: HTMLButtonElement[] = [];
+let focused: number | undefined;
+let editor: HTMLTextAreaElement | null;
+let linter: WorkerLinter;
- (async () => {
- let { WorkerLinter, binary } = await import('harper.js');
- linter = new WorkerLinter({ binary });
+(async () => {
+ let { WorkerLinter, binary } = await import('harper.js');
+ linter = new WorkerLinter({ binary });
- await linter.setup();
- })();
+ await linter.setup();
+})();
- let w: number | undefined;
+let w: number | undefined;
- $: linter?.lint(content).then((newLints) => (lints = newLints));
- $: boxHeight = calcHeight(content);
- $: if (focused != null && lintCards[focused])
- lintCards[focused].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
- $: if (focused != null && focused >= lints.length) focused = undefined;
+$: linter?.lint(content).then((newLints) => (lints = newLints));
+$: boxHeight = calcHeight(content);
+$: if (focused != null && lintCards[focused])
+ lintCards[focused].scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'nearest' });
+$: if (focused != null && focused >= lints.length) focused = undefined;
- $: if (editor != null && focused != null) {
- let lint = lints[focused % lints.length];
- if (lint != null) {
- let p = lint.span().end;
- editor.selectionStart = p;
- editor.selectionEnd = p;
- }
+$: if (editor != null && focused != null) {
+ let lint = lints[focused % lints.length];
+ if (lint != null) {
+ let p = lint.span().end;
+ editor.selectionStart = p;
+ editor.selectionEnd = p;
}
+}
- function calcHeight(boxContent: string): number {
- let numberOfLineBreaks = (boxContent.match(/\n/g) || []).length;
- let newHeight = 20 + numberOfLineBreaks * 30 + 12 + 2;
- return newHeight;
- }
+function calcHeight(boxContent: string): number {
+ let numberOfLineBreaks = (boxContent.match(/\n/g) || []).length;
+ let newHeight = 20 + numberOfLineBreaks * 30 + 12 + 2;
+ return newHeight;
+}
- // Whether to display a smallar variant of the editor
- $: small = (w ?? 1024) < 1024;
- $: superSmall = (w ?? 1024) < 550;
+// Whether to display a smallar variant of the editor
+$: small = (w ?? 1024) < 1024;
+$: superSmall = (w ?? 1024) < 550;
</script>
<div class={`flex w-full h-full p-5 ${small ? 'flex-col' : 'flex-row'}`} bind:clientWidth={w}>
diff --git a/packages/web/src/lib/GitHubClient.ts b/packages/web/src/lib/GitHubClient.ts
index 03bdcce84..e7c1cfb05 100644
--- a/packages/web/src/lib/GitHubClient.ts
+++ b/packages/web/src/lib/GitHubClient.ts
@@ -4,7 +4,7 @@ export class GithubClient {
public static async getLatestReleaseFromCache(
repoOwner: string,
- repoName: string
+ repoName: string,
): Promise<string | null> {
const key = `${repoOwner}/${repoName}`;
@@ -33,9 +33,9 @@ export class GithubClient {
`https://api.github.com/repos/${encodeURIComponent(repoOwner)}/${encodeURIComponent(repoName)}/releases/latest`,
{
headers: {
- ['ContentType']: 'application/json'
- }
- }
+ ['ContentType']: 'application/json',
+ },
+ },
);
const body = await resp.json();
diff --git a/packages/web/src/lib/GitHubLogo.svelte b/packages/web/src/lib/GitHubLogo.svelte
index 17eb57f38..227a8f204 100644
--- a/packages/web/src/lib/GitHubLogo.svelte
+++ b/packages/web/src/lib/GitHubLogo.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- export let width = '100%';
- export let height = '100%';
+export let width = '100%';
+export let height = '100%';
</script>
<svg {width} {height} viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
diff --git a/packages/web/src/lib/Graph.svelte b/packages/web/src/lib/Graph.svelte
index e44f4eaa3..5f6e8f3ec 100644
--- a/packages/web/src/lib/Graph.svelte
+++ b/packages/web/src/lib/Graph.svelte
@@ -1,34 +1,34 @@
<script lang="ts">
- import IntersectionObserver from 'svelte-intersection-observer';
- let data = new Map<string, number>();
- data.set('Harper', 10);
- data.set('LanguageTool', 650);
- data.set('Grammarly', 4000);
+import IntersectionObserver from 'svelte-intersection-observer';
+let data = new Map<string, number>();
+data.set('Harper', 10);
+data.set('LanguageTool', 650);
+data.set('Grammarly', 4000);
- let maxW = 0;
+let maxW = 0;
- for (let val of data.values()) {
- if (val > maxW) {
- maxW = val;
- }
+for (let val of data.values()) {
+ if (val > maxW) {
+ maxW = val;
}
+}
- let scaledData = new Map();
+let scaledData = new Map();
- for (let [key, val] of data.entries()) {
- scaledData.set(key, val / maxW);
- }
+for (let [key, val] of data.entries()) {
+ scaledData.set(key, val / maxW);
+}
- let els: Record<string, HTMLElement> = {};
+let els: Record<string, HTMLElement> = {};
- function expand(node: HTMLElement, { width, duration }: { width: number; duration: number }) {
- return {
- duration,
- css: (t: number) => {
- return `width: ${width * 100 * t}%;`;
- }
- };
- }
+function expand(node: HTMLElement, { width, duration }: { width: number; duration: number }) {
+ return {
+ duration,
+ css: (t: number) => {
+ return `width: ${width * 100 * t}%;`;
+ },
+ };
+}
</script>
<div class="flex flex-col justify-start w-full h-full">
diff --git a/packages/web/src/lib/Logo.svelte b/packages/web/src/lib/Logo.svelte
index 1dafca601..dd117cf22 100644
--- a/packages/web/src/lib/Logo.svelte
+++ b/packages/web/src/lib/Logo.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- export let width = '100%';
- export let height = '100%';
+export let width = '100%';
+export let height = '100%';
</script>
<svg
diff --git a/packages/web/src/lib/ObsidianLogo.svelte b/packages/web/src/lib/ObsidianLogo.svelte
index 215bcb25b..df7aa6235 100644
--- a/packages/web/src/lib/ObsidianLogo.svelte
+++ b/packages/web/src/lib/ObsidianLogo.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- export let width = '100%';
- export let height = '100%';
+export let width = '100%';
+export let height = '100%';
</script>
<svg {width} {height} viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
diff --git a/packages/web/src/lib/Section.svelte b/packages/web/src/lib/Section.svelte
index b1bfc2ffd..532b997de 100644
--- a/packages/web/src/lib/Section.svelte
+++ b/packages/web/src/lib/Section.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- export let swapped = false;
- export let noChild = false;
+export let swapped = false;
+export let noChild = false;
</script>
<section
diff --git a/packages/web/src/lib/Underlines.svelte b/packages/web/src/lib/Underlines.svelte
index cb0ef446b..c0df49b69 100644
--- a/packages/web/src/lib/Underlines.svelte
+++ b/packages/web/src/lib/Underlines.svelte
@@ -1,133 +1,131 @@
<script lang="ts">
- // This is some of the shittiest code I've ever written.
- // It is quite hard to look at.
- // Someday, I'll return to it and spruce it up.
- // For now, it works.
+// This is some of the shittiest code I've ever written.
+// It is quite hard to look at.
+// Someday, I'll return to it and spruce it up.
+// For now, it works.
- import type { Lint, WorkerLinter } from 'harper.js';
- import lintKindColor from '$lib/lintKindColor';
+import lintKindColor from '$lib/lintKindColor';
+import type { Lint, WorkerLinter } from 'harper.js';
- export let content: string;
- export let focusLintIndex: number | undefined;
+export let content: string;
+export let focusLintIndex: number | undefined;
- import { quintOut } from 'svelte/easing';
+import { quintOut } from 'svelte/easing';
- let loadTime = Date.now();
+let loadTime = Date.now();
- function slideUnderline(node: any) {
- return {
- duration: 300,
- css: (t: number) => {
- if (Date.now() - loadTime > 2000) {
- t = 1;
- }
+function slideUnderline(node: any) {
+ return {
+ duration: 300,
+ css: (t: number) => {
+ if (Date.now() - loadTime > 2000) {
+ t = 1;
+ }
- return `
+ return `
transform: scaleX(${t});
transform-origin: left;
`;
- },
- easing: quintOut
- };
- }
-
- let lints: [Lint, number][] = [];
- let lintHighlights: HTMLSpanElement[] = [];
- let linter: WorkerLinter;
-
- (async () => {
- let { WorkerLinter, binary } = await import('harper.js');
-
- linter = new WorkerLinter({ binary });
-
- await linter.setup();
- })();
-
- $: linter
- ?.lint(content)
- .then(
- (newLints) =>
- (lints = newLints
- .map<[Lint, number]>((lint, index) => [lint, index])
- .toSorted(([a], [b]) => a.span().start - b.span().end))
- );
- $: if (focusLintIndex != null && lintHighlights[focusLintIndex] != null)
- lintHighlights[focusLintIndex].scrollIntoView({
- behavior: 'smooth',
- block: 'nearest',
- inline: 'nearest'
- });
-
- function reOrgString(text: string): (string | undefined)[] {
- let output: (string | undefined)[] = [];
-
- for (let chunk of text.replaceAll(' ', '\u00A0').split('\n')) {
- if (output.length > 0) {
- output.push(undefined);
- }
- output.push(chunk);
+ },
+ easing: quintOut,
+ };
+}
+
+let lints: [Lint, number][] = [];
+let lintHighlights: HTMLSpanElement[] = [];
+let linter: WorkerLinter;
+
+(async () => {
+ let { WorkerLinter, binary } = await import('harper.js');
+
+ linter = new WorkerLinter({ binary });
+
+ await linter.setup();
+})();
+
+$: linter
+ ?.lint(content)
+ .then(
+ (newLints) =>
+ (lints = newLints
+ .map<[Lint, number]>((lint, index) => [lint, index])
+ .toSorted(([a], [b]) => a.span().start - b.span().end)),
+ );
+$: if (focusLintIndex != null && lintHighlights[focusLintIndex] != null)
+ lintHighlights[focusLintIndex].scrollIntoView({
+ behavior: 'smooth',
+ block: 'nearest',
+ inline: 'nearest',
+ });
+
+function reOrgString(text: string): (string | undefined)[] {
+ let output: (string | undefined)[] = [];
+
+ for (let chunk of text.replaceAll(' ', '\u00A0').split('\n')) {
+ if (output.length > 0) {
+ output.push(undefined);
}
-
- return output;
+ output.push(chunk);
}
- type UnderlineDetails = {
- focused: boolean;
- content: string;
- index: number;
- color: string;
- context: string;
- };
+ return output;
+}
- type UnderlineToken = string | null | undefined | UnderlineDetails;
+type UnderlineDetails = {
+ focused: boolean;
+ content: string;
+ index: number;
+ color: string;
+ context: string;
+};
- function processString(lintMap: [Lint, number][], focusLintIndex?: number) {
- let results: UnderlineToken[] = lintMap
- .map(([lint, lintIndex], index, arr) => {
- let prevStart = 0;
- let prev = arr[index - 1];
+type UnderlineToken = string | null | undefined | UnderlineDetails;
- if (prev != null) {
- prevStart = prev[0].span().end;
- }
+function processString(lintMap: [Lint, number][], focusLintIndex?: number) {
+ let results: UnderlineToken[] = lintMap.flatMap(([lint, lintIndex], index, arr) => {
+ let prevStart = 0;
+ let prev = arr[index - 1];
- let prevEnd = lint.span().start;
+ if (prev != null) {
+ prevStart = prev[0].span().end;
+ }
- let prevContent = [];
+ let prevEnd = lint.span().start;
- if (prevStart != prevEnd) {
- prevContent.push(...reOrgString(content.substring(prevStart, prevEnd)));
- }
+ let prevContent = [];
- let lintContent: UnderlineDetails = {
- focused: lintIndex === focusLintIndex,
- index: lintIndex,
- content: lint.get_problem_text().replaceAll(' ', '\u00A0'),
- color: lintKindColor(lint.lint_kind()),
- context: prevContent[prevContent.length - 1] ?? ''
- };
+ if (prevStart != prevEnd) {
+ prevContent.push(...reOrgString(content.substring(prevStart, prevEnd)));
+ }
- return [...prevContent, lintContent];
- })
- .flat();
+ let lintContent: UnderlineDetails = {
+ focused: lintIndex === focusLintIndex,
+ index: lintIndex,
+ content: lint.get_problem_text().replaceAll(' ', '\u00A0'),
+ color: lintKindColor(lint.lint_kind()),
+ context: prevContent[prevContent.length - 1] ?? '',
+ };
- let lastLint = lints.at(-1);
+ return [...prevContent, lintContent];
+ });
- let finalChunk;
+ let lastLint = lints.at(-1);
- if (lastLint != null) {
- finalChunk = content.substring(lastLint[0].span().end);
- } else {
- finalChunk = content;
- }
+ let finalChunk;
- results.push(...reOrgString(finalChunk));
-
- return results;
+ if (lastLint != null) {
+ finalChunk = content.substring(lastLint[0].span().end);
+ } else {
+ finalChunk = content;
}
- // string | [string, string, string, index] | null
- $: modified = processString(lints, focusLintIndex);
+ results.push(...reOrgString(finalChunk));
+
+ return results;
+}
+
+// string | [string, string, string, index] | null
+$: modified = processString(lints, focusLintIndex);
</script>
<div class="grid">
diff --git a/packages/web/src/routes/+layout.svelte b/packages/web/src/routes/+layout.svelte
index 4127ef5b9..2c1379ca2 100644
--- a/packages/web/src/routes/+layout.svelte
+++ b/packages/web/src/routes/+layout.svelte
@@ -1,10 +1,10 @@
<script lang="ts">
- import '../app.css';
- import GutterCenter from '$lib/GutterCenter.svelte';
- import AutomatticLogo from '$lib/AutomatticLogo.svelte';
+import '../app.css';
+import AutomatticLogo from '$lib/AutomatticLogo.svelte';
+import GutterCenter from '$lib/GutterCenter.svelte';
- let names = ['Grammar Guru', 'Grammar Checker', 'Grammar Savior'];
- let displayName = names[Math.floor(Math.random() * names.length)];
+let names = ['Grammar Guru', 'Grammar Checker', 'Grammar Savior'];
+let displayName = names[Math.floor(Math.random() * names.length)];
</script>
<link
diff --git a/packages/web/src/routes/+page.svelte b/packages/web/src/routes/+page.svelte
index 3672a78c5..3388a3222 100644
--- a/packages/web/src/routes/+page.svelte
+++ b/packages/web/src/routes/+page.svelte
@@ -1,23 +1,23 @@
<script module>
- import Graph from '$lib/Graph.svelte';
- import CodeLogo from '$lib/CodeLogo.svelte';
- import Editor from '$lib/Editor.svelte';
- import Section from '$lib/Section.svelte';
- import Logo from '$lib/Logo.svelte';
- import GitHubLogo from '$lib/GitHubLogo.svelte';
- import ObsidianLogo from '$lib/ObsidianLogo.svelte';
+import CodeLogo from '$lib/CodeLogo.svelte';
+import Editor from '$lib/Editor.svelte';
+import GitHubLogo from '$lib/GitHubLogo.svelte';
+import Graph from '$lib/Graph.svelte';
+import Logo from '$lib/Logo.svelte';
+import ObsidianLogo from '$lib/ObsidianLogo.svelte';
+import Section from '$lib/Section.svelte';
- export const frontmatter = {
- home: false
- };
+export const frontmatter = {
+ home: false,
+};
- let width = $state(window.innerWidth);
+let width = $state(window.innerWidth);
- window.addEventListener('resize', () => {
- width = window.innerWidth;
- });
+window.addEventListener('resize', () => {
+ width = window.innerWidth;
+});
- let mobile = $derived(width < 640);
+let mobile = $derived(width < 640);
</script>
<div class="w-full flex flex-col items-center">
diff --git a/packages/web/src/routes/cache-healthcheck/+server.ts b/packages/web/src/routes/cache-healthcheck/+server.ts
index 3ed4f358c..87cb4ad33 100644
--- a/packages/web/src/routes/cache-healthcheck/+server.ts
+++ b/packages/web/src/routes/cache-healthcheck/+server.ts
@@ -1,7 +1,7 @@
export async function GET() {
return new Response('OK', {
headers: {
- ['Cache-Control']: 'no-cache'
- }
+ ['Cache-Control']: 'no-cache',
+ },
});
}
diff --git a/packages/web/src/routes/docs/harperjs/CDN/example/+server.ts b/packages/web/src/routes/docs/harperjs/CDN/example/+server.ts
index c336a5e92..bf459889c 100644
--- a/packages/web/src/routes/docs/harperjs/CDN/example/+server.ts
+++ b/packages/web/src/routes/docs/harperjs/CDN/example/+server.ts
@@ -3,7 +3,7 @@ import pageHtml from '../../../../../../../harper.js/examples/raw-web/index.html
export async function GET() {
return new Response(pageHtml, {
headers: {
- ['Content-Type']: 'text/html'
- }
+ ['Content-Type']: 'text/html',
+ },
});
}
diff --git a/packages/web/src/routes/docs/rules/+page.svelte b/packages/web/src/routes/docs/rules/+page.svelte
index 99646af73..0a3c5825f 100644
--- a/packages/web/src/routes/docs/rules/+page.svelte
+++ b/packages/web/src/routes/docs/rules/+page.svelte
@@ -1,28 +1,28 @@
<script module lang="ts">
- import { LocalLinter, type LintConfig, binary } from 'harper.js';
- import {
- Table,
- TableBody,
- TableBodyCell,
- TableBodyRow,
- TableHead,
- TableHeadCell
- } from 'flowbite-svelte';
+import {
+ Table,
+ TableBody,
+ TableBodyCell,
+ TableBodyRow,
+ TableHead,
+ TableHeadCell,
+} from 'flowbite-svelte';
+import { type LintConfig, LocalLinter, binary } from 'harper.js';
- export const frontmatter = {
- title: 'Rules'
- };
+export const frontmatter = {
+ title: 'Rules',
+};
- let descriptions: Record<string, string> = $state({});
- let default_config: LintConfig = $state({});
+let descriptions: Record<string, string> = $state({});
+let default_config: LintConfig = $state({});
- let linter = new LocalLinter({ binary });
- linter.getLintDescriptions().then(async (v) => {
- descriptions = v;
- });
- linter.getDefaultLintConfig().then(async (v) => {
- default_config = v;
- });
+let linter = new LocalLinter({ binary });
+linter.getLintDescriptions().then(async (v) => {
+ descriptions = v;
+});
+linter.getDefaultLintConfig().then(async (v) => {
+ default_config = v;
+});
</script>
<p>This page is an incomplete list of the various grammatical rules Harper checks for.</p>
diff --git a/packages/web/src/routes/editor/+page.svelte b/packages/web/src/routes/editor/+page.svelte
index 87a0e76e4..310426edd 100644
--- a/packages/web/src/routes/editor/+page.svelte
+++ b/packages/web/src/routes/editor/+page.svelte
@@ -1,9 +1,9 @@
<script>
- /// This page exists to be embedded via an `iframe`.
- import Editor from '$lib/Editor.svelte';
- import { page } from '$app/stores';
+import { page } from '$app/stores';
+/// This page exists to be embedded via an `iframe`.
+import Editor from '$lib/Editor.svelte';
- let content = $page.url.searchParams.get('initialText') ?? '';
+let content = $page.url.searchParams.get('initialText') ?? '';
</script>
<div class="absolute top-0 left-0 w-full h-full z-[1000] bg-white dark:bg-black">
diff --git a/packages/web/src/routes/languagedetection/+page.svelte b/packages/web/src/routes/languagedetection/+page.svelte
index 7c24bef26..5bd226328 100644
--- a/packages/web/src/routes/languagedetection/+page.svelte
+++ b/packages/web/src/routes/languagedetection/+page.svelte
@@ -1,48 +1,48 @@
<script lang="ts">
- import { WorkerLinter, binary } from 'harper.js';
- import { Textarea, Select } from 'flowbite-svelte';
- import demoText from '../../../../../demo.md?raw';
+import { Select, Textarea } from 'flowbite-svelte';
+import { WorkerLinter, binary } from 'harper.js';
+import demoText from '../../../../../demo.md?raw';
- let isEnglish: boolean | null = null;
- let text = '';
- let strippedText = '';
+let isEnglish: boolean | null = null;
+let text = '';
+let strippedText = '';
- let linter = new WorkerLinter({ binary });
- linter.setup();
+let linter = new WorkerLinter({ binary });
+linter.setup();
- $: linter.isLikelyEnglish(text).then((v) => (isEnglish = v));
- $: linter.isolateEnglish(text).then((t) => (strippedText = t));
+$: linter.isLikelyEnglish(text).then((v) => (isEnglish = v));
+$: linter.isolateEnglish(text).then((t) => (strippedText = t));
- $: color = isEnglish == null ? '' : isEnglish ? 'bg-green-100' : 'bg-red-100';
+$: color = isEnglish == null ? '' : isEnglish ? 'bg-green-100' : 'bg-red-100';
- let templates = [
- {
- name: 'Java Code',
- value: `public class Main {
+let templates = [
+ {
+ name: 'Java Code',
+ value: `public class Main {
public static void main(String[] args) {
System.out.println("Hello World");
}
-}`
- },
- { name: 'Poor Grammar', value: demoText },
- {
- name: 'Chinese Lorem Ipsum',
- value:
- '食棵支每躲種。奶象打星爪子二細喜才記行在發像原斤!頁固點子衣點豆看身蝴看苗急午公何足,筆娘經色蝶行元香也要。麻了綠尼固世,色北書目登功;因告黑。'
- },
- {
- name: 'Spanish English Mix',
- value: 'En la mañana, como a dish de los huevos, un poquito of tocino, y a lot of leche.'
- },
- {
- name: 'Polish English Chunked',
- value: 'I have a simple motto in life: jeśli jesteś spragniony, napij się wody.'
- }
- ];
+}`,
+ },
+ { name: 'Poor Grammar', value: demoText },
+ {
+ name: 'Chinese Lorem Ipsum',
+ value:
+ '食棵支每躲種。奶象打星爪子二細喜才記行在發像原斤!頁固點子衣點豆看身蝴看苗急午公何足,筆娘經色蝶行元香也要。麻了綠尼固世,色北書目登功;因告黑。',
+ },
+ {
+ name: 'Spanish English Mix',
+ value: 'En la mañana, como a dish de los huevos, un poquito of tocino, y a lot of leche.',
+ },
+ {
+ name: 'Polish English Chunked',
+ value: 'I have a simple motto in life: jeśli jesteś spragniony, napij się wody.',
+ },
+];
- function selectChange(e: Event) {
- text = (e.target as HTMLSelectElement).value;
- }
+function selectChange(e: Event) {
+ text = (e.target as HTMLSelectElement).value;
+}
</script>
<div class="[&>*]:mt-12 p-4 dark:[&>*]:text-white">
diff --git a/packages/web/src/routes/latestversion/+server.ts b/packages/web/src/routes/latestversion/+server.ts
index 79bb24c8e..feaa929dd 100644
--- a/packages/web/src/routes/latestversion/+server.ts
+++ b/packages/web/src/routes/latestversion/+server.ts
@@ -11,7 +11,7 @@ export async function GET() {
return new Response(latestVersion, {
headers: {
- ['Cache-Control']: 'no-cache'
- }
+ ['Cache-Control']: 'no-cache',
+ },
});
}
diff --git a/packages/web/src/routes/presentation/+page.svelte b/packages/web/src/routes/presentation/+page.svelte
index 12c1ad6c0..d80c1a106 100644
--- a/packages/web/src/routes/presentation/+page.svelte
+++ b/packages/web/src/routes/presentation/+page.svelte
@@ -1,14 +1,14 @@
<script lang="ts">
- import 'reveal.js/dist/reveal.css';
- import 'reveal.js/dist/theme/serif.css';
- import Reveal from 'reveal.js';
- import { onMount } from 'svelte';
- import Logo from '$lib/Logo.svelte';
+import 'reveal.js/dist/reveal.css';
+import 'reveal.js/dist/theme/serif.css';
+import Logo from '$lib/Logo.svelte';
+import Reveal from 'reveal.js';
+import { onMount } from 'svelte';
- onMount(() => {
- let deck = new Reveal();
- deck.initialize();
- });
+onMount(() => {
+ let deck = new Reveal();
+ deck.initialize();
+});
</script>
<div class="reveal">
diff --git a/packages/web/src/routes/titlecase/+page.svelte b/packages/web/src/routes/titlecase/+page.svelte
index ebfcf57ff..2fd8c4c94 100644
--- a/packages/web/src/routes/titlecase/+page.svelte
+++ b/packages/web/src/routes/titlecase/+page.svelte
@@ -1,36 +1,36 @@
<script>
- import { onMount } from 'svelte';
- import { Textarea } from 'flowbite-svelte';
- import Typed from 'typed.js';
- import { WorkerLinter, binary } from 'harper.js';
+import { Textarea } from 'flowbite-svelte';
+import { WorkerLinter, binary } from 'harper.js';
+import { onMount } from 'svelte';
+import Typed from 'typed.js';
- let textareaRef;
- let linter = new WorkerLinter({ binary });
+let textareaRef;
+let linter = new WorkerLinter({ binary });
- let text = $state('');
+let text = $state('');
- $effect(() => {
- linter.toTitleCase(text).then((t) => (text = t));
- });
-
- onMount(() => {
- const typed = new Typed('#titleCaseInputField', {
- strings: [
- 'Click Here to Write an Article Title',
- 'Click Here to Write a Blog Title',
- 'Click Here to Write a Social Media Post Title',
- 'Click Here to Write a Newsletter Title',
- 'Click Here to Write a Video Script Title',
- 'Click Here to Write a Press Release Title',
- 'Click Here to Brainstorm a New Ebook Title'
- ],
- typeSpeed: 50,
- showCursor: false,
- attr: 'placeholder'
- });
+$effect(() => {
+ linter.toTitleCase(text).then((t) => (text = t));
+});
- return () => typed.destroy();
+onMount(() => {
+ const typed = new Typed('#titleCaseInputField', {
+ strings: [
+ 'Click Here to Write an Article Title',
+ 'Click Here to Write a Blog Title',
+ 'Click Here to Write a Social Media Post Title',
+ 'Click Here to Write a Newsletter Title',
+ 'Click Here to Write a Video Script Title',
+ 'Click Here to Write a Press Release Title',
+ 'Click Here to Brainstorm a New Ebook Title',
+ ],
+ typeSpeed: 50,
+ showCursor: false,
+ attr: 'placeholder',
});
+
+ return () => typed.destroy();
+});
</script>
<h1>Title Case Converter</h1>
diff --git a/packages/web/svelte.config.js b/packages/web/svelte.config.js
index 37ea98e6d..f658ab386 100644
--- a/packages/web/svelte.config.js
+++ b/packages/web/svelte.config.js
@@ -8,9 +8,9 @@ const config = {
kit: {
adapter: adapter({
- out: 'build'
- })
- }
+ out: 'build',
+ }),
+ },
};
export default config;
diff --git a/packages/web/tailwind.config.js b/packages/web/tailwind.config.js
index 2662b7ce4..b2e95e099 100644
--- a/packages/web/tailwind.config.js
+++ b/packages/web/tailwind.config.js
@@ -3,7 +3,7 @@ import flowbitePlugin from 'flowbite/plugin';
export default {
content: [
'./src/**/*.{html,js,svelte,ts}',
- '../node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}'
+ '../node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}',
],
plugins: [flowbitePlugin],
darkMode: 'class',
@@ -20,9 +20,9 @@ export default {
300: '#b3bace',
200: '#ccd0de',
100: '#e5e7ef',
- 50: '#ffffff'
- }
- }
- }
- }
+ 50: '#ffffff',
+ },
+ },
+ },
+ },
};
diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.ts
index 90c08f971..fc020684b 100644
--- a/packages/web/vite.config.ts
+++ b/packages/web/vite.config.ts
@@ -8,14 +8,14 @@ export default defineConfig({
server: {
port: 3000,
fs: {
- allow: ['../harper.js/dist']
- }
+ allow: ['../harper.js/dist'],
+ },
},
plugins: [
sveltepress({
siteConfig: {
title: 'Harper',
- description: 'A Grammar Checker from Automattic'
+ description: 'A Grammar Checker from Automattic',
},
theme: defaultTheme({
editLink: `https://github.com/automattic/harper/edit/master/packages/web/src/routes/:route`,
@@ -27,128 +27,128 @@ export default defineConfig({
dark: '#355280',
gradient: {
start: '#355280',
- end: '#818eae'
- }
+ end: '#818eae',
+ },
},
navbar: [{ title: 'Documentation', to: '/docs/about' }],
sidebar: {
'/docs/': [
{
title: 'About',
- to: '/docs/about'
+ to: '/docs/about',
},
{
title: 'Integrations',
items: [
{
title: 'Obsidian',
- to: '/docs/integrations/obsidian'
+ to: '/docs/integrations/obsidian',
},
{
title: 'WordPress',
- to: '/docs/integrations/wordpress'
+ to: '/docs/integrations/wordpress',
},
{
title: 'Language Server',
- to: '/docs/integrations/language-server'
+ to: '/docs/integrations/language-server',
},
{
title: 'Visual Studio Code',
- to: '/docs/integrations/visual-studio-code'
+ to: '/docs/integrations/visual-studio-code',
},
{
title: 'Neovim',
- to: '/docs/integrations/neovim'
+ to: '/docs/integrations/neovim',
},
{
title: 'Helix',
- to: '/docs/integrations/helix'
+ to: '/docs/integrations/helix',
},
{
title: 'Emacs',
- to: '/docs/integrations/emacs'
+ to: '/docs/integrations/emacs',
},
{
title: 'Zed',
- to: '/docs/integrations/zed'
- }
- ]
+ to: '/docs/integrations/zed',
+ },
+ ],
},
{
title: 'harper.js',
items: [
{
title: 'Introduction',
- to: '/docs/harperjs/introduction'
+ to: '/docs/harperjs/introduction',
},
{
title: 'Linting',
- to: '/docs/harperjs/linting'
+ to: '/docs/harperjs/linting',
},
{
title: 'Node.js',
- to: '/docs/harperjs/node'
+ to: '/docs/harperjs/node',
},
{
title: 'CDN',
- to: '/docs/harperjs/CDN'
+ to: '/docs/harperjs/CDN',
},
{
title: 'API Reference',
- to: '/docs/harperjs/ref/index.html'
- }
- ]
+ to: '/docs/harperjs/ref/index.html',
+ },
+ ],
},
{
title: 'Contributors',
items: [
{
title: 'Introduction',
- to: '/docs/contributors/introduction'
+ to: '/docs/contributors/introduction',
},
{
title: 'Environment',
- to: '/docs/contributors/environment'
+ to: '/docs/contributors/environment',
},
{
title: 'Committing',
- to: '/docs/contributors/committing'
+ to: '/docs/contributors/committing',
},
{
title: 'Architecture',
- to: '/docs/contributors/architecture'
+ to: '/docs/contributors/architecture',
},
{
title: 'Dictionary',
- to: '/docs/contributors/dictionary'
+ to: '/docs/contributors/dictionary',
},
{
title: 'Author a Rule',
- to: '/docs/contributors/author-a-rule'
+ to: '/docs/contributors/author-a-rule',
},
{
title: 'Visual Studio Code',
- to: '/docs/contributors/visual-studio-code'
+ to: '/docs/contributors/visual-studio-code',
},
{
title: 'WordPress',
- to: '/docs/contributors/wordpress'
+ to: '/docs/contributors/wordpress',
},
{
title: 'Reviewing Pull Requests',
- to: '/docs/contributors/review'
- }
- ]
+ to: '/docs/contributors/review',
+ },
+ ],
},
{
title: 'FAQ',
- to: '/docs/faq'
+ to: '/docs/faq',
},
{
title: 'Rules',
- to: '/docs/rules'
- }
- ]
+ to: '/docs/rules',
+ },
+ ],
},
highlighter: {
languages: [
@@ -164,12 +164,12 @@ export default defineConfig({
'rust',
'lua',
'json',
- 'elisp'
- ]
- }
- })
+ 'elisp',
+ ],
+ },
+ }),
}),
wasm(),
- topLevelAwait()
- ]
+ topLevelAwait(),
+ ],
});
diff --git a/packages/wordpress-plugin/src/harper/DataBlock.ts b/packages/wordpress-plugin/src/harper/DataBlock.ts
index c6ea1ea5f..34b74fd89 100644
--- a/packages/wordpress-plugin/src/harper/DataBlock.ts
+++ b/packages/wordpress-plugin/src/harper/DataBlock.ts
@@ -1,6 +1,6 @@
-import { getNodesFromQuerySelector, getRichTextContainers } from './domUtils';
-import RichText from './RichText';
import { dispatch } from '@wordpress/data';
+import RichText from './RichText';
+import { getNodesFromQuerySelector, getRichTextContainers } from './domUtils';
/**
* Represents a Gutenberg block on-screen.
@@ -28,9 +28,9 @@ export default class DataBlock {
const attributeName = cont.getAttribute('data-wp-block-attribute-key') ?? 'content';
await updateBlockAttributes(this.getClientId(), {
- [attributeName]: newContent
+ [attributeName]: newContent,
});
- })
+ }),
);
}
diff --git a/packages/wordpress-plugin/src/harper/Highlighter.tsx b/packages/wordpress-plugin/src/harper/Highlighter.tsx
index 815557403..42c70f56d 100644
--- a/packages/wordpress-plugin/src/harper/Highlighter.tsx
+++ b/packages/wordpress-plugin/src/harper/Highlighter.tsx
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react';
+import type { LintBox } from './Box';
+import type RichText from './RichText';
import SuggestionControl from './SuggestionControl';
-import RichText from './RichText';
-import { LintBox } from './Box';
/**
* Renders controls to the user around the errors.
@@ -11,7 +11,7 @@ import { LintBox } from './Box';
*/
export default function Highlighter({
lintBoxes,
- richText
+ richText,
}: {
lintBoxes: LintBox[];
richText: RichText;
diff --git a/packages/wordpress-plugin/src/harper/LintList.tsx b/packages/wordpress-plugin/src/harper/LintList.tsx
index 57c4f739a..3f28a9ef1 100644
--- a/packages/wordpress-plugin/src/harper/LintList.tsx
+++ b/packages/wordpress-plugin/src/harper/LintList.tsx
@@ -1,11 +1,11 @@
+import { Animate, Spinner } from '@wordpress/components';
import React from 'react';
-import { IgnorableLintBox } from './Box';
+import type { IgnorableLintBox } from './Box';
import LintListItem from './LintListItem';
-import { Animate, Spinner } from '@wordpress/components';
export default function LintList({
lintBoxes,
- loading
+ loading,
}: {
lintBoxes: IgnorableLintBox[];
loading: boolean;
@@ -20,7 +20,7 @@ export default function LintList({
<Spinner
style={{
height: 'calc(4px * 20)',
- width: 'calc(4px * 20)'
+ width: 'calc(4px * 20)',
}}
/>
) : (
diff --git a/packages/wordpress-plugin/src/harper/LintListItem.tsx b/packages/wordpress-plugin/src/harper/LintListItem.tsx
index a03ff6a37..84b938258 100644
--- a/packages/wordpress-plugin/src/harper/LintListItem.tsx
+++ b/packages/wordpress-plugin/src/harper/LintListItem.tsx
@@ -1,8 +1,8 @@
-import { Card, Button, CardBody } from '@wordpress/components';
-import { useAddToDictionary } from './usePersonalDictionary';
-import { IgnorableLintBox } from './Box';
+import { Button, Card, CardBody } from '@wordpress/components';
import React from 'react';
+import type { IgnorableLintBox } from './Box';
import { suggestionText } from './lintUtils';
+import { useAddToDictionary } from './usePersonalDictionary';
export default function LintListItem({ box }: { box: IgnorableLintBox }) {
const addToDictionary = useAddToDictionary();
diff --git a/packages/wordpress-plugin/src/harper/LintSettingList.tsx b/packages/wordpress-plugin/src/harper/LintSettingList.tsx
index c608bc956..f8960d241 100644
--- a/packages/wordpress-plugin/src/harper/LintSettingList.tsx
+++ b/packages/wordpress-plugin/src/harper/LintSettingList.tsx
@@ -1,8 +1,8 @@
+import { SearchControl } from '@wordpress/components';
import React, { useState } from 'react';
import LintSettingRow from './LintSettingRow';
-import useLintConfig, { useDefaultLintConfig } from './useLintConfig';
import { useLintDescriptions } from './LinterProvider';
-import { SearchControl } from '@wordpress/components';
+import useLintConfig, { useDefaultLintConfig } from './useLintConfig';
export default function LintSettingList() {
const [lintConfig, setLintConfig] = useLintConfig();
diff --git a/packages/wordpress-plugin/src/harper/LintSettingRow.tsx b/packages/wordpress-plugin/src/harper/LintSettingRow.tsx
index fd46250a3..62229fb22 100644
--- a/packages/wordpress-plugin/src/harper/LintSettingRow.tsx
+++ b/packages/wordpress-plugin/src/harper/LintSettingRow.tsx
@@ -1,5 +1,5 @@
-import React, { useEffect, useState } from 'react';
import { Animate, CheckboxControl } from '@wordpress/components';
+import React, { useEffect, useState } from 'react';
import { useLinter } from './LinterProvider';
export default function LintSettingRow({
@@ -7,7 +7,7 @@ export default function LintSettingRow({
value,
defaultValue,
setValue,
- description
+ description,
}: {
name: string;
description: string;
diff --git a/packages/wordpress-plugin/src/harper/LinterProvider.tsx b/packages/wordpress-plugin/src/harper/LinterProvider.tsx
index f478b791d..925f13116 100644
--- a/packages/wordpress-plugin/src/harper/LinterProvider.tsx
+++ b/packages/wordpress-plugin/src/harper/LinterProvider.tsx
@@ -1,5 +1,12 @@
-import { Linter, WorkerLinter, binaryInlined } from 'harper.js';
-import React, { createContext, ReactNode, useContext, useEffect, useRef, useState } from 'react';
+import { type Linter, WorkerLinter, binaryInlined } from 'harper.js';
+import React, {
+ createContext,
+ type ReactNode,
+ useContext,
+ useEffect,
+ useRef,
+ useState,
+} from 'react';
const linterContext = createContext<Linter>(new WorkerLinter({ binary: binaryInlined }));
diff --git a/packages/wordpress-plugin/src/harper/Logo.jsx b/packages/wordpress-plugin/src/harper/Logo.jsx
index 069a0d27e..9efcf68b2 100644
--- a/packages/wordpress-plugin/src/harper/Logo.jsx
+++ b/packages/wordpress-plugin/src/harper/Logo.jsx
@@ -14,7 +14,7 @@ export default function Logo() {
clipRule: 'evenodd',
strokeLinecap: 'round',
strokeLinejoin: 'round',
- strokeMiterlimit: 1.5
+ strokeMiterlimit: 1.5,
}}
>
<g transform="matrix(1,0,0,1,-5,-1720)">
@@ -26,7 +26,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '22.92px'
+ strokeWidth: '22.92px',
}}
/>
</g>
@@ -36,7 +36,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '22.92px'
+ strokeWidth: '22.92px',
}}
/>
</g>
@@ -50,7 +50,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '20.82px'
+ strokeWidth: '20.82px',
}}
/>
</g>
@@ -62,7 +62,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '20.82px'
+ strokeWidth: '20.82px',
}}
/>
<rect
@@ -73,7 +73,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '20.82px'
+ strokeWidth: '20.82px',
}}
/>
<g transform="matrix(-1,0,0,1,4281.79,-0.853887)">
@@ -85,7 +85,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '20.82px'
+ strokeWidth: '20.82px',
}}
/>
</g>
@@ -98,7 +98,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '20.82px'
+ strokeWidth: '20.82px',
}}
/>
</g>
@@ -111,7 +111,7 @@ export default function Logo() {
style={{
fill: 'none',
stroke: 'currentColor',
- strokeWidth: '20.82px'
+ strokeWidth: '20.82px',
}}
/>
</g>
diff --git a/packages/wordpress-plugin/src/harper/RichText.ts b/packages/wordpress-plugin/src/harper/RichText.ts
index 581a4a8a8..434ff2a9f 100644
--- a/packages/wordpress-plugin/src/harper/RichText.ts
+++ b/packages/wordpress-plugin/src/harper/RichText.ts
@@ -1,5 +1,5 @@
-import { Lint, LocalLinter, Suggestion, binaryInlined } from 'harper.js';
-import { LintBox } from './Box';
+import { type Lint, LocalLinter, type Suggestion, binaryInlined } from 'harper.js';
+import type { LintBox } from './Box';
import DataBlock from './DataBlock';
import { getRangeForTextSpan } from './domUtils';
@@ -57,7 +57,7 @@ export default class RichText {
const fixed = await linter.applySuggestion(text, sug, span);
this.editContent(fixed);
- }
+ },
});
}
diff --git a/packages/wordpress-plugin/src/harper/SidebarControl.tsx b/packages/wordpress-plugin/src/harper/SidebarControl.tsx
index 120c540d9..3ccc3ebd0 100644
--- a/packages/wordpress-plugin/src/harper/SidebarControl.tsx
+++ b/packages/wordpress-plugin/src/harper/SidebarControl.tsx
@@ -1,6 +1,6 @@
-import DataBlock from './DataBlock';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { createPortal } from 'react-dom';
+import DataBlock from './DataBlock';
import Highlighter from './Highlighter';
import SidebarTabContainer from './SidebarTabContainer';
import useLintBoxes from './useLintBoxes';
@@ -19,7 +19,7 @@ export default function SidebarControl() {
observer.observe(documentContainer, {
subtree: true,
- childList: true
+ childList: true,
});
return () => observer.disconnect();
@@ -35,7 +35,7 @@ export default function SidebarControl() {
const boxes = lintBoxes[index] ?? [];
return createPortal(
<Highlighter richText={richText} key={richText.getTextContent()} lintBoxes={boxes} />,
- documentContainer
+ documentContainer,
);
});
diff --git a/packages/wordpress-plugin/src/harper/SidebarTabContainer.tsx b/packages/wordpress-plugin/src/harper/SidebarTabContainer.tsx
index b7a23d7c3..1baecb752 100644
--- a/packages/wordpress-plugin/src/harper/SidebarTabContainer.tsx
+++ b/packages/wordpress-plugin/src/harper/SidebarTabContainer.tsx
@@ -1,12 +1,12 @@
-import React from 'react';
-import LintSettingList from './LintSettingList';
import { Panel, PanelBody, TabPanel } from '@wordpress/components';
+import React from 'react';
+import type { IgnorableLintBox } from './Box';
import LintList from './LintList';
-import { IgnorableLintBox } from './Box';
+import LintSettingList from './LintSettingList';
export default function SidebarTabContainer({
lintBoxes,
- loading
+ loading,
}: {
lintBoxes: IgnorableLintBox[];
loading: boolean;
@@ -15,7 +15,7 @@ export default function SidebarTabContainer({
<TabPanel
tabs={[
{ name: 'errors', title: 'Errors' },
- { name: 'settings', title: 'Settings' }
+ { name: 'settings', title: 'Settings' },
]}
>
{(tab) => {
diff --git a/packages/wordpress-plugin/src/harper/SuggestionControl.tsx b/packages/wordpress-plugin/src/harper/SuggestionControl.tsx
index 75c60909a..17ecac907 100644
--- a/packages/wordpress-plugin/src/harper/SuggestionControl.tsx
+++ b/packages/wordpress-plugin/src/harper/SuggestionControl.tsx
@@ -1,8 +1,8 @@
-import React, { useEffect, useMemo, useRef, useState } from 'react';
-import { IgnorableLintBox, isPointInBox } from './Box';
-import { useAddToDictionary } from './usePersonalDictionary';
import { Button, Popover } from '@wordpress/components';
+import React, { useEffect, useMemo, useRef, useState } from 'react';
+import { type IgnorableLintBox, isPointInBox } from './Box';
import { suggestionText } from './lintUtils';
+import { useAddToDictionary } from './usePersonalDictionary';
/**
* A control for an individual suggestion shown on the screen.
@@ -61,7 +61,7 @@ export default function SuggestionControl({ lintBox }: { lintBox: IgnorableLintB
width: `${width}px`,
height: `${height}px`,
pointerEvents: 'none',
- zIndex: 1
+ zIndex: 1,
}}
></div>
{showPopover ? (
diff --git a/packages/wordpress-plugin/src/harper/domUtils.ts b/packages/wordpress-plugin/src/harper/domUtils.ts
index 2a1eae555..9907cbcd0 100644
--- a/packages/wordpress-plugin/src/harper/domUtils.ts
+++ b/packages/wordpress-plugin/src/harper/domUtils.ts
@@ -1,4 +1,4 @@
-import { Span } from 'harper.js';
+import type { Span } from 'harper.js';
/**
* Turn a `NodeList` into a normal JavaScript array.
diff --git a/packages/wordpress-plugin/src/harper/index.tsx b/packages/wordpress-plugin/src/harper/index.tsx
index 7a97b4357..c5c9f9bc6 100644
--- a/packages/wordpress-plugin/src/harper/index.tsx
+++ b/packages/wordpress-plugin/src/harper/index.tsx
@@ -1,7 +1,7 @@
-import { registerPlugin } from '@wordpress/plugins';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
-import SidebarControl from './SidebarControl';
+import { registerPlugin } from '@wordpress/plugins';
import Logo from './Logo';
+import SidebarControl from './SidebarControl';
import './index.css';
import React from 'react';
import LinterProvider from './LinterProvider';
diff --git a/packages/wordpress-plugin/src/harper/lintUtils.ts b/packages/wordpress-plugin/src/harper/lintUtils.ts
index 8464a555d..7a92dc4b5 100644
--- a/packages/wordpress-plugin/src/harper/lintUtils.ts
+++ b/packages/wordpress-plugin/src/harper/lintUtils.ts
@@ -9,7 +9,7 @@ import { SuggestionKind } from 'harper.js';
export function suggestionText(
kind: SuggestionKind,
problemText: string,
- replacementText: string
+ replacementText: string,
): string {
if (kind === SuggestionKind.Remove) {
return `Remove “${problemText}”`;
diff --git a/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts b/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts
index dccfcd8e0..4576134f9 100644
--- a/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts
+++ b/packages/wordpress-plugin/src/harper/useIgnoredLintState.ts
@@ -1,14 +1,14 @@
-import { Lint } from 'harper.js';
import { useDispatch, useSelect } from '@wordpress/data';
-import { useLinter } from './LinterProvider';
+import type { Lint } from 'harper.js';
import { useCallback } from 'react';
+import { useLinter } from './LinterProvider';
const KEY = 'ignoredLints';
export default function useIgnoredLintState(): [string | undefined, (newState: string) => void] {
const ignoredLintState = useSelect(
(select) => select('core/preferences').get('harper-wp', KEY),
- []
+ [],
);
const { set } = useDispatch('core/preferences');
diff --git a/packages/wordpress-plugin/src/harper/useLintBoxes.ts b/packages/wordpress-plugin/src/harper/useLintBoxes.ts
index a4f5360d0..056192d48 100644
--- a/packages/wordpress-plugin/src/harper/useLintBoxes.ts
+++ b/packages/wordpress-plugin/src/harper/useLintBoxes.ts
@@ -1,11 +1,11 @@
-import usePersonalDictionary from './usePersonalDictionary';
+import type { Lint } from 'harper.js';
import { useCallback, useEffect, useState } from 'react';
-import { IgnorableLintBox, LintBox } from './Box';
-import RichText from './RichText';
-import { Lint } from 'harper.js';
+import { type IgnorableLintBox, LintBox } from './Box';
import { useLinter } from './LinterProvider';
-import useLintConfig from './useLintConfig';
+import type RichText from './RichText';
import useIgnoredLintState, { useIgnoreLint } from './useIgnoredLintState';
+import useLintConfig from './useLintConfig';
+import usePersonalDictionary from './usePersonalDictionary';
/**
* Lint given elements and return the resulting error targets.
@@ -46,7 +46,7 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
const contents = richText.getTextContent();
return await linter.lint(contents);
- })
+ }),
);
setLoading(false);
@@ -61,7 +61,7 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
observer.observe(richText.getTargetElement(), {
childList: true,
characterData: true,
- subtree: true
+ subtree: true,
});
return observer;
});
@@ -87,7 +87,7 @@ export default function useLintBoxes(richTexts: RichText[]): [IgnorableLintBox[]
.map((box) => {
return {
...box,
- ignoreLint: () => ignoreLint(box.lint)
+ ignoreLint: () => ignoreLint(box.lint),
};
});
});
diff --git a/packages/wordpress-plugin/src/harper/useLintConfig.ts b/packages/wordpress-plugin/src/harper/useLintConfig.ts
index aa247f1c7..c40d2eb6e 100644
--- a/packages/wordpress-plugin/src/harper/useLintConfig.ts
+++ b/packages/wordpress-plugin/src/harper/useLintConfig.ts
@@ -1,8 +1,8 @@
-import { merge } from 'lodash-es';
import { useDispatch, useSelect } from '@wordpress/data';
-import { LintConfig } from 'harper.js';
-import { useLinter } from './LinterProvider';
+import type { LintConfig } from 'harper.js';
+import { merge } from 'lodash-es';
import { useCallback, useEffect, useMemo, useState } from 'react';
+import { useLinter } from './LinterProvider';
const KEY = 'lintConfig';
diff --git a/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts b/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts
index 9f630e4c4..c0563e400 100644
--- a/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts
+++ b/packages/wordpress-plugin/src/harper/usePersonalDictionary.ts
@@ -6,18 +6,18 @@ const KEY = 'personalDictionary';
/** Read and add to the user's personal dictionary. */
export default function usePersonalDictionary(): [
string[] | undefined,
- (updatedDictionary: string[]) => void
+ (updatedDictionary: string[]) => void,
] {
const personalDictionary = useSelect(
(select) => select('core/preferences').get('harper-wp', KEY),
- []
+ [],
);
const { set } = useDispatch('core/preferences');
const updateState = useCallback(
(updatedDictionary: string[]) => set('harper-wp', KEY, updatedDictionary),
- [set]
+ [set],
);
return [personalDictionary, updateState];
@@ -33,6 +33,6 @@ export function useAddToDictionary(): (word: string) => void {
setDict([...(dict ?? []), word]);
}
},
- [dict, setDict]
+ [dict, setDict],
);
}