-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Expand file tree
/
Copy pathapi.mjs
More file actions
73 lines (68 loc) · 2.44 KB
/
api.mjs
File metadata and controls
73 lines (68 loc) · 2.44 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
import remarkLintFencedCodeFlag from 'remark-lint-fenced-code-flag';
import remarkLintMaximumLineLength from 'remark-lint-maximum-line-length';
import remarkLintNoUnusedDefinitions from 'remark-lint-no-unused-definitions';
import remarkLintProhibitedStrings from 'remark-lint-prohibited-strings';
import remarkLintUnorderedListMarkerStyle from 'remark-lint-unordered-list-marker-style';
import basePreset from './index.mjs';
import duplicateStabilityNodes from './rules/duplicate-stability-nodes.mjs';
import hashedSelfReference from './rules/hashed-self-reference.mjs';
import invalidDeprecations from './rules/invalid-deprecations.mjs';
import invalidTypeReference from './rules/invalid-type-reference.mjs';
import orderedReferences from './rules/ordered-references.mjs';
import requiredMetadata from './rules/required-metadata.mjs';
import yamlComments from './rules/yaml/index.mjs';
/**
* @typedef {Object} Options
* @property {Array<string>} releasedVersions The released versions, for validating the YAML
* @property {Record<string, string>} typeMap The type map
*/
/**
* @param {Options} options
*/
export default (options = {}) => ({
settings: {
...basePreset.settings,
bullet: '*',
},
plugins: [
...basePreset.plugins,
// Internal Rules
...[
duplicateStabilityNodes,
yamlComments,
hashedSelfReference,
orderedReferences,
requiredMetadata,
invalidTypeReference,
invalidDeprecations,
].map(plugin => [plugin, options]),
// External Rules
remarkLintNoUnusedDefinitions,
[remarkLintFencedCodeFlag, { allowEmpty: false }],
[remarkLintMaximumLineLength, 120],
[remarkLintUnorderedListMarkerStyle, '*'],
[
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: 'TypeScript' },
{ yes: 'Unix' },
{ yes: 'Valgrind' },
{ yes: 'V8' },
{ yes: 'npm' },
],
],
],
});