Skip to content

Commit c5c87d8

Browse files
transitive-bullshitsindresorhus
authored andcommitted
Update dependencies and require Node.js 6 (sindresorhus#22)
Fixes sindresorhus#21
1 parent f2f4f63 commit c5c87d8

File tree

6 files changed

+126
-102
lines changed

6 files changed

+126
-102
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ language: node_js
22
node_js:
33
- '8'
44
- '6'
5-
- '4'

config.js

+53-73
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,59 @@
11
'use strict';
2-
const path = require('path');
32

4-
// Rules per remark-lint 4.0.2
3+
exports.plugins = [
4+
require('remark-lint'),
55

6-
module.exports = {
7-
reset: true,
8-
'blockquote-indentation': 2,
9-
'checkbox-character-style': {
6+
// Official plugins
7+
[require('remark-lint-blockquote-indentation'), 2],
8+
[require('remark-lint-checkbox-character-style'), {
109
checked: 'x',
1110
unchecked: ' '
12-
},
13-
'checkbox-content-indent': true,
14-
'code-block-style': 'fenced',
15-
'definition-case': true,
16-
'definition-spacing': true,
17-
'emphasis-marker': '*',
18-
'fenced-code-marker': '`',
19-
'file-extension': true,
20-
'final-newline': true,
21-
// TODO: because of https://github.com/wooorm/remark-lint/issues/77
22-
// 'first-heading-level': 1,
23-
'hard-break-spaces': true,
24-
'heading-style': 'atx',
25-
'link-title-style': '\'',
26-
'list-item-bullet-indent': true,
27-
'list-item-content-indent': true,
28-
'list-item-indent': 'space',
29-
// TODO: because of https://github.com/wooorm/remark-lint/issues/78
30-
// 'list-item-spacing': true,
31-
'no-auto-link-without-protocol': true,
32-
'no-blockquote-without-caret': true,
33-
'no-duplicate-definitions': true,
34-
// TODO: because of https://github.com/wooorm/remark-lint/issues/84
35-
// 'no-duplicate-headings': true,
36-
'no-emphasis-as-heading': true,
37-
'no-file-name-articles': true,
38-
'no-file-name-consecutive-dashes': true,
39-
'no-file-name-irregular-characters': true,
40-
'no-file-name-mixed-case': true,
41-
'no-file-name-outer-dashes': true,
42-
'no-heading-content-indent': true,
43-
'no-heading-indent': true,
44-
'no-heading-punctuation': true,
45-
'no-inline-padding': true,
46-
'no-literal-urls': true,
47-
// TODO: because of https://github.com/wooorm/remark-lint/issues/79
48-
// 'no-missing-blank-lines': true,
49-
'no-multiple-toplevel-headings': 1,
50-
'no-shell-dollars': true,
51-
'no-table-indentation': true,
52-
'no-undefined-references': true,
53-
'no-unused-definitions': true,
54-
'ordered-list-marker-style': '.',
55-
'ordered-list-marker-value': 'ordered',
56-
'rule-style': '---',
57-
'strong-marker': '*',
58-
'table-cell-padding': 'padded',
59-
'table-pipe-alignment': true,
60-
'table-pipes': true,
61-
'unordered-list-marker-style': '-',
11+
}],
12+
require('remark-lint-checkbox-content-indent'),
13+
[require('remark-lint-code-block-style'), 'fenced'],
14+
require('remark-lint-definition-case'),
15+
require('remark-lint-definition-spacing'),
16+
[require('remark-lint-emphasis-marker'), '*'],
17+
[require('remark-lint-fenced-code-marker'), '`'],
18+
require('remark-lint-file-extension'),
19+
require('remark-lint-final-newline'),
20+
require('remark-lint-hard-break-spaces'),
21+
[require('remark-lint-heading-style'), 'atx'],
22+
[require('remark-lint-link-title-style'), '\''],
23+
require('remark-lint-list-item-bullet-indent'),
24+
require('remark-lint-list-item-content-indent'),
25+
[require('remark-lint-list-item-indent'), 'space'],
26+
require('remark-lint-no-auto-link-without-protocol'),
27+
require('remark-lint-no-blockquote-without-marker'),
28+
require('remark-lint-no-emphasis-as-heading'),
29+
require('remark-lint-no-file-name-articles'),
30+
require('remark-lint-no-file-name-consecutive-dashes'),
31+
require('remark-lint-no-file-name-irregular-characters'),
32+
require('remark-lint-no-file-name-mixed-case'),
33+
require('remark-lint-no-file-name-outer-dashes'),
34+
require('remark-lint-no-heading-content-indent'),
35+
require('remark-lint-no-heading-indent'),
36+
require('remark-lint-no-heading-punctuation'),
37+
require('remark-lint-no-inline-padding'),
38+
require('remark-lint-no-literal-urls'),
39+
[require('remark-lint-no-multiple-toplevel-headings'), 1],
40+
require('remark-lint-no-shell-dollars'),
41+
require('remark-lint-no-table-indentation'),
42+
require('remark-lint-no-undefined-references'),
43+
require('remark-lint-no-unused-definitions'),
44+
[require('remark-lint-ordered-list-marker-style'), '.'],
45+
[require('remark-lint-ordered-list-marker-value'), 'ordered'],
46+
[require('remark-lint-rule-style'), '---'],
47+
[require('remark-lint-strong-marker'), '*'],
48+
[require('remark-lint-table-cell-padding'), 'padded'],
49+
require('remark-lint-table-pipe-alignment'),
50+
require('remark-lint-table-pipes'),
51+
[require('remark-lint-unordered-list-marker-style'), '-'],
6252

63-
// Plugins
64-
external: [
65-
'remark-lint-no-empty-sections',
66-
'remark-lint-no-url-trailing-slash',
67-
// 'remark-lint-are-links-valid',
68-
path.join(__dirname, 'rules')
69-
],
70-
'empty-sections': true,
71-
'trailing-slash': true,
72-
// This rule is a good idea, but in reality it's way too slow and has too many false positives
73-
// 'are-links-valid': {
74-
// // TODO: The error message is too unclear here. Make a rule that disallows redirects
75-
// // allowRedirects: false,
76-
// timeout: 2000
77-
// },
78-
'awesome/badge': true
79-
};
53+
// Third-party plugins
54+
require('remark-lint-no-empty-sections'),
55+
require('remark-lint-no-url-trailing-slash'),
56+
57+
// Custom plugins
58+
...require('./rules')
59+
];

index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22
const remark = require('remark');
3-
const remarkLint = require('remark-lint');
43
const globby = require('globby');
54
const pify = require('pify');
65
const toVfile = require('to-vfile');
@@ -18,21 +17,21 @@ const m = opts => {
1817
return Promise.reject(new Error(`Couldn't find the file ${opts.filename}`));
1918
}
2019

21-
const run = remark().use(remarkLint, config).process;
20+
const run = remark().use(config).process;
2221
const file = toVfile.readSync(readmeFile);
2322

2423
return pify(run)(file);
2524
};
2625

