Update dependencies: @types/node to 11.12.0, eslint to 5.15.3, js-yaml to 3.13.0, typescript to 3.3.4000, uglify-js to 3.5.2.

This commit is contained in:
David Anson 2019-03-30 14:36:04 -07:00
parent 9b9532e163
commit ec35833751
6 changed files with 87 additions and 307 deletions

View file

@ -7,271 +7,48 @@
"node": true, "node": true,
"es6": true "es6": true
}, },
"extends": "eslint:all",
"rules": { "rules": {
"accessor-pairs": "error",
"array-bracket-newline": "error",
"array-bracket-spacing": ["error", "always"], "array-bracket-spacing": ["error", "always"],
"array-callback-return": "error",
"array-element-newline": "off", "array-element-newline": "off",
"arrow-body-style": "error",
"arrow-parens": "error",
"arrow-spacing": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"brace-style": "error",
"callback-return": "off",
"camelcase": "error",
"capitalized-comments": "off", "capitalized-comments": "off",
"class-methods-use-this": "error",
"comma-dangle": "error",
"comma-spacing": "error",
"comma-style": "error",
"complexity": "error",
"computed-property-spacing": "error",
"consistent-return": "off",
"consistent-this": "error",
"constructor-super": "error",
"curly": "error",
"default-case": "error",
"dot-location": ["error", "property"], "dot-location": ["error", "property"],
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": "error",
"for-direction": "error",
"func-call-spacing": "error",
"func-name-matching": "off",
"func-names": "error",
"func-style": ["error", "declaration"], "func-style": ["error", "declaration"],
"function-paren-newline": "off", "function-paren-newline": "off",
"generator-star-spacing": "error",
"getter-return": "error",
"global-require": "off", "global-require": "off",
"guard-for-in": "error",
"handle-callback-err": "error",
"id-blacklist": "error",
"id-length": "off", "id-length": "off",
"id-match": "error",
"implicit-arrow-linebreak": "error",
"indent": ["error", 2, { "SwitchCase": 1 }], "indent": ["error", 2, { "SwitchCase": 1 }],
"indent-legacy": "off",
"init-declarations": "error",
"jsx-quotes": "error",
"key-spacing": "error",
"keyword-spacing": "error",
"line-comment-position": "error",
"linebreak-style": "off", "linebreak-style": "off",
"lines-around-comment": "off",
"lines-around-directive": "error",
"lines-between-class-members": "error",
"max-classes-per-file": "error",
"max-depth": "error",
"max-len": "error",
"max-lines": "off", "max-lines": "off",
"max-lines-per-function": "off", "max-lines-per-function": "off",
"max-nested-callbacks": "error",
"max-params": ["error", 9], "max-params": ["error", 9],
"max-statements": ["error", 33], "max-statements": ["error", 33],
"max-statements-per-line": "error",
"multiline-comment-style": ["error", "separate-lines"], "multiline-comment-style": ["error", "separate-lines"],
"multiline-ternary": "off", "multiline-ternary": "off",
"new-cap": "error",
"new-parens": "error",
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": "off", "newline-per-chained-call": "off",
"no-alert": "error",
"no-array-constructor": "error",
"no-async-promise-executor": "error",
"no-await-in-loop": "error",
"no-bitwise": "off",
"no-buffer-constructor": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-catch-shadow": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-confusing-arrow": "error",
"no-console": "error",
"no-const-assign": "error",
"no-constant-condition": "error",
"no-continue": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-div-regex": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-function": "off", "no-empty-function": "off",
"no-empty-pattern": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-ex-assign": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-boolean-cast": "error",
"no-extra-label": "error",
"no-extra-parens": "off", "no-extra-parens": "off",
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-implicit-coercion": "off", "no-implicit-coercion": "off",
"no-implicit-globals": "error",
"no-implied-eval": "error",
"no-inline-comments": "error",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-invalid-this": "off",
"no-irregular-whitespace": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": "off", "no-magic-numbers": "off",
"no-misleading-character-class": "error",
"no-mixed-operators": "error",
"no-mixed-requires": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multi-assign": "off",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": "error",
"no-native-reassign": "error",
"no-negated-condition": "error",
"no-negated-in-lhs": "error",
"no-nested-ternary": "off", "no-nested-ternary": "off",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-symbol": "error",
"no-new-wrappers": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-param-reassign": "off", "no-param-reassign": "off",
"no-path-concat": "error",
"no-plusplus": "off", "no-plusplus": "off",
"no-process-env": "error",
"no-process-exit": "error",
"no-proto": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-properties": "error",
"no-restricted-syntax": "error",
"no-return-assign": "error",
"no-return-await": "error",
"no-script-url": "error",
"no-self-assign": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-sparse-arrays": "error",
"no-sync": "off", "no-sync": "off",
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-ternary": "off", "no-ternary": "off",
"no-this-before-super": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-undefined": "off", "no-undefined": "off",
"no-underscore-dangle": "error",
"no-unexpected-multiline": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-unused-vars": "error",
"no-use-before-define": "error",
"no-useless-call": "error",
"no-useless-catch": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"no-void": "error",
"no-warning-comments": "error",
"no-whitespace-before-property": "error",
"no-with": "error",
"nonblock-statement-body-position": "error",
"object-curly-newline": "off",
"object-curly-spacing": ["error", "always"], "object-curly-spacing": ["error", "always"],
"object-property-newline": "error",
"object-shorthand": "off", "object-shorthand": "off",
"one-var": "off", "one-var": "off",
"one-var-declaration-per-line": "error",
"operator-assignment": "error",
"operator-linebreak": ["error", "after"], "operator-linebreak": ["error", "after"],
"padded-blocks": "off", "padded-blocks": "off",
"padding-line-between-statements": "off",
"prefer-arrow-callback": "off", "prefer-arrow-callback": "off",
"prefer-const": "error",
"prefer-destructuring": "off", "prefer-destructuring": "off",
"prefer-numeric-literals": "error", "prefer-named-capture-group": "off",
"prefer-object-spread": "error",
"prefer-promise-reject-errors": "error",
"prefer-reflect": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "off", "prefer-template": "off",
"quote-props": "error",
"quotes": "error",
"radix": "error",
"require-atomic-updates": "error",
"require-await": "error",
"require-jsdoc": "off",
"require-unicode-regexp": "off", "require-unicode-regexp": "off",
"require-yield": "error",
"rest-spread-spacing": "error",
"semi": "error",
"semi-spacing": "error",
"semi-style": "error",
"sort-imports": "error",
"sort-keys": "off", "sort-keys": "off",
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": ["error", "never"], "space-before-function-paren": ["error", "never"],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"spaced-comment": "error",
"strict": "error",
"switch-colon-spacing": "error",
"symbol-description": "error",
"template-curly-spacing": "error",
"template-tag-spacing": "error",
"unicode-bom": "error",
"use-isnan": "error",
"valid-jsdoc": "error",
"valid-typeof": "error",
"vars-on-top": "off", "vars-on-top": "off",
"wrap-iife": "error", "wrap-regex": "off"
"wrap-regex": "off",
"yield-star-spacing": "error",
"yoda": "error"
} }
} }

