Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
docs(harper.js): wrote page about `LintConfig`
Elijah Potter3518638387b9
diff --git a/packages/web/src/routes/docs/harperjs/configurerules/+page.md b/packages/web/src/routes/docs/harperjs/configurerules/+page.mdnew file mode 100644index 000000000..4771cd381--- /dev/null+++ b/packages/web/src/routes/docs/harperjs/configurerules/+page.md@@ -0,0 +1,21 @@+---+title: Configure Rules+---++We add new [rules](/docs/rules) to Harper on a daily basis.+As such, it is not recommended for consumers of `harper.js` to rely on any rule to exist.+Further, consumers should allow space (in their UI, database, etc.) for additional rules to be added whenever a new version of `harper.js` is published.++To make this easier, `harper.js` exposes a [`LintConfig`](/docs/harperjs/ref/harper.js.lintconfig.html) type, which can be obtained via `Linter.getLintConfig` and written using `Linter.setLintConfig`.++Each key refers to a specific rule. Each rule can be disabled (set the value to `false`), enabled (set the value to `true`), or to the default (set the value to `undefined`).+For example, the following code disables `SpellCheck`, enables `ExplanationMarks`, and sets `SameAs` to assume the default value.++```javascript+let linter = new WorkerLinter();++await linter.setLintConfig({+ SpellCheck: false,+ ExplanationMarks: true,+});+```diff --git a/packages/web/vite.config.ts b/packages/web/vite.config.tsindex 136bb471f..0208b184e 100644--- a/packages/web/vite.config.ts+++ b/packages/web/vite.config.ts@@ -90,6 +90,10 @@ export default defineConfig({title: 'Linting',to: '/docs/harperjs/linting',},+ {+ title: 'Configure Rules',+ to: '/docs/harperjs/configurerules',+ },{title: 'Node.js',to: '/docs/harperjs/node',