forked from nodejs/remark-preset-lint-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
124 lines (119 loc) · 4.71 KB
/
index.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// @see https://github.com/nodejs/node/blob/HEAD/doc/README.md
import remarkGfm from "remark-gfm";
import remarkPresetLintRecommended from "remark-preset-lint-recommended";
import remarkLintBlockquoteIndentation from "remark-lint-blockquote-indentation";
import remarkLintCheckboxCharacterStyle from "remark-lint-checkbox-character-style";
import remarkLintCheckboxContentIndent from "remark-lint-checkbox-content-indent";
import remarkLintCodeBlockStyle from "remark-lint-code-block-style";
import remarkLintDefinitionSpacing from "remark-lint-definition-spacing";
import remarkLintFencedCodeFlag from "remark-lint-fenced-code-flag";
import remarkLintFencedCodeMarker from "remark-lint-fenced-code-marker";
import remarkLintFileExtension from "remark-lint-file-extension";
import remarkLintFinalDefinition from "remark-lint-final-definition";
import remarkLintFirstHeadingLevel from "remark-lint-first-heading-level";
import remarkLintHeadingStyle from "remark-lint-heading-style";
import remarkLintListItemIndent from "remark-lint-list-item-indent";
import remarkLintMaximumLineLength from "remark-lint-maximum-line-length";
import remarkLintNoConsecutiveBlankLines from "remark-lint-no-consecutive-blank-lines";
import remarkLintNoFileNameArticles from "remark-lint-no-file-name-articles";
import remarkLintNoFileNameConsecutiveDashes from "remark-lint-no-file-name-consecutive-dashes";
import remarkLintNofileNameOuterDashes from "remark-lint-no-file-name-outer-dashes";
import remarkLintNoHeadingIndent from "remark-lint-no-heading-indent";
import remarkLintNoMultipleToplevelHeadings from "remark-lint-no-multiple-toplevel-headings";
import remarkLintNoShellDollars from "remark-lint-no-shell-dollars";
import remarkLintNoTableIndentation from "remark-lint-no-table-indentation";
import remarkLintNoTabs from "remark-lint-no-tabs";
import remarkLintNoTrailingSpaces from "remark-lint-no-trailing-spaces";
import remarkLintNodejsLinks from "./remark-lint-nodejs-links.js";
import remarkLintNodejsYamlComments from "./remark-lint-nodejs-yaml-comments.js";
import remarkLintProhibitedStrings from "remark-lint-prohibited-strings";
import remarkLintRuleStyle from "remark-lint-rule-style";
import remarkLintStrongMarker from "remark-lint-strong-marker";
import remarkLintTableCellPadding from "remark-lint-table-cell-padding";
import remarkLintTablePipes from "remark-lint-table-pipes";
import remarkLintUnorderedListMarkerStyle from "remark-lint-unordered-list-marker-style";
// Add in rules alphabetically after Gfm and PresetLintRecommended.
const plugins = [
remarkGfm,
remarkPresetLintRecommended,
[remarkLintBlockquoteIndentation, 2],
[remarkLintCheckboxCharacterStyle, { checked: "x", unchecked: " " }],
remarkLintCheckboxContentIndent,
[remarkLintCodeBlockStyle, "fenced"],
remarkLintDefinitionSpacing,
[
remarkLintFencedCodeFlag,
{
flags: [
"bash",
"c",
"cjs",
"coffee",
"console",
"cpp",
"diff",
"http",
"js",
"json",
"markdown",
"mjs",
"powershell",
"r",
"text",
"ts",
],
},
],
[remarkLintFencedCodeMarker, "`"],
[remarkLintFileExtension, "md"],
remarkLintFinalDefinition,
[remarkLintFirstHeadingLevel, 1],
[remarkLintHeadingStyle, "atx"],
[remarkLintListItemIndent, "space"],
remarkLintMaximumLineLength,
remarkLintNoConsecutiveBlankLines,
remarkLintNoFileNameArticles,
remarkLintNoFileNameConsecutiveDashes,
remarkLintNofileNameOuterDashes,
remarkLintNoHeadingIndent,
remarkLintNoMultipleToplevelHeadings,
remarkLintNoShellDollars,
remarkLintNoTableIndentation,
remarkLintNoTabs,
remarkLintNoTrailingSpaces,
remarkLintNodejsLinks,
remarkLintNodejsYamlComments,
[
remarkLintProhibitedStrings,
[
{ yes: "End-of-Life" },
{ no: "filesystem", yes: "file system" },
{ yes: "GitHub" },
{ no: "hostname", yes: "host name" },
{ yes: "JavaScript" },
{ no: "[Ll]ong[ -][Tt]erm [Ss]upport", yes: "Long Term Support" },
{ no: "Node", yes: "Node.js", ignoreNextTo: "-API" },
{ yes: "Node.js" },
{ no: "Node[Jj][Ss]", yes: "Node.js" },
{ no: "Node\\.js's?", yes: "the Node.js" },
{ no: "[Nn]ote that", yes: "<nothing>" },
{ yes: "RFC" },
{ no: "[Rr][Ff][Cc]\\d+", yes: "RFC <number>" },
{ yes: "Unix" },
{ yes: "Valgrind" },
{ yes: "V8" },
],
],
remarkLintRuleStyle,
[remarkLintStrongMarker, "*"],
[remarkLintTableCellPadding, "padded"],
remarkLintTablePipes,
[remarkLintUnorderedListMarkerStyle, "*"],
];
const settings = {
emphasis: "_",
listItemIndent: "one",
tightDefinitions: true,
};
const remarkPresetLintNode = { plugins, settings };
export default remarkPresetLintNode;