From 6b97bd7be668646272f017ed2e71b215f185b13e Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 9 Apr 2021 18:19:28 -0400 Subject: [PATCH] tools: update ESLint to 7.24.0 Update ESLint to 7.24.0 PR-URL: https://github.com/nodejs/node/pull/38179 Reviewed-By: Antoine du Hamel Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- .../eslint-plugin-markdown/lib/processor.js | 108 +++++++++++++----- .../eslint-plugin-markdown/package.json | 2 +- .../eslint/lib/rules/no-implicit-coercion.js | 37 ++++++ .../eslint/lib/rules/no-multi-assign.js | 17 ++- .../eslint/lib/rules/no-unused-vars.js | 25 ++-- .../node_modules/balanced-match/README.md | 6 + .../node_modules/balanced-match/index.js | 3 + .../node_modules/balanced-match/package.json | 7 +- .../eslint/node_modules/globals/globals.json | 1 + .../eslint/node_modules/globals/package.json | 2 +- .../{.tonic_example.js => .runkit_example.js} | 0 .../table/node_modules/ajv/README.md | 6 +- .../ajv/dist/compile/codegen/code.js | 6 +- .../ajv/dist/compile/codegen/index.js | 3 +- .../ajv/dist/vocabularies/applicator/items.js | 7 +- .../ajv/dist/vocabularies/format/format.js | 11 +- .../table/node_modules/ajv/package.json | 20 ++-- .../table/node_modules/ajv/scripts/bundle.js | 48 -------- .../node_modules/ajv/scripts/get-ajv-packages | 20 ---- .../ajv/scripts/get-contributors.js | 57 --------- .../node_modules/ajv/scripts/jsontests.js | 32 ------ .../node_modules/ajv/scripts/prepare-site | 17 --- .../node_modules/ajv/scripts/prepare-tests | 12 -- .../node_modules/ajv/scripts/publish-bundles | 37 ------ .../node_modules/ajv/scripts/publish-site | 25 ---- tools/node_modules/eslint/package.json | 6 +- 26 files changed, 190 insertions(+), 325 deletions(-) rename tools/node_modules/eslint/node_modules/table/node_modules/ajv/{.tonic_example.js => .runkit_example.js} (100%) delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/bundle.js delete mode 100755 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/get-ajv-packages delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/get-contributors.js delete mode 100644 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/jsontests.js delete mode 100755 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-site delete mode 100755 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/prepare-tests delete mode 100755 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-bundles delete mode 100755 tools/node_modules/eslint/node_modules/table/node_modules/ajv/scripts/publish-site diff --git a/tools/node_modules/eslint-plugin-markdown/lib/processor.js b/tools/node_modules/eslint-plugin-markdown/lib/processor.js index 41f6f7a280e61f..94cf816dc913d9 100644 --- a/tools/node_modules/eslint-plugin-markdown/lib/processor.js +++ b/tools/node_modules/eslint-plugin-markdown/lib/processor.js @@ -3,6 +3,25 @@ * @author Brandon Mills */ +/** + * @typedef {import('eslint/lib/shared/types').LintMessage} Message + * + * @typedef {Object} ASTNode + * @property {string} type + * @property {string} [lang] + * + * @typedef {Object} RangeMap + * @property {number} js + * @property {number} md + * + * @typedef {Object} BlockBase + * @property {string} baseIndentText + * @property {string[]} comments + * @property {RangeMap[]} rangeMap + * + * @typedef {ASTNode & BlockBase} Block + */ + "use strict"; const unified = require("unified"); @@ -16,31 +35,36 @@ const SUPPORTS_AUTOFIX = true; const markdown = unified().use(remarkParse); -let blocks = []; +/** + * @type {Map} + */ +const blocksCache = new Map(); /** * Performs a depth-first traversal of the Markdown AST. * @param {ASTNode} node A Markdown AST node. - * @param {Object} callbacks A map of node types to callbacks. - * @param {Object} [parent] The node's parent AST node. + * @param {{[key: string]: (node: ASTNode) => void}} callbacks A map of node types to callbacks. * @returns {void} */ -function traverse(node, callbacks, parent) { +function traverse(node, callbacks) { if (callbacks[node.type]) { - callbacks[node.type](node, parent); + callbacks[node.type](node); + } else { + callbacks["*"](); } if (typeof node.children !== "undefined") { for (let i = 0; i < node.children.length; i++) { - traverse(node.children[i], callbacks, node); + traverse(node.children[i], callbacks); } } } /** - * Converts leading HTML comments to JS block comments. + * Extracts `eslint-*` or `global` comments from HTML comments if present. * @param {string} html The text content of an HTML AST node. - * @returns {string[]} An array of JS block comments. + * @returns {string} The comment's text without the opening and closing tags or + * an empty string if the text is not an ESLint HTML comment. */ function getComment(html) { const commentStart = "