Skip to content

Commit e7fbdf5

Browse files
watildetargos
authored andcommitted
tools: update remark-preset-lint-node to v1.3.1
Backport-PR-URL: #24699 PR-URL: #24642 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 654bd65 commit e7fbdf5

File tree

3 files changed

+157
-91
lines changed

3 files changed

+157
-91
lines changed

tools/lint-md.js

+135-78
Original file line numberDiff line numberDiff line change
@@ -30708,72 +30708,99 @@ var remark = unified_1()
3070830708
.use(remarkStringify)
3070930709
.freeze();
3071030710

30711-
const name = "remark";
30712-
const version$1 = "10.0.0";
30713-
const description = "Markdown processor powered by plugins";
30714-
const license = "MIT";
30715-
const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"];
30716-
const homepage = "http://remark.js.org";
30717-
const repository = "https://github.com/remarkjs/remark/tree/master/packages/remark";
30718-
const bugs = "https://github.com/remarkjs/remark/issues";
30719-
const author = "Titus Wormer <[email protected]> (http://wooorm.com)";
30720-
const contributors = ["Titus Wormer <[email protected]> (http://wooorm.com)"];
30721-
const files = ["index.js"];
30711+
const _args = [["[email protected]","/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup"]];
30712+
const _from = "[email protected]";
30713+
const _id = "[email protected]";
30714+
const _inBundle = false;
30715+
const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==";
30716+
const _location = "/remark";
30717+
const _phantomChildren = {};
30718+
const _requested = {"type":"version","registry":true,"raw":"[email protected]","name":"remark","escapedName":"remark","rawSpec":"10.0.0","saveSpec":null,"fetchSpec":"10.0.0"};
30719+
const _requiredBy = ["/"];
30720+
const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz";
30721+
const _spec = "10.0.0";
30722+
const _where = "/Users/daijiro/Developments/node/tools/node-lint-md-cli-rollup";
30723+
const author = {"name":"Titus Wormer","email":"[email protected]","url":"http://wooorm.com"};
30724+
const bugs = {"url":"https://github.com/remarkjs/remark/issues"};
30725+
const contributors = [{"name":"Titus Wormer","email":"[email protected]","url":"http://wooorm.com"}];
3072230726
const dependencies = {"remark-parse":"^6.0.0","remark-stringify":"^6.0.0","unified":"^7.0.0"};
30727+
const description = "Markdown processor powered by plugins";
3072330728
const devDependencies = {"tape":"^4.9.1"};
30729+
const files = ["index.js"];
30730+
const homepage = "http://remark.js.org";
30731+
const keywords = ["markdown","abstract","syntax","tree","ast","parse","stringify","process"];
30732+
const license = "MIT";
30733+
const name = "remark";
30734+
const repository = {"type":"git","url":"https://github.com/remarkjs/remark/tree/master/packages/remark"};
3072430735
const scripts = {"test":"tape test.js"};
30736+
const version$1 = "10.0.0";
3072530737
const xo = false;
30726-
const _resolved = "https://registry.npmjs.org/remark/-/remark-10.0.0.tgz";
30727-
const _integrity = "sha512-0fZvVmd9CgDi1qHGsRTyhpJShw60r3/4OSdRpAx+I7CmE8/Jmt829T9KWHpw2Ygw3chRZ26sMorqb8aIolU9tQ==";
30728-
const _from = "[email protected]";
3072930738
var _package = {
30730-
name: name,
30731-
version: version$1,
30732-
description: description,
30733-
license: license,
30734-
keywords: keywords,
30735-
homepage: homepage,
30736-
repository: repository,
30737-
bugs: bugs,
30739+
_args: _args,
30740+
_from: _from,
30741+
_id: _id,
30742+
_inBundle: _inBundle,
30743+
_integrity: _integrity,
30744+
_location: _location,
30745+
_phantomChildren: _phantomChildren,
30746+
_requested: _requested,
30747+
_requiredBy: _requiredBy,
30748+
_resolved: _resolved,
30749+
_spec: _spec,
30750+
_where: _where,
3073830751
author: author,
30752+
bugs: bugs,
3073930753
contributors: contributors,
30740-
files: files,
3074130754
dependencies: dependencies,
30755+
description: description,
3074230756
devDependencies: devDependencies,
30757+
files: files,
30758+
homepage: homepage,
30759+
keywords: keywords,
30760+
license: license,
30761+
name: name,
30762+
repository: repository,
3074330763
scripts: scripts,
30744-
xo: xo,
30745-
_resolved: _resolved,
30746-
_integrity: _integrity,
30747-
_from: _from
30764+
version: version$1,
30765+
xo: xo
3074830766
};
3074930767