2726
m.report = opts => m(opts).then(file => {
28-
const messages = file.messages;
27+
const {messages} = file;
2928

3029
if (messages.length === 0) {
3130
return;
3231
}
3332

3433
messages.forEach(x => {
35-
x.fatal = true; // TODO: because of https://github.com/wooorm/remark-lint/issues/65
34+
x.fatal = true; // eslint-ignore-line TODO: because of https://github.com/wooorm/remark-lint/issues/65
3635
});
3736

3837
process.exitCode = 1;

package.json

+53-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"bin": "cli.js",
1313
"engines": {
14-
"node": ">=4"
14+
"node": ">=6"
1515
},
1616
"scripts": {
1717
"test": "xo && ava"
@@ -34,20 +34,63 @@
3434
"cli"
3535
],
3636
"dependencies": {
37-
"globby": "^6.0.0",
38-
"meow": "^3.7.0",
37+
"globby": "^8.0.1",
38+
"meow": "^5.0.0",
3939
"pify": "^3.0.0",
40-
"remark": "^5.0.1",
41-
"remark-lint": "^4.1.0",
42-
"remark-lint-no-empty-sections": "^1.0.0",
43-
"remark-lint-no-url-trailing-slash": "^2.0.0",
44-
"to-vfile": "^1.0.0",
40+
"remark": "^9.0.0",
41+
"remark-lint": "^6.0.2",
42+
"remark-lint-blockquote-indentation": "^1.0.2",
43+
"remark-lint-checkbox-character-style": "^1.0.2",
44+
"remark-lint-checkbox-content-indent": "^1.0.2",
45+
"remark-lint-code-block-style": "^1.0.2",
46+
"remark-lint-definition-case": "^1.0.2",
47+
"remark-lint-definition-spacing": "^1.0.2",
48+
"remark-lint-emphasis-marker": "^1.0.2",
49+
"remark-lint-fenced-code-marker": "^1.0.2",
50+
"remark-lint-file-extension": "^1.0.2",
51+
"remark-lint-final-newline": "^1.0.2",
52+
"remark-lint-hard-break-spaces": "^1.0.3",
53+
"remark-lint-heading-style": "^1.0.2",
54+
"remark-lint-link-title-style": "^1.0.2",
55+
"remark-lint-list-item-bullet-indent": "^1.0.2",
56+
"remark-lint-list-item-content-indent": "^1.0.2",
57+
"remark-lint-list-item-indent": "^1.0.2",
58+
"remark-lint-no-auto-link-without-protocol": "^1.0.2",
59+
"remark-lint-no-blockquote-without-marker": "^2.0.2",
60+
"remark-lint-no-emphasis-as-heading": "^1.0.2",
61+
"remark-lint-no-empty-sections": "^2.0.0",
62+
"remark-lint-no-file-name-articles": "^1.0.2",
63+
"remark-lint-no-file-name-consecutive-dashes": "^1.0.2",
64+
"remark-lint-no-file-name-irregular-characters": "^1.0.2",
65+
"remark-lint-no-file-name-mixed-case": "^1.0.2",
66+
"remark-lint-no-file-name-outer-dashes": "^1.0.3",
67+
"remark-lint-no-heading-content-indent": "^1.0.2",
68+
"remark-lint-no-heading-indent": "^1.0.2",
69+
"remark-lint-no-heading-punctuation": "^1.0.2",
70+
"remark-lint-no-inline-padding": "^1.0.2",
71+
"remark-lint-no-literal-urls": "^1.0.2",
72+
"remark-lint-no-multiple-toplevel-headings": "^1.0.2",
73+
"remark-lint-no-shell-dollars": "^1.0.2",
74+
"remark-lint-no-table-indentation": "^1.0.2",
75+
"remark-lint-no-undefined-references": "^1.0.2",
76+
"remark-lint-no-unused-definitions": "^1.0.2",
77+
"remark-lint-no-url-trailing-slash": "^3.0.1",
78+
"remark-lint-ordered-list-marker-style": "^1.0.2",
79+
"remark-lint-ordered-list-marker-value": "^1.0.2",
80+
"remark-lint-rule-style": "^1.0.2",
81+
"remark-lint-strong-marker": "^1.0.2",
82+
"remark-lint-table-cell-padding": "^1.0.2",
83+
"remark-lint-table-pipe-alignment": "^1.0.2",
84+
"remark-lint-table-pipes": "^1.0.2",
85+
"remark-lint-unordered-list-marker-style": "^1.0.2",
86+
"to-vfile": "^5.0.0",
87+
"unified-lint-rule": "^1.0.3",
4588
"unist-util-visit": "^1.1.0",
46-
"vfile-reporter-pretty": "^0.1.0"
89+
"vfile-reporter-pretty": "^1.0.2"
4790
},
4891
"devDependencies": {
4992
"ava": "*",
50-
"execa": "^0.8.0",
93+
"execa": "^0.10.0",
5194
"xo": "*"
5295
}
5396
}

rules/badge.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict';
2+
const rule = require('unified-lint-rule');
23
const visit = require('unist-util-visit');
34

4-
module.exports = (ast, file) => {
5+
module.exports = rule('remark-lint:awesome/badge', (ast, file) => {
56
visit(ast, 'heading', (node, index) => {
67
if (index > 0) {
78
return;
@@ -13,22 +14,24 @@ module.exports = (ast, file) => {
1314
let hasBadge = false;
1415

1516
for (const child of node.children) {
16-
if (node.depth === 1 && child.type === 'link' && child.url === badgeUrl) {
17-
for (const child2 of child.children) {
18-
if (child2.type === 'image') {
19-
if (child2.url !== badgeSrcUrl) {
20-
file.warn('Incorrect badge source', child2);
21-
return;
22-
}
17+
if (node.depth !== 1 || child.type !== 'link' || child.url !== badgeUrl) {
18+
continue;
19+
}
2320

24-
hasBadge = true;
21+
for (const child2 of child.children) {
22+
if (child2.type === 'image') {
23+
if (child2.url !== badgeSrcUrl) {
24+
file.message('Incorrect badge source', child2);
25+
return;
2526
}
27+
28+
hasBadge = true;
2629
}
2730
}
2831
}
2932

3033
if (!hasBadge) {
31-
file.warn('Missing Awesome badge after the main heading', node);
34+
file.message('Missing Awesome badge after the main heading', node);
3235
}
3336
});
34-
};
37+
});

rules/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
22

3-
module.exports = {
4-
'awesome/badge': require('./badge')
5-
};
3+
module.exports = [
4+
require('./badge')
5+
];

0 commit comments

Comments
 (0)