From 8223bf10b17e186c6ce6ef50df2b6d79bfb503ed Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 29 Apr 2024 15:23:50 -0400 Subject: [PATCH] Run formatter --- scripts/eslint/rules/bounds-check.cjs | 23 ++++++++++------ scripts/eslint/tests/bounds-check.test.cjs | 32 +++++++++++----------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/scripts/eslint/rules/bounds-check.cjs b/scripts/eslint/rules/bounds-check.cjs index 237ea5e7567..20e402e1089 100644 --- a/scripts/eslint/rules/bounds-check.cjs +++ b/scripts/eslint/rules/bounds-check.cjs @@ -85,7 +85,7 @@ function hasDefiniteBoundsCheck(node) { } case AST_NODE_TYPES.BinaryExpression: { switch (arg.operator) { - case "+":{ + case "+": { const { left, right } = arg; if ( left.type === AST_NODE_TYPES.Identifier && @@ -241,7 +241,7 @@ function hasDefiniteBoundsCheck(node) { } case AST_NODE_TYPES.SequenceExpression: { const { expressions } = n.parent; - const i = expressions.indexOf(/** @type {TSESTree.Expression} */(n)); + const i = expressions.indexOf(/** @type {TSESTree.Expression} */ (n)); if (expressions.slice(0, i).some(n => containsSideEffect(n, index))) { return false; } @@ -249,7 +249,7 @@ function hasDefiniteBoundsCheck(node) { } case AST_NODE_TYPES.CallExpression: { const args = n.parent.arguments; - const i = args.indexOf(/** @type {*} */(n)); + const i = args.indexOf(/** @type {*} */ (n)); if (args.slice(0, i).some(n => containsSideEffect(n, index))) { return false; } @@ -318,7 +318,7 @@ function hasDefiniteBoundsCheck(node) { case AST_NODE_TYPES.VariableDeclarator: { const { id, init } = n.parent; switch (n) { - case /** @type {TSESTree.Node} */(id): + case /** @type {TSESTree.Node} */ (id): break; case init: if (containsSideEffect(n, index)) { @@ -329,7 +329,7 @@ function hasDefiniteBoundsCheck(node) { break; } case AST_NODE_TYPES.VariableDeclaration: { - const declarations = /** @type {readonly TSESTree.Node[]} */(n.parent.declarations); + const declarations = /** @type {readonly TSESTree.Node[]} */ (n.parent.declarations); const i = declarations.indexOf(n); if (declarations.slice(0, i).some(n => containsSideEffect(n, index))) { return false; @@ -581,18 +581,23 @@ const op = { * @param {number} a * @param {number} b */ - EQ(a, b) { return a === b; }, + EQ(a, b) { + return a === b; + }, /** * @param {number} a * @param {number} b */ - LE(a, b) { return a <= b; }, + LE(a, b) { + return a <= b; + }, /** * @param {number} a * @param {number} b */ - GE(a, b) { return a >= b; }, + GE(a, b) { + return a >= b; + }, }; - diff --git a/scripts/eslint/tests/bounds-check.test.cjs b/scripts/eslint/tests/bounds-check.test.cjs index d3243e8f679..c230efd2f5e 100644 --- a/scripts/eslint/tests/bounds-check.test.cjs +++ b/scripts/eslint/tests/bounds-check.test.cjs @@ -28,55 +28,55 @@ ruleTester.run("bounds-check", rule, { }, { filename: "scanner.ts", - code: "pos < end && charCodeUnchecked(pos)" + code: "pos < end && charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "!(pos >= end) && charCodeUnchecked(pos)" + code: "!(pos >= end) && charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "pos + 1 < end && charCodeUnchecked(pos)" + code: "pos + 1 < end && charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "pos >= end || charCodeUnchecked(pos)" + code: "pos >= end || charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "pos < end ? charCodeUnchecked(pos) : null" + code: "pos < end ? charCodeUnchecked(pos) : null", }, { filename: "scanner.ts", - code: "pos >= end ? null : charCodeUnchecked(pos)" + code: "pos >= end ? null : charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "if (pos < end) charCodeUnchecked(pos)" + code: "if (pos < end) charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "if (pos < end) {charCodeUnchecked(pos)}" + code: "if (pos < end) {charCodeUnchecked(pos)}", }, { filename: "scanner.ts", - code: "if (pos >= end); else charCodeUnchecked(pos)" + code: "if (pos >= end); else charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "if (pos >= end); else {charCodeUnchecked(pos)}" + code: "if (pos >= end); else {charCodeUnchecked(pos)}", }, { filename: "scanner.ts", - code: "while (pos < end) charCodeUnchecked(pos)" + code: "while (pos < end) charCodeUnchecked(pos)", }, { filename: "scanner.ts", - code: "while (pos < end) {charCodeUnchecked(pos)}" + code: "while (pos < end) {charCodeUnchecked(pos)}", }, { filename: "scanner.ts", - code: "return pos >= 0 && pos < end ? codePointUnchecked(pos) : CharacterCodes.EOF;" + code: "return pos >= 0 && pos < end ? codePointUnchecked(pos) : CharacterCodes.EOF;", }, { filename: "scanner.ts", @@ -86,7 +86,7 @@ ruleTester.run("bounds-check", rule, { codePointUnchecked(pos + 1) === CharacterCodes.u && codePointUnchecked(pos + 2) === CharacterCodes.openBrace ) {} - ` + `, }, { filename: "scanner.ts", @@ -94,12 +94,12 @@ ruleTester.run("bounds-check", rule, { while (pos < end) { let ch = codePointUnchecked(pos); } - ` + `, }, { filename: "scanner.ts", code: ` - while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos)) && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {}` + while (pos < end && isWhiteSpaceSingleLine(charCodeUnchecked(pos)) && isWhiteSpaceSingleLine(charCodeUnchecked(pos))) {}`, }, ],