Run formatter
This commit is contained in:
Родитель
3e0da149cd
Коммит
8223bf10b1
|
@ -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;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -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))) {}`,
|
||||
},
|
||||
],
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче