Skip to content

Commit e2bc015

Browse files
committed
tools: update markdown linter
Update remark-preset-lint-node to 1.4.0. This adds `End-Of-Life` as a prohibited string, favoring `End-of-Life` for consistency. Refs: nodejs#26251
1 parent 7e0ddf6 commit e2bc015

File tree

3 files changed

+121
-101
lines changed

3 files changed

+121
-101
lines changed

tools/lint-md.js

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3897,7 +3897,7 @@ function resolvePlugin(name, options) {
38973897

38983898
module.exports = function (args, opts) {
38993899
if (!opts) opts = {};
3900-
3900+
39013901
var flags = { bools : {}, strings : {}, unknownFn: null };
39023902

39033903
if (typeof opts['unknown'] === 'function') {
@@ -3911,7 +3911,7 @@ module.exports = function (args, opts) {
39113911
flags.bools[key] = true;
39123912
});
39133913
}
3914-
3914+
39153915
var aliases = {};
39163916
Object.keys(opts.alias || {}).forEach(function (key) {
39173917
aliases[key] = [].concat(opts.alias[key]);
@@ -3930,12 +3930,12 @@ module.exports = function (args, opts) {
39303930
});
39313931

39323932
var defaults = opts['default'] || {};
3933-
3933+
39343934
var argv = { _ : [] };
39353935
Object.keys(flags.bools).forEach(function (key) {
39363936
setArg(key, defaults[key] === undefined ? false : defaults[key]);
39373937
});
3938-
3938+
39393939
var notFlags = [];
39403940

39413941
if (args.indexOf('--') !== -1) {
@@ -3957,7 +3957,7 @@ module.exports = function (args, opts) {
39573957
? Number(val) : val
39583958
;
39593959
setKey(argv, key.split('.'), value);
3960-
3960+
39613961
(aliases[key] || []).forEach(function (x) {
39623962
setKey(argv, x.split('.'), value);
39633963
});
@@ -3981,7 +3981,7 @@ module.exports = function (args, opts) {
39813981
o[key] = [ o[key], value ];
39823982
}
39833983
}
3984-
3984+
39853985
function aliasIsBoolean(key) {
39863986
return aliases[key].some(function (x) {
39873987
return flags.bools[x];
@@ -3990,7 +3990,7 @@ module.exports = function (args, opts) {
39903990

39913991
for (var i = 0; i < args.length; i++) {
39923992
var arg = args[i];
3993-
3993+
39943994
if (/^--.+=/.test(arg)) {
39953995
// Using [\s\S] instead of . because js doesn't support the
39963996
// 'dotall' regex modifier. See:
@@ -4027,29 +4027,29 @@ module.exports = function (args, opts) {
40274027
}
40284028
else if (/^-[^-]+/.test(arg)) {
40294029
var letters = arg.slice(1,-1).split('');
4030-
4030+
40314031
var broken = false;
40324032
for (var j = 0; j < letters.length; j++) {
40334033
var next = arg.slice(j+2);
4034-
4034+
40354035
if (next === '-') {
40364036
setArg(letters[j], next, arg)
40374037
continue;
40384038
}
4039-
4039+
40404040
if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
40414041
setArg(letters[j], next.split('=')[1], arg);
40424042
broken = true;
40434043
break;
40444044
}
4045-
4045+
40464046
if (/[A-Za-z]/.test(letters[j])
40474047
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
40484048
setArg(letters[j], next, arg);
40494049
broken = true;
40504050
break;
40514051
}
4052-
4052+
40534053
if (letters[j+1] && letters[j+1].match(/\W/)) {
40544054
setArg(letters[j], arg.slice(j+2), arg);
40554055
broken = true;
@@ -4059,7 +4059,7 @@ module.exports = function (args, opts) {
40594059
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
40604060
}
40614061
}
4062-
4062+
40634063
var key = arg.slice(-1)[0];
40644064
if (!broken && key !== '-') {
40654065
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
@@ -4089,17 +4089,17 @@ module.exports = function (args, opts) {
40894089
}
40904090
}
40914091
}
4092-
4092+
40934093
Object.keys(defaults).forEach(function (key) {
40944094
if (!hasKey(argv, key.split('.'))) {
40954095
setKey(argv, key.split('.'), defaults[key]);
4096-
4096+
40974097
(aliases[key] || []).forEach(function (x) {
40984098
setKey(argv, x.split('.'), defaults[key]);
40994099
});
41004100
}
41014101
});
4102-
4102+
41034103
if (opts['--']) {
41044104
argv['--'] = new Array();
41054105
notFlags.forEach(function(key) {
@@ -26609,15 +26609,15 @@ module.exports = function (rows_, opts) {
2660926609
var stringLength = opts.stringLength
2661026610
|| function (s) { return String(s).length; }
2661126611
;
26612-
26612+
2661326613
var dotsizes = reduce(rows_, function (acc, row) {
2661426614
forEach(row, function (c, ix) {
2661526615
var n = dotindex(c);
2661626616
if (!acc[ix] || n > acc[ix]) acc[ix] = n;
2661726617
});
2661826618
return acc;
2661926619
}, []);
26620-
26620+
2662126621
var rows = map(rows_, function (row) {
2662226622
return map(row, function (c_, ix) {
2662326623
var c = String(c_);
@@ -26631,15 +26631,15 @@ module.exports = function (rows_, opts) {
2663126631
else return c;
2663226632
});
2663326633
});
26634-
26634+
2663526635
var sizes = reduce(rows, function (acc, row) {
2663626636
forEach(row, function (c, ix) {
2663726637
var n = stringLength(c);
2663826638
if (!acc[ix] || n > acc[ix]) acc[ix] = n;
2663926639
});
2664026640
return acc;
2664126641
}, []);
26642-
26642+
2664326643
return map(rows, function (row) {
2664426644
return map(row, function (c, ix) {
2664526645
var n = (sizes[ix] - stringLength(c)) || 0;
@@ -26652,7 +26652,7 @@ module.exports = function (rows_, opts) {
2665226652
+ c + Array(Math.floor(n / 2 + 1)).join(' ')
2665326653
;
2665426654
}
26655-
26655+
2665626656
return c + s;
2665726657
}).join(hsep).replace(/\s+$/, '');
2665826658
}).join('\n');
@@ -35184,13 +35184,13 @@ function tableCell(node) {
3518435184
/* 302 */
3518535185
/***/ (function(module) {
3518635186

35187-
module.exports = {"name":"remark","version":"10.0.0","description":"Markdown processor powered by plugins","license":"MIT","keywords":["markdown","abstract","syntax","tree","ast","parse","stringify","process"],"homepage":"http://remark.js.org","repository":"https://github.com/remarkjs/remark/tree/master/packages/remark","bugs":"https://github.com/remarkjs/remark/issues","author":"Titus Wormer <[email protected]> (http://wooorm.com)","contributors":["Titus Wormer <[email protected]> (http://wooorm.com)"],"files":["index.js"],"dependencies":{"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"},"devDependencies":{"tape":"^4.9.1"},"scripts":{"test":"tape test.js"},"xo":false,"_resolved":"https://registry.npmjs.org/remark/-/remark-10.0.0.tgz","_integrity":"sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==","_from":"[email protected]"};
35187+
module.exports = {"_args":[["[email protected]","/Users/trott/io.js/tools/node-lint-md-cli-rollup"]],"_from":"[email protected]","_id":"[email protected]","_inBundle":false,"_integrity":"sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==","_location":"/remark","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"[email protected]","name":"remark","escapedName":"remark","rawSpec":"10.0.0","saveSpec":null,"fetchSpec":"10.0.0"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/remark/-/remark-10.0.0.tgz","_spec":"10.0.0","_where":"/Users/trott/io.js/tools/node-lint-md-cli-rollup","author":{"name":"Titus Wormer","email":"[email protected]","url":"http://wooorm.com"},"bugs":{"url":"https://github.com/remarkjs/remark/issues"},"contributors":[{"name":"Titus Wormer","email":"[email protected]","url":"http://wooorm.com"}],"dependencies":{"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"},"description":"Markdown processor powered by plugins","devDependencies":{"tape":"^4.9.1"},"files":["index.js"],"homepage":"http://remark.js.org","keywords":["markdown","abstract","syntax","tree","ast","parse","stringify","process"],"license":"MIT","name":"remark","repository":{"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"},"scripts":{"test":"tape test.js"},"version":"10.0.0","xo":false};
3518835188

3518935189
/***/ }),
3519035190
/* 303 */
3519135191
/***/ (function(module) {
3519235192

35193-
module.exports = {"name":"node-lint-md-cli-rollup","description":"remark packaged for node markdown linting","version":"1.0.0","devDependencies":{"@zeit/ncc":"^0.2.0"},"dependencies":{"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.3.1","unified-args":"^6.0.0","unified-engine":"^5.1.0"},"main":"src/cli-entry.js","scripts":{"build":"ncc build","build-node":"npm run build && cp dist/index.js ../lint-md.js"}};
35193+
module.exports = {"name":"node-lint-md-cli-rollup","description":"remark packaged for node markdown linting","version":"1.0.0","devDependencies":{"@zeit/ncc":"^0.2.0"},"dependencies":{"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.4.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"},"main":"src/cli-entry.js","scripts":{"build":"ncc build","build-node":"npm run build && cp dist/index.js ../lint-md.js"}};
3519435194

3519535195
/***/ }),
3519635196
/* 304 */
@@ -35210,10 +35210,7 @@ module.exports.plugins = [
3521035210
__webpack_require__(316),
3521135211
__webpack_require__(93),
3521235212
__webpack_require__(93),
35213-
[
35214-
__webpack_require__(317),
35215-
'space'
35216-
],
35213+
[__webpack_require__(317), "space"],
3521735214
__webpack_require__(320),
3521835215
__webpack_require__(321),
3521935216
__webpack_require__(322),
@@ -35237,25 +35234,27 @@ module.exports.plugins = [
3523735234
[
3523835235
__webpack_require__(340),
3523935236
{
35240-
'checked': 'x', 'unchecked': ' '
35237+
checked: "x",
35238+
unchecked: " "
3524135239
}
3524235240
],
35243-
[__webpack_require__(341), 'fenced'],
35244-
[__webpack_require__(342), '`'],
35245-
[__webpack_require__(343), 'md'],
35241+
[__webpack_require__(341), "fenced"],
35242+
[__webpack_require__(342), "`"],
35243+
[__webpack_require__(343), "md"],
3524635244
[__webpack_require__(344), 1],
35247-
[__webpack_require__(345), 'atx'],
35245+
[__webpack_require__(345), "atx"],
3524835246
[
3524935247
__webpack_require__(346),
3525035248
[
35251-
{ no: 'Github', yes: 'GitHub' },
35252-
{ no: 'Javascript', yes: 'JavaScript' },
35253-
{ no: 'Node.JS', yes: 'Node.js' },
35254-
{ no: 'v8', yes: 'V8' }
35249+
{ no: "End-Of-Life", yes: "End-of-Life" },
35250+
{ no: "Github", yes: "GitHub" },
35251+
{ no: "Javascript", yes: "JavaScript" },
35252+
{ no: "Node.JS", yes: "Node.js" },
35253+
{ no: "v8", yes: "V8" }
3525535254
]
3525635255
],
35257-
[__webpack_require__(347), '*'],
35258-
[__webpack_require__(348), 'padded']
35256+
[__webpack_require__(347), "*"],
35257+
[__webpack_require__(348), "padded"]
3525935258
];
3526035259

3526135260

@@ -36842,7 +36841,7 @@ module.exports = {"addendum":"addenda","aircraft":"aircraft","alga":"algae","alu
3684236841
* Options: `number`, default: `80`.
3684336842
*
3684436843
* Ignores nodes that cannot be wrapped, such as headings, tables,
36845-
* code, and definitions.
36844+
* code, definitions, HTML, and JSX.
3684636845
*
3684736846
* Ignores images, links, and inline code if they start before the wrap, end
3684836847
* after the wrap, and there’s no white-space after them.
@@ -36868,6 +36867,8 @@ module.exports = {"addendum":"addenda","aircraft":"aircraft","alga":"algae","alu
3686836867
* | -- | --------- | -- | ---- | ------ | -- | ---- | ------ | ------- | ----- | ----- | ---- |
3686936868
* | be | helped | | | | | | | | | | . |
3687036869
*
36870+
* <a><b><i><p><q><s><u>alpha bravo charlie delta echo foxtrot golf</u></s></q></p></i></b></a>
36871+
*
3687136872
* The following is also fine, because there is no white-space.
3687236873
*
3687336874
* <http://this-long-url-with-a-long-domain-is-invalid.co.uk/a-long-path?query=variables>.
@@ -36941,10 +36942,11 @@ function maximumLineLength(tree, file, pref) {
3694136942
var index = -1
3694236943
var lineLength
3694336944

36944-
visit(tree, ['heading', 'table', 'code', 'definition'], ignore)
36945+
// Note: JSX is from MDX: <https://github.com/mdx-js/specification>.
36946+
visit(tree, ['heading', 'table', 'code', 'definition', 'html', 'jsx'], ignore)
3694536947
visit(tree, ['link', 'image', 'inlineCode'], inline)
3694636948

36947-
/* Iterate over every line, and warn for violating lines. */
36949+
// Iterate over every line, and warn for violating lines.
3694836950
while (++index < length) {
3694936951
lineLength = lines[index].length
3695036952

@@ -36956,9 +36958,9 @@ function maximumLineLength(tree, file, pref) {
3695636958
}
3695736959
}
3695836960

36959-
/* Finally, whitelist some inline spans, but only if they occur at or after
36960-
* the wrap. However, when they do, and there’s white-space after it, they
36961-
* are not whitelisted. */
36961+
// Finally, whitelist some inline spans, but only if they occur at or after
36962+
// the wrap. However, when they do, and there’s white-space after it, they
36963+
// are not whitelisted.
3696236964
function inline(node, pos, parent) {
3696336965
var next = parent.children[pos + 1]
3696436966
var initial
@@ -36972,13 +36974,12 @@ function maximumLineLength(tree, file, pref) {
3697236974
initial = start(node)
3697336975
final = end(node)
3697436976

36975-
/* No whitelisting when starting after the border, or ending before it. */
36977+
// No whitelisting when starting after the border, or ending before it.
3697636978
if (initial.column > style || final.column < style) {
3697736979
return
3697836980
}
3697936981

36980-
/* No whitelisting when there’s white-space after
36981-
* the link. */
36982+
// No whitelisting when there’s white-space after the link.
3698236983
if (
3698336984
next &&
3698436985
start(next).line === initial.line &&
@@ -36997,7 +36998,7 @@ function maximumLineLength(tree, file, pref) {
3699736998
}
3699836999
}
3699937000

37000-
/* Whitelist from `initial` to `final`, zero-based. */
37001+
// Whitelist from `initial` to `final`, zero-based.
3700137002
function whitelist(initial, final) {
3700237003
while (initial < final) {
3700337004
lines[initial++] = ''
@@ -39599,16 +39600,16 @@ function tableCellPadding(tree, file, pref) {
3959939600
var entry
3960039601
var final
3960139602

39602-
/* Check rows. */
39603+
// Check rows.
3960339604
while (++index < length) {
3960439605
row = rows[index]
3960539606
cells = row.children
3960639607
cellCount = cells.length
39607-
column = -2 /* Start without a first cell */
39608+
column = -2 // Start without a first cell.
3960839609
next = null
3960939610
final = undefined
3961039611

39611-
/* Check fences (before, between, and after cells) */
39612+
// Check fences (before, between, and after cells).
3961239613
while (++column < cellCount) {
3961339614
cell = next
3961439615
next = cells[column + 1]
@@ -39623,7 +39624,7 @@ function tableCellPadding(tree, file, pref) {
3962339624
if (cell && cell.children.length !== 0 && final !== undefined) {
3962439625
entries.push({node: cell, start: final, end: pos, index: column})
3962539626

39626-
/* Detect max space per column. */
39627+
// Detect max space per column.
3962739628
sizes[column] = Math.max(sizes[column] || 0, size(cell))
3962839629
} else {
3962939630
final = undefined
@@ -39670,7 +39671,7 @@ function tableCellPadding(tree, file, pref) {
3967039671
if (style === 0) {
3967139672
reason += 'compact'
3967239673

39673-
/* Ignore every cell except the biggest in the column. */
39674+
// Ignore every cell except the biggest in the column.
3967439675
if (size(cell) < sizes[index]) {
3967539676
return
3967639677
}
@@ -39680,7 +39681,7 @@ function tableCellPadding(tree, file, pref) {
3968039681
if (spacing > style) {
3968139682
reason += ' with 1 space, not ' + spacing
3968239683

39683-
/* May be right or center aligned. */
39684+
// May be right or center aligned.
3968439685
if (size(cell) < sizes[index]) {
3968539686
return
3968639687
}

0 commit comments

Comments
 (0)