Skip to content

Commit

Permalink
tools: update remark-preset-lint-node to v1.3.1
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
watilde authored and targos committed Nov 30, 2018
1 parent 654bd65 commit e7fbdf5
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 91 deletions.
213 changes: 135 additions & 78 deletions tools/lint-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -30708,72 +30708,99 @@ var remark = unified_1()
.use(remarkStringify)
.freeze();

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

var _package$1 = Object.freeze({
name: name,
version: version$1,
description: description,
license: license,
keywords: keywords,
homepage: homepage,
repository: repository,
bugs: bugs,
_args: _args,
_from: _from,
_id: _id,
_inBundle: _inBundle,
_integrity: _integrity,
_location: _location,
_phantomChildren: _phantomChildren,
_requested: _requested,
_requiredBy: _requiredBy,
_resolved: _resolved,
_spec: _spec,
_where: _where,
author: author,
bugs: bugs,
contributors: contributors,
files: files,
dependencies: dependencies,
description: description,
devDependencies: devDependencies,
files: files,
homepage: homepage,
keywords: keywords,
license: license,
name: name,
repository: repository,
scripts: scripts,
version: version$1,
xo: xo,
_resolved: _resolved,
_integrity: _integrity,
_from: _from,
default: _package
});

const name$1 = "node-lint-md-cli-rollup";
const description$1 = "remark packaged for node markdown linting";
const version$2 = "1.0.0";
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"};
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"};
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"};
const scripts$1 = {"build":"rollup -c","build-node":"npm run build && cp dist/* .."};
var _package$2 = {
name: name$1,
Expand Down Expand Up @@ -32692,50 +32719,56 @@ function noAutoLinkWithoutProtocol(tree, file) {
}
}

var remarkLintNoBlockquoteWithoutCaret = unifiedLintRule('remark-lint:no-blockquote-without-caret', noBlockquoteWithoutCaret);
var remarkLintNoBlockquoteWithoutMarker = unifiedLintRule(
'remark-lint:no-blockquote-without-marker',
noBlockquoteWithoutMarker
);

var reason$4 = 'Missing marker in blockquote';

function noBlockquoteWithoutCaret(ast, file) {
var contents = file.toString();
function noBlockquoteWithoutMarker(tree, file) {
var contents = String(file);
var location = vfileLocation(file);
var last = contents.length;

unistUtilVisit(ast, 'blockquote', visitor);
unistUtilVisit(tree, 'blockquote', visitor);

function visitor(node) {
var start = unistUtilPosition.start(node).line;
var indent = node.position && node.position.indent;
var start;
var length;
var index;
var line;
var offset;
var character;
var pos;

if (unistUtilGenerated(node) || !indent || indent.length === 0) {
return;
return
}

indent.forEach(eachLine);
start = unistUtilPosition.start(node).line;
length = indent.length;
index = -1;

function eachLine(column, n) {
var character;
var line = start + n + 1;
var offset = location.toOffset({
line: line,
column: column
}) - 1;
while (++index < length) {
line = start + index + 1;
pos = {line: line, column: indent[index]};
offset = location.toOffset(pos) - 1;

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

if (character === '>') {
return;
break
}

/* istanbul ignore else - just for safety */
if (character !== ' ' && character !== '\t') {
break;
file.message(reason$4, pos);
break
}
}

file.message('Missing caret in blockquote', {
line: line,
column: column
});
}
}
}
Expand All @@ -32745,7 +32778,7 @@ var remarkLintNoDuplicateDefinitions = unifiedLintRule(
noDuplicateDefinitions
);

var reason$4 = 'Do not use definitions with the same identifier';
var reason$5 = 'Do not use definitions with the same identifier';

function noDuplicateDefinitions(tree, file) {
var map = {};
Expand All @@ -32762,7 +32795,7 @@ function noDuplicateDefinitions(tree, file) {

if (duplicate && duplicate.type) {
file.message(
reason$4 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')',
reason$5 + ' (' + unistUtilStringifyPosition(unistUtilPosition.start(duplicate)) + ')',
node
);
}
Expand All @@ -32787,11 +32820,11 @@ var remarkLintNoFileNameConsecutiveDashes = unifiedLintRule(
noFileNameConsecutiveDashes
);

var reason$5 = 'Do not use consecutive dashes in a file name';
var reason$6 = 'Do not use consecutive dashes in a file name';

function noFileNameConsecutiveDashes(tree, file) {
if (file.stem && /-{2,}/.test(file.stem)) {
file.message(reason$5);
file.message(reason$6);
}
}

Expand All @@ -32800,11 +32833,11 @@ var remarkLintNoFileNameOuterDashes = unifiedLintRule(
noFileNameOuterDashes
);

var reason$6 = 'Do not use initial or final dashes in a file name';
var reason$7 = 'Do not use initial or final dashes in a file name';

function noFileNameOuterDashes(tree, file) {
if (file.stem && /^-|-$/.test(file.stem)) {
file.message(reason$6);
file.message(reason$7);
}
}

Expand Down Expand Up @@ -33043,7 +33076,7 @@ function noMultipleToplevelHeadings(tree, file, pref) {

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

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

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

file.message(reason$7, node);
file.message(reason$8, node);
}
}
}
Expand All @@ -33099,21 +33132,21 @@ var remarkLintNoShortcutReferenceImage = unifiedLintRule(
noShortcutReferenceImage
);

var reason$8 = 'Use the trailing [] on reference images';
var reason$9 = 'Use the trailing [] on reference images';

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

function visitor(node) {
if (!unistUtilGenerated(node) && node.referenceType === 'shortcut') {
file.message(reason$8, node);
file.message(reason$9, node);
}
}
}

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