3075030768
var _package$1 = Object.freeze({
30751-
name: name,
30752-
version: version$1,
30753-
description: description,
30754-
license: license,
30755-
keywords: keywords,
30756-
homepage: homepage,
30757-
repository: repository,
30758-
bugs: bugs,
30769+
_args: _args,
30770+
_from: _from,
30771+
_id: _id,
30772+
_inBundle: _inBundle,
30773+
_integrity: _integrity,
30774+
_location: _location,
30775+
_phantomChildren: _phantomChildren,
30776+
_requested: _requested,
30777+
_requiredBy: _requiredBy,
30778+
_resolved: _resolved,
30779+
_spec: _spec,
30780+
_where: _where,
3075930781
author: author,
30782+
bugs: bugs,
3076030783
contributors: contributors,
30761-
files: files,
3076230784
dependencies: dependencies,
30785+
description: description,
3076330786
devDependencies: devDependencies,
30787+
files: files,
30788+
homepage: homepage,
30789+
keywords: keywords,
30790+
license: license,
30791+
name: name,
30792+
repository: repository,
3076430793
scripts: scripts,
30794+
version: version$1,
3076530795
xo: xo,
30766-
_resolved: _resolved,
30767-
_integrity: _integrity,
30768-
_from: _from,
3076930796
default: _package
3077030797
});
3077130798

3077230799
const name$1 = "node-lint-md-cli-rollup";
3077330800
const description$1 = "remark packaged for node markdown linting";
3077430801
const version$2 = "1.0.0";
3077530802
const devDependencies$1 = {"rollup":"^0.55.5","rollup-plugin-commonjs":"^8.0.2","rollup-plugin-json":"^2.3.1","rollup-plugin-node-resolve":"^3.4.0"};
30776-
const dependencies$1 = {"markdown-extensions":"^1.1.0","remark":"^10.0.0","remark-lint":"^6.0.3","remark-preset-lint-node":"^1.2.0","unified-args":"^6.0.0","unified-engine":"^5.1.0"};
30803+
const dependencies$1 = {"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"};
3077730804
const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."};
3077830805
var _package$2 = {
3077930806
name: name$1,
@@ -32692,50 +32719,56 @@ function noAutoLinkWithoutProtocol(tree, file) {
3269232719
}
3269332720
}
3269432721

32695-
var remarkLintNoBlockquoteWithoutCaret = unifiedLintRule('remark-lint:no-blockquote-without-caret', noBlockquoteWithoutCaret);
32722+
var remarkLintNoBlockquoteWithoutMarker = unifiedLintRule(
32723+
'remark-lint:no-blockquote-without-marker',
32724+
noBlockquoteWithoutMarker
32725+
);
32726+
32727+
var reason$4 = 'Missing marker in blockquote';
3269632728

