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:
+68
-67
@@ -15,22 +15,23 @@
|
||||
* @returns {eslint-scope.Variable} The found variable object.
|
||||
*/
|
||||
function getVariableOfArguments(scope) {
|
||||
const variables = scope.variables;
|
||||
const variables = scope.variables;
|
||||
|
||||
for (let i = 0; i < variables.length; ++i) {
|
||||
const variable = variables[i];
|
||||
for (let i = 0; i < variables.length; ++i) {
|
||||
const variable = variables[i];
|
||||
|
||||
if (variable.name === "arguments") {
|
||||
/*
|
||||
* If there was a parameter which is named "arguments", the implicit "arguments" is not defined.
|
||||
* So does fast return with null.
|
||||
*/
|
||||
return variable.identifiers.length === 0 ? variable : null;
|
||||
}
|
||||
}
|
||||
if (variable.name === "arguments") {
|
||||
|
||||
/* c8 ignore next */
|
||||
return null;
|
||||
/*
|
||||
* If there was a parameter which is named "arguments", the implicit "arguments" is not defined.
|
||||
* So does fast return with null.
|
||||
*/
|
||||
return (variable.identifiers.length === 0) ? variable : null;
|
||||
}
|
||||
}
|
||||
|
||||
/* c8 ignore next */
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,74 +45,74 @@ function getVariableOfArguments(scope) {
|
||||
* @returns {boolean} `true` if the reference is not normal member access.
|
||||
*/
|
||||
function isNotNormalMemberAccess(reference) {
|
||||
const id = reference.identifier;
|
||||
const parent = id.parent;
|
||||
const id = reference.identifier;
|
||||
const parent = id.parent;
|
||||
|
||||
return !(
|
||||
parent.type === "MemberExpression" &&
|
||||
parent.object === id &&
|
||||
!parent.computed
|
||||
);
|
||||
return !(
|
||||
parent.type === "MemberExpression" &&
|
||||
parent.object === id &&
|
||||
!parent.computed
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Require rest parameters instead of `arguments`",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/prefer-rest-params",
|
||||
},
|
||||
docs: {
|
||||
description: "Require rest parameters instead of `arguments`",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/prefer-rest-params"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
preferRestParams: "Use the rest parameters instead of 'arguments'.",
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
preferRestParams: "Use the rest parameters instead of 'arguments'."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
create(context) {
|
||||
|
||||
/**
|
||||
* Reports a given reference.
|
||||
* @param {eslint-scope.Reference} reference A reference to report.
|
||||
* @returns {void}
|
||||
*/
|
||||
function report(reference) {
|
||||
context.report({
|
||||
node: reference.identifier,
|
||||
loc: reference.identifier.loc,
|
||||
messageId: "preferRestParams",
|
||||
});
|
||||
}
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Reports references of the implicit `arguments` variable if exist.
|
||||
* @param {ASTNode} node The node representing the function.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkForArguments(node) {
|
||||
const argumentsVar = getVariableOfArguments(
|
||||
sourceCode.getScope(node),
|
||||
);
|
||||
/**
|
||||
* Reports a given reference.
|
||||
* @param {eslint-scope.Reference} reference A reference to report.
|
||||
* @returns {void}
|
||||
*/
|
||||
function report(reference) {
|
||||
context.report({
|
||||
node: reference.identifier,
|
||||
loc: reference.identifier.loc,
|
||||
messageId: "preferRestParams"
|
||||
});
|
||||
}
|
||||
|
||||
if (argumentsVar) {
|
||||
argumentsVar.references
|
||||
.filter(isNotNormalMemberAccess)
|
||||
.forEach(report);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reports references of the implicit `arguments` variable if exist.
|
||||
* @param {ASTNode} node The node representing the function.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkForArguments(node) {
|
||||
const argumentsVar = getVariableOfArguments(sourceCode.getScope(node));
|
||||
|
||||
return {
|
||||
"FunctionDeclaration:exit": checkForArguments,
|
||||
"FunctionExpression:exit": checkForArguments,
|
||||
};
|
||||
},
|
||||
if (argumentsVar) {
|
||||
argumentsVar
|
||||
.references
|
||||
.filter(isNotNormalMemberAccess)
|
||||
.forEach(report);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"FunctionDeclaration:exit": checkForArguments,
|
||||
"FunctionExpression:exit": checkForArguments
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user