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:
+51
-57
@@ -20,7 +20,7 @@ const astUtils = require("./utils/ast-utils");
|
||||
* @returns {boolean} `true` if the node is a concatenation.
|
||||
*/
|
||||
function isConcatenation(node) {
|
||||
return node.type === "BinaryExpression" && node.operator === "+";
|
||||
return node.type === "BinaryExpression" && node.operator === "+";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ function isConcatenation(node) {
|
||||
* @returns {boolean} `true` if the token is a `+` token.
|
||||
*/
|
||||
function isConcatOperatorToken(token) {
|
||||
return token.value === "+" && token.type === "Punctuator";
|
||||
return token.value === "+" && token.type === "Punctuator";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,12 +38,12 @@ function isConcatOperatorToken(token) {
|
||||
* @returns {ASTNode} node
|
||||
*/
|
||||
function getLeft(node) {
|
||||
let left = node.left;
|
||||
let left = node.left;
|
||||
|
||||
while (isConcatenation(left)) {
|
||||
left = left.right;
|
||||
}
|
||||
return left;
|
||||
while (isConcatenation(left)) {
|
||||
left = left.right;
|
||||
}
|
||||
return left;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,70 +52,64 @@ function getLeft(node) {
|
||||
* @returns {ASTNode} node
|
||||
*/
|
||||
function getRight(node) {
|
||||
let right = node.right;
|
||||
let right = node.right;
|
||||
|
||||
while (isConcatenation(right)) {
|
||||
right = right.left;
|
||||
}
|
||||
return right;
|
||||
while (isConcatenation(right)) {
|
||||
right = right.left;
|
||||
}
|
||||
return right;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow unnecessary concatenation of literals or template literals",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-useless-concat",
|
||||
},
|
||||
docs: {
|
||||
description: "Disallow unnecessary concatenation of literals or template literals",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-useless-concat"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpectedConcat: "Unexpected string concatenation of literals.",
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
unexpectedConcat: "Unexpected string concatenation of literals."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
// check if not concatenation
|
||||
if (node.operator !== "+") {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
|
||||
// account for the `foo + "a" + "b"` case
|
||||
const left = getLeft(node);
|
||||
const right = getRight(node);
|
||||
// check if not concatenation
|
||||
if (node.operator !== "+") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
astUtils.isStringLiteral(left) &&
|
||||
astUtils.isStringLiteral(right) &&
|
||||
astUtils.isTokenOnSameLine(left, right)
|
||||
) {
|
||||
const operatorToken = sourceCode.getFirstTokenBetween(
|
||||
left,
|
||||
right,
|
||||
isConcatOperatorToken,
|
||||
);
|
||||
// account for the `foo + "a" + "b"` case
|
||||
const left = getLeft(node);
|
||||
const right = getRight(node);
|
||||
|
||||
context.report({
|
||||
node,
|
||||
loc: operatorToken.loc,
|
||||
messageId: "unexpectedConcat",
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
if (astUtils.isStringLiteral(left) &&
|
||||
astUtils.isStringLiteral(right) &&
|
||||
astUtils.isTokenOnSameLine(left, right)
|
||||
) {
|
||||
const operatorToken = sourceCode.getFirstTokenBetween(left, right, isConcatOperatorToken);
|
||||
|
||||
context.report({
|
||||
node,
|
||||
loc: operatorToken.loc,
|
||||
messageId: "unexpectedConcat"
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user