From c202c3c3f4545fc7179adcfe4cd6f7c436ee77ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=AF=E7=84=B6?= Date: Tue, 30 Aug 2022 18:53:34 +0800 Subject: [PATCH] chore: istanbul ignore => c8 ignore --- lib/cli-engine/file-enumerator.js | 6 ++++-- lib/linter/code-path-analysis/code-path-state.js | 6 +++--- lib/linter/code-path-analysis/debug-helpers.js | 6 +++--- lib/linter/timing.js | 8 ++++---- lib/rules/no-extra-boolean-cast.js | 2 +- lib/rules/no-useless-computed-key.js | 2 +- lib/rules/padded-blocks.js | 2 +- lib/rules/prefer-arrow-callback.js | 4 ++-- lib/rules/utils/ast-utils.js | 2 +- lib/shared/logging.js | 2 +- lib/source-code/token-store/cursor.js | 2 +- 11 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/cli-engine/file-enumerator.js b/lib/cli-engine/file-enumerator.js index 674e83e540de..b65d0a206926 100644 --- a/lib/cli-engine/file-enumerator.js +++ b/lib/cli-engine/file-enumerator.js @@ -122,7 +122,8 @@ function statSafeSync(filePath) { try { return fs.statSync(filePath); } catch (error) { - /* istanbul ignore next */ + + /* c8 ignore next */ if (error.code !== "ENOENT") { throw error; } @@ -141,7 +142,8 @@ function readdirSafeSync(directoryPath) { try { return fs.readdirSync(directoryPath, { withFileTypes: true }); } catch (error) { - /* istanbul ignore next */ + + /* c8 ignore next */ if (error.code !== "ENOENT") { throw error; } diff --git a/lib/linter/code-path-analysis/code-path-state.js b/lib/linter/code-path-analysis/code-path-state.js index 426da8d492ea..dec943444c79 100644 --- a/lib/linter/code-path-analysis/code-path-state.js +++ b/lib/linter/code-path-analysis/code-path-state.js @@ -433,7 +433,7 @@ class CodePathState { */ return context; - /* istanbul ignore next */ + /* c8 ignore next */ default: throw new Error("unreachable"); } @@ -1030,7 +1030,7 @@ class CodePathState { }; break; - /* istanbul ignore next */ + /* c8 ignore next */ default: throw new Error(`unknown type: "${type}"`); } @@ -1095,7 +1095,7 @@ class CodePathState { ); break; - /* istanbul ignore next */ + /* c8 ignore next */ default: throw new Error("unreachable"); } diff --git a/lib/linter/code-path-analysis/debug-helpers.js b/lib/linter/code-path-analysis/debug-helpers.js index ca64862db32c..e06b6cde5f1d 100644 --- a/lib/linter/code-path-analysis/debug-helpers.js +++ b/lib/linter/code-path-analysis/debug-helpers.js @@ -20,7 +20,7 @@ const debug = require("debug")("eslint:code-path"); * @param {CodePathSegment} segment A segment to get. * @returns {string} Id of the segment. */ -/* istanbul ignore next */ +/* c8 ignore next */ function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc -- Ignoring return segment.id + (segment.reachable ? "" : "!"); } @@ -67,7 +67,7 @@ module.exports = { * @param {boolean} leaving A flag whether or not it's leaving * @returns {void} */ - dumpState: !debug.enabled ? debug : /* istanbul ignore next */ function(node, state, leaving) { + dumpState: !debug.enabled ? debug : /* c8 ignore next */ function(node, state, leaving) { for (let i = 0; i < state.currentSegments.length; ++i) { const segInternal = state.currentSegments[i].internal; @@ -98,7 +98,7 @@ module.exports = { * @see http://www.graphviz.org * @see http://www.webgraphviz.com */ - dumpDot: !debug.enabled ? debug : /* istanbul ignore next */ function(codePath) { + dumpDot: !debug.enabled ? debug : /* c8 ignore next */ function(codePath) { let text = "\n" + "digraph {\n" + diff --git a/lib/linter/timing.js b/lib/linter/timing.js index 914cbf055914..1076ff25887c 100644 --- a/lib/linter/timing.js +++ b/lib/linter/timing.js @@ -9,7 +9,7 @@ // Helpers //------------------------------------------------------------------------------ -/* istanbul ignore next */ +/* c8 ignore next */ /** * Align the string to left * @param {string} str string to evaluate @@ -22,7 +22,7 @@ function alignLeft(str, len, ch) { return str + new Array(len - str.length + 1).join(ch || " "); } -/* istanbul ignore next */ +/* c8 ignore next */ /** * Align the string to right * @param {string} str string to evaluate @@ -64,7 +64,7 @@ function getListSize() { return TIMING_ENV_VAR_AS_INTEGER > 10 ? TIMING_ENV_VAR_AS_INTEGER : MINIMUM_SIZE; } -/* istanbul ignore next */ +/* c8 ignore next */ /** * display the data * @param {Object} data Data object to be displayed @@ -119,7 +119,7 @@ function display(data) { console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function } -/* istanbul ignore next */ +/* c8 ignore next */ module.exports = (function() { const data = Object.create(null); diff --git a/lib/rules/no-extra-boolean-cast.js b/lib/rules/no-extra-boolean-cast.js index 1c2bc4e50320..45252fee0e90 100644 --- a/lib/rules/no-extra-boolean-cast.js +++ b/lib/rules/no-extra-boolean-cast.js @@ -188,7 +188,7 @@ module.exports = { } return precedence(node) <= precedence(parent); - /* istanbul ignore next */ + /* c8 ignore next */ default: throw new Error(`Unexpected parent type: ${parent.type}`); } diff --git a/lib/rules/no-useless-computed-key.js b/lib/rules/no-useless-computed-key.js index e7a3dc1db6d4..f7f12179b7bd 100644 --- a/lib/rules/no-useless-computed-key.js +++ b/lib/rules/no-useless-computed-key.js @@ -74,7 +74,7 @@ function hasUselessComputedKey(node) { return value !== "constructor"; - /* istanbul ignore next */ + /* c8 ignore next */ default: throw new Error(`Unexpected node type: ${node.type}`); } diff --git a/lib/rules/padded-blocks.js b/lib/rules/padded-blocks.js index 5faf43438745..bc194283dea1 100644 --- a/lib/rules/padded-blocks.js +++ b/lib/rules/padded-blocks.js @@ -186,7 +186,7 @@ module.exports = { case "ClassBody": return options.classes; - /* istanbul ignore next */ + /* c8 ignore next */ default: throw new Error("unreachable"); } diff --git a/lib/rules/prefer-arrow-callback.js b/lib/rules/prefer-arrow-callback.js index 9667139a88d3..8af7161a0f98 100644 --- a/lib/rules/prefer-arrow-callback.js +++ b/lib/rules/prefer-arrow-callback.js @@ -53,7 +53,7 @@ function getVariableOfArguments(scope) { } } - /* istanbul ignore next */ + /* c8 ignore next */ return null; } @@ -126,7 +126,7 @@ function getCallbackInfo(node) { parent = parent.parent; } - /* istanbul ignore next */ + /* c8 ignore next */ throw new Error("unreachable"); } diff --git a/lib/rules/utils/ast-utils.js b/lib/rules/utils/ast-utils.js index e6c4aaeca0a7..f4a18cff7832 100644 --- a/lib/rules/utils/ast-utils.js +++ b/lib/rules/utils/ast-utils.js @@ -1350,7 +1350,7 @@ module.exports = { } } - /* istanbul ignore next */ + /* c8 ignore next */ return true; }, diff --git a/lib/shared/logging.js b/lib/shared/logging.js index 7f06a74e1423..fd5e8a648e1c 100644 --- a/lib/shared/logging.js +++ b/lib/shared/logging.js @@ -7,7 +7,7 @@ /* eslint no-console: "off" -- Logging util */ -/* istanbul ignore next */ +/* c8 ignore next */ module.exports = { /** diff --git a/lib/source-code/token-store/cursor.js b/lib/source-code/token-store/cursor.js index 494762acdfae..0b726006e8e3 100644 --- a/lib/source-code/token-store/cursor.js +++ b/lib/source-code/token-store/cursor.js @@ -69,7 +69,7 @@ module.exports = class Cursor { * @returns {boolean} `true` if the next token exists. * @abstract */ - /* istanbul ignore next */ + /* c8 ignore next */ moveNext() { // eslint-disable-line class-methods-use-this -- Unused throw new Error("Not implemented."); }