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:
Luiz Costa committed 2025-11-18 10:23:55 -03:00
1 parent 20129a1ac7
commit ac4f232e5e
787 files changed
+82341 -121690

No files matched your search

+130 -183
View File
@@ -40,23 +40,20 @@ const astUtils = require("./utils/ast-utils");
* @returns {boolean} `true` if the lists have same tokens.
*/
function areEqualTokenLists(left, right) {
if (left.length !== right.length) {
return false;
}
if (left.length !== right.length) {
return false;
}
for (let i = 0; i < left.length; i++) {
const leftToken = left[i],
rightToken = right[i];
for (let i = 0; i < left.length; i++) {
const leftToken = left[i],
rightToken = right[i];
if (
leftToken.type !== rightToken.type ||
leftToken.value !== rightToken.value
) {
return false;
}
}
if (leftToken.type !== rightToken.type || leftToken.value !== rightToken.value) {
return false;
}
}
return true;
return true;
}
/**
@@ -66,16 +63,18 @@ function areEqualTokenLists(left, right) {
* @returns {boolean} `true` if the keys are equal.
*/
function areEqualKeys(left, right) {
if (typeof left === "string" && typeof right === "string") {
// Statically computed names.
return left === right;
}
if (Array.isArray(left) && Array.isArray(right)) {
// Token lists.
return areEqualTokenLists(left, right);
}
if (typeof left === "string" && typeof right === "string") {
return false;
// Statically computed names.
return left === right;
}
if (Array.isArray(left) && Array.isArray(right)) {
// Token lists.
return areEqualTokenLists(left, right);
}
return false;
}
/**
@@ -84,185 +83,133 @@ function areEqualKeys(left, right) {
* @returns {boolean} `true` if the node is of an accessor kind.
*/
function isAccessorKind(node) {
return node.kind === "get" || node.kind === "set";
return node.kind === "get" || node.kind === "set";
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
meta: {
type: "suggestion",
defaultOptions: [
"anyOrder",
{
enforceForTSTypes: false,
},
],
docs: {
description: "Require grouped accessor pairs in object literals and classes",
recommended: false,
url: "https://eslint.org/docs/latest/rules/grouped-accessor-pairs"
},
docs: {
description:
"Require grouped accessor pairs in object literals and classes",
recommended: false,
url: "https://eslint.org/docs/latest/rules/grouped-accessor-pairs",
},
schema: [
{
enum: ["anyOrder", "getBeforeSet", "setBeforeGet"]
}
],
schema: [
{ enum: ["anyOrder", "getBeforeSet", "setBeforeGet"] },
{
type: "object",
properties: {
enforceForTSTypes: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
notGrouped: "Accessor pair {{ formerName }} and {{ latterName }} should be grouped.",
invalidOrder: "Expected {{ latterName }} to be before {{ formerName }}."
}
},
messages: {
notGrouped:
"Accessor pair {{ formerName }} and {{ latterName }} should be grouped.",
invalidOrder:
"Expected {{ latterName }} to be before {{ formerName }}.",
},
},
create(context) {
const order = context.options[0] || "anyOrder";
const sourceCode = context.sourceCode;
create(context) {
const [order, { enforceForTSTypes }] = context.options;
const { sourceCode } = context;
/**
* Reports the given accessor pair.
* @param {string} messageId messageId to report.
* @param {ASTNode} formerNode getter/setter node that is defined before `latterNode`.
* @param {ASTNode} latterNode getter/setter node that is defined after `formerNode`.
* @returns {void}
* @private
*/
function report(messageId, formerNode, latterNode) {
context.report({
node: latterNode,
messageId,
loc: astUtils.getFunctionHeadLoc(latterNode.value, sourceCode),
data: {
formerName: astUtils.getFunctionNameWithKind(formerNode.value),
latterName: astUtils.getFunctionNameWithKind(latterNode.value)
}
});
}
/**
* Reports the given accessor pair.
* @param {string} messageId messageId to report.
* @param {ASTNode} formerNode getter/setter node that is defined before `latterNode`.
* @param {ASTNode} latterNode getter/setter node that is defined after `formerNode`.
* @returns {void}
* @private
*/
function report(messageId, formerNode, latterNode) {
context.report({
node: latterNode,
messageId,
loc: astUtils.getFunctionHeadLoc(
latterNode.type !== "TSMethodSignature"
? latterNode.value
: latterNode,
sourceCode,
),
data: {
formerName: astUtils.getFunctionNameWithKind(
formerNode.type !== "TSMethodSignature"
? formerNode.value
: formerNode,
),
latterName: astUtils.getFunctionNameWithKind(
latterNode.type !== "TSMethodSignature"
? latterNode.value
: latterNode,
),
},
});
}
/**
* Checks accessor pairs in the given list of nodes.
* @param {ASTNode[]} nodes The list to check.
* @param {Function} shouldCheck – Predicate that returns `true` if the node should be checked.
* @returns {void}
* @private
*/
function checkList(nodes, shouldCheck) {
const accessors = [];
let found = false;
/**
* Checks accessor pairs in the given list of nodes.
* @param {ASTNode[]} nodes The list to check.
* @param {Function} shouldCheck – Predicate that returns `true` if the node should be checked.
* @returns {void}
* @private
*/
function checkList(nodes, shouldCheck) {
const accessors = [];
let found = false;
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (shouldCheck(node) && isAccessorKind(node)) {
if (shouldCheck(node) && isAccessorKind(node)) {
// Creates a new `AccessorData` object for the given getter or setter node.
const name = astUtils.getStaticPropertyName(node);
const key =
name !== null ? name : sourceCode.getTokens(node.key);
// Creates a new `AccessorData` object for the given getter or setter node.
const name = astUtils.getStaticPropertyName(node);
const key = (name !== null) ? name : sourceCode.getTokens(node.key);
// Merges the given `AccessorData` object into the given accessors list.
for (let j = 0; j < accessors.length; j++) {
const accessor = accessors[j];
// Merges the given `AccessorData` object into the given accessors list.
for (let j = 0; j < accessors.length; j++) {
const accessor = accessors[j];
if (areEqualKeys(accessor.key, key)) {
accessor.getters.push(
...(node.kind === "get" ? [node] : []),
);
accessor.setters.push(
...(node.kind === "set" ? [node] : []),
);
found = true;
break;
}
}
if (!found) {
accessors.push({
key,
getters: node.kind === "get" ? [node] : [],
setters: node.kind === "set" ? [node] : [],
});
}
found = false;
}
}
if (areEqualKeys(accessor.key, key)) {
accessor.getters.push(...node.kind === "get" ? [node] : []);
accessor.setters.push(...node.kind === "set" ? [node] : []);
found = true;
break;
}
}
if (!found) {
accessors.push({
key,
getters: node.kind === "get" ? [node] : [],
setters: node.kind === "set" ? [node] : []
});
}
found = false;
}
}
for (const { getters, setters } of accessors) {
// Don't report accessor properties that have duplicate getters or setters.
if (getters.length === 1 && setters.length === 1) {
const [getter] = getters,
[setter] = setters,
getterIndex = nodes.indexOf(getter),
setterIndex = nodes.indexOf(setter),
formerNode =
getterIndex < setterIndex ? getter : setter,
latterNode =
getterIndex < setterIndex ? setter : getter;
for (const { getters, setters } of accessors) {
if (Math.abs(getterIndex - setterIndex) > 1) {
report("notGrouped", formerNode, latterNode);
} else if (
(order === "getBeforeSet" &&
getterIndex > setterIndex) ||
(order === "setBeforeGet" && getterIndex < setterIndex)
) {
report("invalidOrder", formerNode, latterNode);
}
}
}
}
// Don't report accessor properties that have duplicate getters or setters.
if (getters.length === 1 && setters.length === 1) {
const [getter] = getters,
[setter] = setters,
getterIndex = nodes.indexOf(getter),
setterIndex = nodes.indexOf(setter),
formerNode = getterIndex < setterIndex ? getter : setter,
latterNode = getterIndex < setterIndex ? setter : getter;
return {
ObjectExpression(node) {
checkList(node.properties, n => n.type === "Property");
},
ClassBody(node) {
checkList(
node.body,
n => n.type === "MethodDefinition" && !n.static,
);
checkList(
node.body,
n => n.type === "MethodDefinition" && n.static,
);
},
"TSTypeLiteral, TSInterfaceBody"(node) {
if (enforceForTSTypes) {
checkList(
node.type === "TSTypeLiteral"
? node.members
: node.body,
n => n.type === "TSMethodSignature",
);
}
},
};
},
if (Math.abs(getterIndex - setterIndex) > 1) {
report("notGrouped", formerNode, latterNode);
} else if (
(order === "getBeforeSet" && getterIndex > setterIndex) ||
(order === "setBeforeGet" && getterIndex < setterIndex)
) {
report("invalidOrder", formerNode, latterNode);
}
}
}
}
return {
ObjectExpression(node) {
checkList(node.properties, n => n.type === "Property");
},
ClassBody(node) {
checkList(node.body, n => n.type === "MethodDefinition" && !n.static);
checkList(node.body, n => n.type === "MethodDefinition" && n.static);
}
};
}
};