View file

@ -89,7 +89,7 @@
} else { } else {
// Update from File object // Update from File object
var reader = new FileReader(); var reader = new FileReader();
reader.onload = function readerOnload(e) { reader.onload = function onload(e) {
markdown.value = e.target.result; markdown.value = e.target.result;
onMarkdownInput(); onMarkdownInput();
}; };

View file

@ -74,7 +74,7 @@ function validateRuleList(ruleList) {
// Class for results with toString for pretty display // Class for results with toString for pretty display
function newResults(ruleList) { function newResults(ruleList) {
function Results() {} function Results() {}
Results.prototype.toString = function resultsToString(useAlias) { Results.prototype.toString = function toString(useAlias) {
const that = this; const that = this;
let ruleNameToRule = null; let ruleNameToRule = null;
const results = []; const results = [];
@ -415,7 +415,7 @@ function lintContent(
return callback(ex); return callback(ex);
} }
shared.makeTokenCache(null); shared.makeTokenCache(null);
callback(null, result); return callback(null, result);
} }
// Lints a single file // Lints a single file
@ -433,7 +433,7 @@ function lintFile(
if (err) { if (err) {
return callback(err); return callback(err);
} }
lintContent(ruleList, file, content, md, config, frontMatter, return lintContent(ruleList, file, content, md, config, frontMatter,
noInlineConfig, resultVersion, callback); noInlineConfig, resultVersion, callback);
} }
// Make a/synchronous call to read file // Make a/synchronous call to read file
@ -476,6 +476,7 @@ function lintInput(options, synchronous, callback) {
}); });
const results = newResults(ruleList); const results = newResults(ruleList);
// Helper to lint the next string or file // Helper to lint the next string or file
/* eslint-disable consistent-return */
function lintNextItem() { function lintNextItem() {
let iterating = true; let iterating = true;
let item = null; let item = null;
@ -485,9 +486,7 @@ function lintInput(options, synchronous, callback) {
return callback(err); return callback(err);
} }
results[item] = result; results[item] = result;
if (!iterating) { return iterating || lintNextItem();
lintNextItem();
}
} }
while (iterating) { while (iterating) {
if ((item = stringsKeys.shift())) { if ((item = stringsKeys.shift())) {
@ -518,7 +517,7 @@ function lintInput(options, synchronous, callback) {
} }
} }
} }
lintNextItem(); return lintNextItem();
} }
/** /**
@ -603,15 +602,14 @@ function readConfig(file, parsers, callback) {
if (configExtends) { if (configExtends) {
delete config.extends; delete config.extends;
const extendsFile = path.resolve(path.dirname(file), configExtends); const extendsFile = path.resolve(path.dirname(file), configExtends);
readConfig(extendsFile, parsers, (errr, extendsConfig) => { return readConfig(extendsFile, parsers, (errr, extendsConfig) => {
if (errr) { if (errr) {
return callback(errr); return callback(errr);
} }
callback(null, shared.assign(extendsConfig, config)); return callback(null, shared.assign(extendsConfig, config));
}); });
} else {
callback(null, config);
} }
return callback(null, config);
}); });
} }

View file

@ -76,6 +76,7 @@ module.exports.includesSorted = function includesSorted(array, element) {
let left = 0; let left = 0;
let right = array.length - 1; let right = array.length - 1;
while (left <= right) { while (left <= right) {
/* eslint-disable no-bitwise */
const mid = (left + right) >> 1; const mid = (left + right) >> 1;
if (array[mid] < element) { if (array[mid] < element) {
left = mid + 1; left = mid + 1;
@ -144,10 +145,10 @@ module.exports.headingStyleFor = function headingStyleFor(token) {
}; };
// Calls the provided function for each matching token // Calls the provided function for each matching token
function filterTokens(params, type, callback) { function filterTokens(params, type, handler) {
params.tokens.forEach(function forToken(token) { params.tokens.forEach(function forToken(token) {
if (token.type === type) { if (token.type === type) {
callback(token); handler(token);
} }
}); });
} }
@ -234,24 +235,24 @@ module.exports.makeTokenCache = makeTokenCache;
module.exports.forEachLine = function forEachLine(callback) { module.exports.forEachLine = function forEachLine(callback) {
tokenCache.lineMetadata.forEach(function forMetadata(metadata) { tokenCache.lineMetadata.forEach(function forMetadata(metadata) {
// Parameters: line, lineIndex, inCode, onFence, inTable // Parameters: line, lineIndex, inCode, onFence, inTable
callback.apply(this, metadata); callback(...metadata);
}); });
}; };
// Calls the provided function for each specified inline child token // Calls the provided function for each specified inline child token
module.exports.forEachInlineChild = module.exports.forEachInlineChild =
function forEachInlineChild(params, type, callback) { function forEachInlineChild(params, type, handler) {
filterTokens(params, "inline", function forToken(token) { filterTokens(params, "inline", function forToken(token) {
token.children.forEach(function forChild(child) { token.children.forEach(function forChild(child) {
if (child.type === type) { if (child.type === type) {
callback(child, token); handler(child, token);
} }
}); });
}); });
}; };
// Calls the provided function for each heading's content // Calls the provided function for each heading's content
module.exports.forEachHeading = function forEachHeading(params, callback) { module.exports.forEachHeading = function forEachHeading(params, handler) {
let heading = null; let heading = null;
params.tokens.forEach(function forToken(token) { params.tokens.forEach(function forToken(token) {
if (token.type === "heading_open") { if (token.type === "heading_open") {
@ -259,14 +260,14 @@ module.exports.forEachHeading = function forEachHeading(params, callback) {
} else if (token.type === "heading_close") { } else if (token.type === "heading_close") {
heading = null; heading = null;
} else if ((token.type === "inline") && heading) { } else if ((token.type === "inline") && heading) {
callback(heading, token.content); handler(heading, token.content);
} }
}); });
}; };
// Calls the provided function for each inline code span's content // Calls the provided function for each inline code span's content
module.exports.forEachInlineCodeSpan = module.exports.forEachInlineCodeSpan =
function forEachInlineCodeSpan(input, callback) { function forEachInlineCodeSpan(input, handler) {
let currentLine = 0; let currentLine = 0;
let currentColumn = 0; let currentColumn = 0;
let index = 0; let index = 0;
@ -290,7 +291,7 @@ module.exports.forEachInlineCodeSpan =
(startColumn >= 0) && (startColumn >= 0) &&
(tickCount === currentTicks)) { (tickCount === currentTicks)) {
// Found end backticks; invoke callback for code span // Found end backticks; invoke callback for code span
callback( handler(
input.substring(startIndex, index - currentTicks), input.substring(startIndex, index - currentTicks),
startLine, startColumn, tickCount); startLine, startColumn, tickCount);
startIndex = -1; startIndex = -1;

View file

@ -16,7 +16,7 @@
"test-cover": "istanbul cover node_modules/nodeunit/bin/nodeunit test/markdownlint-test.js", "test-cover": "istanbul cover node_modules/nodeunit/bin/nodeunit test/markdownlint-test.js",
"test-extra": "nodeunit test/markdownlint-test-extra.js", "test-extra": "nodeunit test/markdownlint-test-extra.js",
"debug": "node debug node_modules/nodeunit/bin/nodeunit", "debug": "node debug node_modules/nodeunit/bin/nodeunit",
"lint": "eslint lib test schema && eslint --env browser --global markdownit --global markdownlint --rule \"no-unused-vars: 0, no-extend-native: 0, max-statements: 0, no-console: 0, no-var: 0\" demo && eslint --rule \"no-console: 0, no-shadow: 0, object-property-newline: 0\" example", "lint": "eslint lib test schema && eslint --env browser --global markdownit --global markdownlint --rule \"no-unused-vars: 0, no-extend-native: 0, max-statements: 0, no-console: 0, no-var: 0\" demo && eslint --rule \"no-console: 0, no-invalid-this: 0, no-shadow: 0, object-property-newline: 0\" example",
"build-config-schema": "node schema/build-config-schema.js", "build-config-schema": "node schema/build-config-schema.js",
"build-demo": "cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && cpy file-header.js . --rename=markdownlint-browser.js && tsc --allowJs --resolveJsonModule --outDir ../lib-es3 ../lib/markdownlint.js && browserify ../lib-es3/lib/markdownlint.js --standalone markdownlint >> markdownlint-browser.js && uglifyjs markdownlint-browser.js --compress --mangle --comments --output markdownlint-browser.min.js", "build-demo": "cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && rimraf markdownlint-browser.* && cpy file-header.js . --rename=markdownlint-browser.js && tsc --allowJs --resolveJsonModule --outDir ../lib-es3 ../lib/markdownlint.js && browserify ../lib-es3/lib/markdownlint.js --standalone markdownlint >> markdownlint-browser.js && uglifyjs markdownlint-browser.js --compress --mangle --comments --output markdownlint-browser.min.js",
"build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2", "build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2",
@ -29,13 +29,13 @@
"markdown-it": "8.4.2" "markdown-it": "8.4.2"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "~10.12.21", "@types/node": "~11.12.0",
"browserify": "~16.2.3", "browserify": "~16.2.3",
"cpy-cli": "~2.0.0", "cpy-cli": "~2.0.0",
"eslint": "~5.12.1", "eslint": "~5.15.3",
"glob": "~7.1.3", "glob": "~7.1.3",
"istanbul": "~0.4.5", "istanbul": "~0.4.5",
"js-yaml": "~3.12.1", "js-yaml": "~3.13.0",
"markdown-it-for-inline": "~0.1.1", "markdown-it-for-inline": "~0.1.1",
"markdown-it-katex": "~2.0.3", "markdown-it-katex": "~2.0.3",
"markdown-it-sub": "~1.0.0", "markdown-it-sub": "~1.0.0",
@ -44,8 +44,8 @@
"rimraf": "~2.6.3", "rimraf": "~2.6.3",
"toml": "~3.0.0", "toml": "~3.0.0",
"tv4": "~1.3.0", "tv4": "~1.3.0",
"typescript": "~3.3.1", "typescript": "~3.3.4000",
"uglify-js": "~3.4.9" "uglify-js": "~3.5.2"
}, },
"keywords": [ "keywords": [
"markdown", "markdown",

View file

@ -25,7 +25,7 @@ function promisify(func, ...args) {
if (error) { if (error) {
return reject(error); return reject(error);
} }
resolve(result); return resolve(result);
}); });
}); });
} }
@ -1112,12 +1112,15 @@ module.exports.readme = function readme(test) {
if (!seenRelated) { if (!seenRelated) {
seenRelated = true; seenRelated = true;
} else if (seenRelated && !seenRules) { } else if (seenRelated && !seenRules) {
seenRules = inRules = true; seenRules = true;
inRules = true;
} else if (seenRelated && seenRules && !seenTags) { } else if (seenRelated && seenRules && !seenTags) {
seenTags = inTags = true; seenTags = true;
inTags = true;
} }
} else if (token.type === "bullet_list_close") { } else if (token.type === "bullet_list_close") {
inRules = inTags = false; inRules = false;
inTags = false;
} else if (token.type === "inline") { } else if (token.type === "inline") {
if (inRules) { if (inRules) {
const rule = rulesLeft.shift(); const rule = rulesLeft.shift();
@ -1181,7 +1184,8 @@ module.exports.doc = function doc(test) {
if (inHeading) { if (inHeading) {
testTagsAliasesParams(rule); testTagsAliasesParams(rule);
rule = rulesLeft.shift(); rule = rulesLeft.shift();
ruleHasTags = ruleHasAliases = false; ruleHasTags = false;
ruleHasAliases = false;
test.ok(rule, test.ok(rule,
"Missing rule implementation for " + token.content + "."); "Missing rule implementation for " + token.content + ".");
test.equal(token.content, test.equal(token.content,