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:
+45
-61
@@ -5,74 +5,58 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Checks if node is required: i.e. does not have a default value or ? optional indicator.
|
||||
* @param {ASTNode} node the node to be evaluated
|
||||
* @returns {boolean} true if the node is required, false if not.
|
||||
*/
|
||||
function isRequiredParameter(node) {
|
||||
return !(
|
||||
node.type === "AssignmentPattern" ||
|
||||
node.type === "RestElement" ||
|
||||
node.optional
|
||||
);
|
||||
}
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
dialects: ["javascript", "typescript"],
|
||||
language: "javascript",
|
||||
type: "suggestion",
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Enforce default parameters to be last",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/default-param-last",
|
||||
},
|
||||
docs: {
|
||||
description: "Enforce default parameters to be last",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/default-param-last"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
shouldBeLast: "Default parameters should be last.",
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
shouldBeLast: "Default parameters should be last."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
/**
|
||||
* Handler for function contexts.
|
||||
* @param {ASTNode} node function node
|
||||
* @returns {void}
|
||||
*/
|
||||
function handleFunction(node) {
|
||||
let hasSeenRequiredParameter = false;
|
||||
create(context) {
|
||||
|
||||
for (let i = node.params.length - 1; i >= 0; i -= 1) {
|
||||
const current = node.params[i];
|
||||
const param =
|
||||
current.type === "TSParameterProperty"
|
||||
? current.parameter
|
||||
: current;
|
||||
/**
|
||||
* Handler for function contexts.
|
||||
* @param {ASTNode} node function node
|
||||
* @returns {void}
|
||||
*/
|
||||
function handleFunction(node) {
|
||||
let hasSeenPlainParam = false;
|
||||
|
||||
if (isRequiredParameter(param)) {
|
||||
hasSeenRequiredParameter = true;
|
||||
continue;
|
||||
}
|
||||
for (let i = node.params.length - 1; i >= 0; i -= 1) {
|
||||
const param = node.params[i];
|
||||
|
||||
if (hasSeenRequiredParameter) {
|
||||
context.report({
|
||||
node: current,
|
||||
messageId: "shouldBeLast",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (
|
||||
param.type !== "AssignmentPattern" &&
|
||||
param.type !== "RestElement"
|
||||
) {
|
||||
hasSeenPlainParam = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
return {
|
||||
FunctionDeclaration: handleFunction,
|
||||
FunctionExpression: handleFunction,
|
||||
ArrowFunctionExpression: handleFunction,
|
||||
};
|
||||
},
|
||||
if (hasSeenPlainParam && param.type === "AssignmentPattern") {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: "shouldBeLast"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
FunctionDeclaration: handleFunction,
|
||||
FunctionExpression: handleFunction,
|
||||
ArrowFunctionExpression: handleFunction
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user