var reason$9 = 'Do not indent table rows';
var reason$10 = 'Do not indent table rows';

function noTableIndentation(tree, file) {
var contents = String(file);
Expand All @@ -33135,29 +33168,52 @@ function noTableIndentation(tree, file) {
);

if (fence.indexOf('|') > 1) {
file.message(reason$9, row);
file.message(reason$10, row);
}
}
}

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

var reason$10 = 'Use spaces instead of hard-tabs';
var reason$11 = 'Use spaces instead of hard-tabs';

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

while (index !== -1) {
file.message(reason$10, position(index));
file.message(reason$11, position(index));
index = content.indexOf('\t', index + 1);
}
}

var remarkLintNoTrailingSpaces = unifiedLintRule('remark-lint:no-trailing-spaces', noTrailingSpaces);

/**
* Lines that are just space characters are not present in
* the AST, which is why we loop through lines manually.
*/

function noTrailingSpaces(ast, file) {
var lines = file.toString().split('\n');
for (var i = 0; i < lines.length; i++) {
var currentLine = lines[i];
var lineIndex = i + 1;
if (/\s$/.test(currentLine)) {
file.message('Remove trailing whitespace', {
position: {
start: { line: lineIndex, column: currentLine.length + 1 },
end: { line: lineIndex }
}
});
}
}
}

var remarkLintNoUnusedDefinitions = unifiedLintRule('remark-lint:no-unused-definitions', noUnusedDefinitions);

var reason$11 = 'Found unused definition';
var reason$12 = 'Found unused definition';

function noUnusedDefinitions(tree, file) {
var map = {};
Expand All @@ -33171,7 +33227,7 @@ function noUnusedDefinitions(tree, file) {
entry = map[identifier];

if (!entry.used) {
file.message(reason$11, entry.node);
file.message(reason$12, entry.node);
}
}

Expand Down Expand Up @@ -33789,7 +33845,7 @@ var plugins$1 = [
],
remarkLintMaximumLineLength,
remarkLintNoAutoLinkWithoutProtocol,
remarkLintNoBlockquoteWithoutCaret,
remarkLintNoBlockquoteWithoutMarker,
remarkLintNoDuplicateDefinitions,
remarkLintNoFileNameArticles,
remarkLintNoFileNameConsecutiveDashes,
Expand All @@ -33802,6 +33858,7 @@ var plugins$1 = [
remarkLintNoShortcutReferenceImage,
remarkLintNoTableIndentation,
remarkLintNoTabs,
remarkLintNoTrailingSpaces,
remarkLintNoUnusedDefinitions,
remarkLintRuleStyle,
remarkLintTablePipes,
Expand Down
Loading

0 comments on commit e7fbdf5

Please sign in to comment.