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:
1 parent
20129a1ac7
commit
ac4f232e5e
787 files changed
+82341
-121690
No files matched your search
+72
-96
@@ -21,7 +21,7 @@ const astUtils = require("./utils/ast-utils");
|
||||
* @returns {boolean} `true` if the operator is `in` or `instanceof`
|
||||
*/
|
||||
function isInOrInstanceOfOperator(op) {
|
||||
return op === "in" || op === "instanceof";
|
||||
return op === "in" || op === "instanceof";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ function isInOrInstanceOfOperator(op) {
|
||||
* @returns {boolean} `true` if the operator is an ordering relational operator.
|
||||
*/
|
||||
function isOrderingRelationalOperator(op) {
|
||||
return op === "<" || op === ">" || op === ">=" || op === "<=";
|
||||
return op === "<" || op === ">" || op === ">=" || op === "<=";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,114 +39,90 @@ function isOrderingRelationalOperator(op) {
|
||||
* @returns {boolean} `true` if the node is a logical negation expression.
|
||||
*/
|
||||
function isNegation(node) {
|
||||
return node.type === "UnaryExpression" && node.operator === "!";
|
||||
return node.type === "UnaryExpression" && node.operator === "!";
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
enforceForOrderingRelations: false,
|
||||
},
|
||||
],
|
||||
docs: {
|
||||
description: "Disallow negating the left operand of relational operators",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-unsafe-negation"
|
||||
},
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow negating the left operand of relational operators",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-unsafe-negation",
|
||||
},
|
||||
hasSuggestions: true,
|
||||
|
||||
hasSuggestions: true,
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
enforceForOrderingRelations: {
|
||||
type: "boolean",
|
||||
default: false
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
],
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
enforceForOrderingRelations: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
fixable: null,
|
||||
|
||||
fixable: null,
|
||||
messages: {
|
||||
unexpected: "Unexpected negating the left operand of '{{operator}}' operator.",
|
||||
suggestNegatedExpression: "Negate '{{operator}}' expression instead of its left operand. This changes the current behavior.",
|
||||
suggestParenthesisedNegation: "Wrap negation in '()' to make the intention explicit. This preserves the current behavior."
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
unexpected:
|
||||
"Unexpected negating the left operand of '{{operator}}' operator.",
|
||||
suggestNegatedExpression:
|
||||
"Negate '{{operator}}' expression instead of its left operand. This changes the current behavior.",
|
||||
suggestParenthesisedNegation:
|
||||
"Wrap negation in '()' to make the intention explicit. This preserves the current behavior.",
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const options = context.options[0] || {};
|
||||
const enforceForOrderingRelations = options.enforceForOrderingRelations === true;
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const [{ enforceForOrderingRelations }] = context.options;
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(operator);
|
||||
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
const operator = node.operator;
|
||||
const orderingRelationRuleApplies =
|
||||
enforceForOrderingRelations &&
|
||||
isOrderingRelationalOperator(operator);
|
||||
if (
|
||||
(isInOrInstanceOfOperator(operator) || orderingRelationRuleApplies) &&
|
||||
isNegation(node.left) &&
|
||||
!astUtils.isParenthesised(sourceCode, node.left)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: node.left.loc,
|
||||
messageId: "unexpected",
|
||||
data: { operator },
|
||||
suggest: [
|
||||
{
|
||||
messageId: "suggestNegatedExpression",
|
||||
data: { operator },
|
||||
fix(fixer) {
|
||||
const negationToken = sourceCode.getFirstToken(node.left);
|
||||
const fixRange = [negationToken.range[1], node.range[1]];
|
||||
const text = sourceCode.text.slice(fixRange[0], fixRange[1]);
|
||||
|
||||
if (
|
||||
(isInOrInstanceOfOperator(operator) ||
|
||||
orderingRelationRuleApplies) &&
|
||||
isNegation(node.left) &&
|
||||
!astUtils.isParenthesised(sourceCode, node.left)
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: node.left.loc,
|
||||
messageId: "unexpected",
|
||||
data: { operator },
|
||||
suggest: [
|
||||
{
|
||||
messageId: "suggestNegatedExpression",
|
||||
data: { operator },
|
||||
fix(fixer) {
|
||||
const negationToken =
|
||||
sourceCode.getFirstToken(node.left);
|
||||
const fixRange = [
|
||||
negationToken.range[1],
|
||||
node.range[1],
|
||||
];
|
||||
const text = sourceCode.text.slice(
|
||||
fixRange[0],
|
||||
fixRange[1],
|
||||
);
|
||||
|
||||
return fixer.replaceTextRange(
|
||||
fixRange,
|
||||
`(${text})`,
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
messageId: "suggestParenthesisedNegation",
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(
|
||||
node.left,
|
||||
`(${sourceCode.getText(node.left)})`,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
return fixer.replaceTextRange(fixRange, `(${text})`);
|
||||
}
|
||||
},
|
||||
{
|
||||
messageId: "suggestParenthesisedNegation",
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(node.left, `(${sourceCode.getText(node.left)})`);
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user