-
Notifications
You must be signed in to change notification settings - Fork 1
/
lint.ts
51 lines (47 loc) · 1.6 KB
/
lint.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { createLinter, loadLinterFormatter } from "npm:[email protected]";
import { TextlintKernelDescriptor } from "npm:@textlint/[email protected]";
import { moduleInterop } from "npm:@textlint/[email protected]";
import * as jpPreset from "npm:[email protected]";
import * as proofdict from "npm:@proofdict/textlint-rule-proofdict@^3.1.2";
import * as aws from "npm:textlint-rule-aws-spellcheck@^1.3.0";
import * as markdownProcessor from "npm:@textlint/[email protected]";
const excludes = ["ja-no-weak-phrase"];
const presetRules = Object.entries(jpPreset.rules).map(([id, module]) => ({
ruleId: id,
rule: module as any,
options: {
...jpPreset.rulesConfig[id],
},
})).filter((rule) => !excludes.includes(rule.ruleId));
const descriptor: TextlintKernelDescriptor = new TextlintKernelDescriptor({
rules: [
{
ruleId: "aws-spellcheck",
rule: moduleInterop(aws.default),
},
{
ruleId: "@proofdict/proofdict",
rule: moduleInterop(proofdict.default),
options: {
dictURL: "https://azu.github.io/proof-dictionary/",
denyTags: ["opinion"],
},
},
...presetRules,
],
plugins: [{
pluginId: "@textlint/markdown",
plugin: moduleInterop(markdownProcessor.default) as any,
options: {
extensions: ".md",
},
}],
filterRules: [],
});
const linter = createLinter({
descriptor: descriptor,
});
const results = await linter.lintFiles([...Deno.args]);
const formatter = await loadLinterFormatter({ formatterName: "stylish" });
const output = formatter.format(results);
console.log(output);