forked from jsx-eslint/eslint-plugin-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
markdown.config.js
40 lines (33 loc) · 995 Bytes
/
markdown.config.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
'use strict';
/* eslint-disable no-restricted-syntax */
const {rules} = require('./index');
const ruleTableRows = Object.keys(rules)
.sort()
.map((id) => {
const {meta} = rules[id];
const {fixable, docs} = meta;
return [
docs.recommended ? '✔' : '',
fixable ? '🔧' : '',
`[react/${id}](docs/rules/${id}.md)`,
docs.description
].join(' | ');
});
const buildRulesTable = (rows) => {
const header = '✔ | 🔧 | Rule | Description';
const separator = ':---: | :---: | :--- | :---';
return [header, separator, ...rows]
.map((row) => `| ${row} |`)
.join('\n');
};
const BASIC_RULES = () => buildRulesTable(ruleTableRows.filter((rule) => !rule.includes('react/jsx-')));
const JSX_RULES = () => buildRulesTable(ruleTableRows.filter((rule) => rule.includes('react/jsx-')));
module.exports = {
transforms: {
BASIC_RULES,
JSX_RULES
},
callback: () => {
console.log('The auto-generating of rules finished!');
}
};