build: update npm install command to use --legacy-peer-deps
This change modifies the build scripts to use --legacy-peer-deps flag when installing npm dependencies to resolve potential peer dependency conflicts during the build process. The change is applied to both bash (build.sh) and batch (build.bat) build scripts.
This commit is contained in:
+70
-79
@@ -10,18 +10,19 @@
|
||||
* @returns {boolean} `true` if it should stop traversing.
|
||||
*/
|
||||
function isBoundary(node) {
|
||||
const t = node.type;
|
||||
const t = node.type;
|
||||
|
||||
return (
|
||||
t === "FunctionDeclaration" ||
|
||||
t === "FunctionExpression" ||
|
||||
t === "ArrowFunctionExpression" ||
|
||||
/*
|
||||
* Don't report the await expressions on for-await-of loop since it's
|
||||
* asynchronous iteration intentionally.
|
||||
*/
|
||||
(t === "ForOfStatement" && node.await === true)
|
||||
);
|
||||
return (
|
||||
t === "FunctionDeclaration" ||
|
||||
t === "FunctionExpression" ||
|
||||
t === "ArrowFunctionExpression" ||
|
||||
|
||||
/*
|
||||
* Don't report the await expressions on for-await-of loop since it's
|
||||
* asynchronous iteration intentionally.
|
||||
*/
|
||||
(t === "ForOfStatement" && node.await === true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,85 +32,75 @@ function isBoundary(node) {
|
||||
* @returns {boolean} `true` if the node is in loop.
|
||||
*/
|
||||
function isLooped(node, parent) {
|
||||
switch (parent.type) {
|
||||
case "ForStatement":
|
||||
return (
|
||||
node === parent.test ||
|
||||
node === parent.update ||
|
||||
node === parent.body
|
||||
);
|
||||
switch (parent.type) {
|
||||
case "ForStatement":
|
||||
return (
|
||||
node === parent.test ||
|
||||
node === parent.update ||
|
||||
node === parent.body
|
||||
);
|
||||
|
||||
case "ForOfStatement":
|
||||
case "ForInStatement":
|
||||
return (
|
||||
node === parent.body ||
|
||||
(node === parent.left && node.kind === "await using")
|
||||
);
|
||||
case "ForOfStatement":
|
||||
case "ForInStatement":
|
||||
return node === parent.body;
|
||||
|
||||
case "WhileStatement":
|
||||
case "DoWhileStatement":
|
||||
return node === parent.test || node === parent.body;
|
||||
case "WhileStatement":
|
||||
case "DoWhileStatement":
|
||||
return node === parent.test || node === parent.body;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "Disallow `await` inside of loops",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-await-in-loop",
|
||||
},
|
||||
docs: {
|
||||
description: "Disallow `await` inside of loops",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-await-in-loop"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpectedAwait: "Unexpected `await` inside a loop.",
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
/**
|
||||
* Validate an await expression.
|
||||
* @param {ASTNode} awaitNode An AwaitExpression or ForOfStatement node to validate.
|
||||
* @returns {void}
|
||||
*/
|
||||
function validate(awaitNode) {
|
||||
if (
|
||||
awaitNode.type === "VariableDeclaration" &&
|
||||
awaitNode.kind !== "await using"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
messages: {
|
||||
unexpectedAwait: "Unexpected `await` inside a loop."
|
||||
}
|
||||
},
|
||||
create(context) {
|
||||
|
||||
if (awaitNode.type === "ForOfStatement" && !awaitNode.await) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Validate an await expression.
|
||||
* @param {ASTNode} awaitNode An AwaitExpression or ForOfStatement node to validate.
|
||||
* @returns {void}
|
||||
*/
|
||||
function validate(awaitNode) {
|
||||
if (awaitNode.type === "ForOfStatement" && !awaitNode.await) {
|
||||
return;
|
||||
}
|
||||
|
||||
let node = awaitNode;
|
||||
let parent = node.parent;
|
||||
let node = awaitNode;
|
||||
let parent = node.parent;
|
||||
|
||||
while (parent && !isBoundary(parent)) {
|
||||
if (isLooped(node, parent)) {
|
||||
context.report({
|
||||
node: awaitNode,
|
||||
messageId: "unexpectedAwait",
|
||||
});
|
||||
return;
|
||||
}
|
||||
node = parent;
|
||||
parent = parent.parent;
|
||||
}
|
||||
}
|
||||
while (parent && !isBoundary(parent)) {
|
||||
if (isLooped(node, parent)) {
|
||||
context.report({
|
||||
node: awaitNode,
|
||||
messageId: "unexpectedAwait"
|
||||
});
|
||||
return;
|
||||
}
|
||||
node = parent;
|
||||
parent = parent.parent;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
AwaitExpression: validate,
|
||||
ForOfStatement: validate,
|
||||
VariableDeclaration: validate,
|
||||
};
|
||||
},
|
||||
return {
|
||||
AwaitExpression: validate,
|
||||
ForOfStatement: validate
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user