32697-
function noBlockquoteWithoutCaret(ast, file) {
32698-
var contents = file.toString();
32729+
function noBlockquoteWithoutMarker(tree, file) {
32730+
var contents = String(file);
3269932731
var location = vfileLocation(file);
3270032732
var last = contents.length;
3270132733

32702-
unistUtilVisit(ast, 'blockquote', visitor);
32734+
unistUtilVisit(tree, 'blockquote', visitor);
3270332735

3270432736
function visitor(node) {
32705-
var start = unistUtilPosition.start(node).line;
3270632737
var indent = node.position && node.position.indent;
32738+
var start;
32739+
var length;
32740+
var index;
32741+
var line;
32742+
var offset;
32743+
var character;
32744+
var pos;
3270732745

3270832746
if (unistUtilGenerated(node) || !indent || indent.length === 0) {
32709-
return;
32747+
return
3271032748
}
3271132749

32712-
indent.forEach(eachLine);
32750+
start = unistUtilPosition.start(node).line;
32751+
length = indent.length;
32752+
index = -1;
3271332753

32714-
function eachLine(column, n) {
32715-
var character;
32716-
var line = start + n + 1;
32717-
var offset = location.toOffset({
32718-
line: line,
32719-
column: column
32720-
}) - 1;
32754+
while (++index < length) {
32755+
line = start + index + 1;
32756+
pos = {line: line, column: indent[index]};
32757+
offset = location.toOffset(pos) - 1;
3272132758

3272232759
while (++offset < last) {
3272332760
character = contents.charAt(offset);
3272432761

3272532762
if (character === '>') {
32726-
return;
32763+
break
3272732764
}
3272832765

3272932766
/* istanbul ignore else - just for safety */
3273032767
if (character !== ' ' && character !== '\t') {
32731-
break;
32768+
file.message(reason$4, pos);
32769+
break
3273232770
}
3273332771
}
32734-
32735-
file.message('Missing caret in blockquote', {
32736-
line: line,
32737-
column: column
32738-
});
3273932772
}
3274032773
}
3274132774
}
@@ -32745,7 +32778,7 @@ var remarkLintNoDuplicateDefinitions = unifiedLintRule(
3274532778
noDuplicateDefinitions
3274632779
);
3274732780

32748-
var reason$4 = 'Do not use definitions with the same identifier';
32781+
var reason$5 = 'Do not use definitions with the same identifier';
3274932782

3275032783
function noDuplicateDefinitions(tree, file) {
3275132784
var map = {};
@@ -32762,7 +32795,7 @@ function noDuplicateDefinitions(tree, file) {
3276232795

3276332796
if (duplicate && duplicate.type) {
3276432797
file.message(
32765-
reason$4 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')',
32798+
reason$5 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')',
3276632799
node
3276732800
);
3276832801
}
@@ -32787,11 +32820,11 @@ var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule(
3278732820
noFileNameConsecutiveDashes
3278832821
);
3278932822

32790-
var reason$5 = 'Do not use consecutive dashes in a file name';
32823+
var reason$6 = 'Do not use consecutive dashes in a file name';
3279132824

3279232825
function noFileNameConsecutiveDashes(tree, file) {
3279332826
if (file.stem && /-{2,}/.test(file.stem)) {
32794-
file.message(reason$5);
32827+
file.message(reason$6);
3279532828
}
3279632829
}
3279732830

@@ -32800,11 +32833,11 @@ var remarkLintNoFileNameOuterDashes = unifiedLintRule(
3280032833
noFileNameOuterDashes
3280132834
);
3280232835

32803-
var reason$6 = 'Do not use initial or final dashes in a file name';
32836+
var reason$7 = 'Do not use initial or final dashes in a file name';
3280432837

3280532838
function noFileNameOuterDashes(tree, file) {
3280632839
if (file.stem && /^-|-$/.test(file.stem)) {
32807-
file.message(reason$6);
32840+
file.message(reason$7);
3280832841
}
3280932842
}
3281032843

@@ -33043,7 +33076,7 @@ function noMultipleToplevelHeadings(tree, file, pref) {
3304333076

3304433077
var remarkLintNoShellDollars = unifiedLintRule('remark-lint:no-shell-dollars', noShellDollars);
3304533078

33046-
var reason$7 = 'Do not use dollar signs before shell-commands';
33079+
var reason$8 = 'Do not use dollar signs before shell-commands';
3304733080

3304833081
/* List of shell script file extensions (also used as code
3304933082
* flags for syntax highlighting on GitHub):
@@ -33089,7 +33122,7 @@ function noShellDollars(tree, file) {
3308933122
}
3309033123
}
3309133124

33092-
file.message(reason$7, node);
33125+
file.message(reason$8, node);
3309333126
}
3309433127
}
3309533128
}
@@ -33099,21 +33132,21 @@ var remarkLintNoShortcutReferenceImage = unifiedLintRule(
3309933132
noShortcutReferenceImage
3310033133
);
3310133134

33102-
var reason$8 = 'Use the trailing [] on reference images';
33135+
var reason$9 = 'Use the trailing [] on reference images';
3310333136

3310433137
function noShortcutReferenceImage(tree, file) {
3310533138
unistUtilVisit(tree, 'imageReference', visitor);
3310633139

3310733140
function visitor(node) {
3310833141
if (!unistUtilGenerated(node) && node.referenceType === 'shortcut') {
33109-
file.message(reason$8, node);
33142+
file.message(reason$9, node);
3311033143
}
3311133144
}
3311233145
}
3311333146

3311433147
var remarkLintNoTableIndentation = unifiedLintRule('remark-lint:no-table-indentation', noTableIndentation);
3311533148

33116-
var reason$9 = 'Do not indent table rows';
33149+
var reason$10 = 'Do not indent table rows';
3311733150

3311833151
function noTableIndentation(tree, file) {
3311933152
var contents = String(file);
@@ -33135,29 +33168,52 @@ function noTableIndentation(tree, file) {
3313533168
);
3313633169

3313733170
if (fence.indexOf('|') > 1) {
33138-
file.message(reason$9, row);
33171+
file.message(reason$10, row);
3313933172
}
3314033173
}
3314133174
}
3314233175

3314333176
var remarkLintNoTabs = unifiedLintRule('remark-lint:no-tabs', noTabs);
3314433177

33145-
var reason$10 = 'Use spaces instead of hard-tabs';
33178+
var reason$11 = 'Use spaces instead of hard-tabs';
3314633179

3314733180
function noTabs(tree, file) {
3314833181
var content = String(file);
3314933182
var position = vfileLocation(file).toPosition;
3315033183
var index = content.indexOf('\t');
3315133184

3315233185
while (index !== -1) {
33153-
file.message(reason$10, position(index));
33186+
file.message(reason$11, position(index));
3315433187
index = content.indexOf('\t', index + 1);
3315533188
}
3315633189
}
3315733190

33191+
var remarkLintNoTrailingSpaces = unifiedLintRule('remark-lint:no-trailing-spaces', noTrailingSpaces);
33192+
33193+
/**
33194+
* Lines that are just space characters are not present in
33195+
* the AST, which is why we loop through lines manually.
33196+
*/
33197+
33198+
function noTrailingSpaces(ast, file) {
33199+
var lines = file.toString().split('\n');
33200+
for (var i = 0; i < lines.length; i++) {
33201+
var currentLine = lines[i];
33202+
var lineIndex = i + 1;
33203+
if (/\s$/.test(currentLine)) {
33204+
file.message('Remove trailing whitespace', {
33205+
position: {
33206+
start: { line: lineIndex, column: currentLine.length + 1 },
33207+
end: { line: lineIndex }
33208+
}
33209+
});
33210+
}
33211+
}
33212+
}
33213+
3315833214
var remarkLintNoUnusedDefinitions = unifiedLintRule('remark-lint:no-unused-definitions', noUnusedDefinitions);
3315933215

33160-
var reason$11 = 'Found unused definition';
33216+
var reason$12 = 'Found unused definition';
3316133217

3316233218
function noUnusedDefinitions(tree, file) {
3316333219
var map = {};
@@ -33171,7 +33227,7 @@ function noUnusedDefinitions(tree, file) {
3317133227
entry = map[identifier];
3317233228

3317333229
if (!entry.used) {
33174-
file.message(reason$11, entry.node);
33230+
file.message(reason$12, entry.node);
3317533231
}
3317633232
}
3317733233

@@ -33789,7 +33845,7 @@ var plugins$1 = [
3378933845
],
3379033846
remarkLintMaximumLineLength,
3379133847
remarkLintNoAutoLinkWithoutProtocol,
33792-
remarkLintNoBlockquoteWithoutCaret,
33848+
remarkLintNoBlockquoteWithoutMarker,
3379333849
remarkLintNoDuplicateDefinitions,
3379433850
remarkLintNoFileNameArticles,
3379533851
remarkLintNoFileNameConsecutiveDashes,
@@ -33802,6 +33858,7 @@ var plugins$1 = [
3380233858
remarkLintNoShortcutReferenceImage,
3380333859
remarkLintNoTableIndentation,
3380433860
remarkLintNoTabs,
33861+
remarkLintNoTrailingSpaces,
3380533862
remarkLintNoUnusedDefinitions,
3380633863
remarkLintRuleStyle,
3380733864
remarkLintTablePipes,

0 commit comments

Comments
 (0)