-
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathconfig.js
More file actions
112 lines (104 loc) · 5.06 KB
/
Copy pathconfig.js
File metadata and controls
112 lines (104 loc) · 5.06 KB
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
import remarkLint from 'remark-lint';
import remarkGfm from 'remark-gfm';
import blockquoteIndentation from 'remark-lint-blockquote-indentation';
import checkboxCharacterStyle from 'remark-lint-checkbox-character-style';
import checkboxContentIndent from 'remark-lint-checkbox-content-indent';
import codeBlockStyle from 'remark-lint-code-block-style';
import definitionCase from 'remark-lint-definition-case';
import definitionSpacing from 'remark-lint-definition-spacing';
import emphasisMarker from 'remark-lint-emphasis-marker';
import fencedCodeMarker from 'remark-lint-fenced-code-marker';
import fileExtension from 'remark-lint-file-extension';
import finalNewline from 'remark-lint-final-newline';
import hardBreakSpaces from 'remark-lint-hard-break-spaces';
import headingStyle from 'remark-lint-heading-style';
import linkTitleStyle from 'remark-lint-link-title-style';
import listItemBulletIndent from 'remark-lint-list-item-bullet-indent';
import listItemIndent from 'remark-lint-list-item-indent';
import noBlockquoteWithoutMarker from 'remark-lint-no-blockquote-without-marker';
import noEmphasisAsHeading from 'remark-lint-no-emphasis-as-heading';
import noFileNameArticles from 'remark-lint-no-file-name-articles';
import noFileNameConsecutiveDashes from 'remark-lint-no-file-name-consecutive-dashes';
import noFileNameIrregularCharacters from 'remark-lint-no-file-name-irregular-characters';
import noFileNameMixedCase from 'remark-lint-no-file-name-mixed-case';
import noFileNameOuterDashes from 'remark-lint-no-file-name-outer-dashes';
import noHeadingContentIndent from 'remark-lint-no-heading-content-indent';
import noHeadingIndent from 'remark-lint-no-heading-indent';
import noHeadingPunctuation from 'remark-lint-no-heading-punctuation';
import noMultipleToplevelHeadings from 'remark-lint-no-multiple-toplevel-headings';
import noShellDollars from 'remark-lint-no-shell-dollars';
import noTableIndentation from 'remark-lint-no-table-indentation';
import noUndefinedReferences from 'remark-lint-no-undefined-references';
import noUnneededFullReferenceImage from 'remark-lint-no-unneeded-full-reference-image';
import noUnneededFullReferenceLink from 'remark-lint-no-unneeded-full-reference-link';
import noUnusedDefinitions from 'remark-lint-no-unused-definitions';
import orderedListMarkerStyle from 'remark-lint-ordered-list-marker-style';
import orderedListMarkerValue from 'remark-lint-ordered-list-marker-value';
import ruleStyle from 'remark-lint-rule-style';
import strongMarker from 'remark-lint-strong-marker';
import tableCellPadding from 'remark-lint-table-cell-padding';
import tablePipeAlignment from 'remark-lint-table-pipe-alignment';
import tablePipes from 'remark-lint-table-pipes';
import unorderedListMarkerStyle from 'remark-lint-unordered-list-marker-style';
import noRepeatPunctuation from 'remark-lint-no-repeat-punctuation';
import defaultCustomRules from './rules/index.js';
export const createConfig = (customRules = defaultCustomRules) => [
remarkLint,
remarkGfm, // Enable GitHub Flavored Markdown (including footnotes)
// Official plugins
[blockquoteIndentation, ['error', 2]],
[checkboxCharacterStyle, ['error', 'consistent']],
[checkboxContentIndent, ['error']],
[codeBlockStyle, ['error', 'fenced']],
[definitionCase, ['error']],
[definitionSpacing, ['error']],
[emphasisMarker, ['error', 'consistent']],
[fencedCodeMarker, ['error', '`']],
[fileExtension, ['error']],
[finalNewline, ['error']],
[hardBreakSpaces, ['error']],
[headingStyle, ['error', 'atx']],
[linkTitleStyle, ['error', '\'']],
// TODO: this rule doesn't properly handle tab indents
// require('remark-lint-list-item-content-indent'),
[listItemBulletIndent, ['error']],
[listItemIndent, ['error', 'one']],
[noBlockquoteWithoutMarker, ['error']],
[noEmphasisAsHeading, ['error']],
[noFileNameArticles, ['error']],
[noFileNameConsecutiveDashes, ['error']],
[noFileNameIrregularCharacters, ['error']],
[noFileNameMixedCase, ['error']],
[noFileNameOuterDashes, ['error']],
[noHeadingContentIndent, ['error']],
[noHeadingIndent, ['error']],
[noHeadingPunctuation, ['error']],
[noMultipleToplevelHeadings, ['error', 1]],
[noShellDollars, ['error']],
[noTableIndentation, ['error']],
[noUndefinedReferences, ['error', {
allow: [
/^!(?:note|tip|important|warning|caution)$/i, // Allow GitHub alerts
/^\^.+$/, // Allow footnotes
],
}]],
[noUnneededFullReferenceImage, ['error']],
[noUnneededFullReferenceLink, ['error']],
[noUnusedDefinitions, ['error']],
[orderedListMarkerStyle, ['error', 'consistent']],
[orderedListMarkerValue, ['error', 'ordered']],
[ruleStyle, ['error', '---']],
[strongMarker, ['error', 'consistent']],
[tableCellPadding, ['error', 'consistent']],
[tablePipeAlignment, ['error']],
[tablePipes, ['error']],
[unorderedListMarkerStyle, ['error', 'consistent']],
// Third-party plugins
// Disabled as it throws `file.warn is not a function`
// require('remark-lint-no-empty-sections'),
[noRepeatPunctuation, ['error', '!!~~,,·??']], // Exclude dots to allow ellipsis (...)
// Custom plugins
...customRules,
];
const config = createConfig();
export default config;