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
-58
@@ -9,11 +9,7 @@
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const {
|
||||
CALL,
|
||||
CONSTRUCT,
|
||||
ReferenceTracker,
|
||||
} = require("@eslint-community/eslint-utils");
|
||||
const { CALL, CONSTRUCT, ReferenceTracker } = require("@eslint-community/eslint-utils");
|
||||
const getPropertyName = require("./utils/ast-utils").getStaticPropertyName;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -28,72 +24,63 @@ const nonCallableGlobals = ["Atomics", "JSON", "Math", "Reflect", "Intl"];
|
||||
* @returns {string} name to report
|
||||
*/
|
||||
function getReportNodeName(node) {
|
||||
if (node.type === "ChainExpression") {
|
||||
return getReportNodeName(node.expression);
|
||||
}
|
||||
if (node.type === "MemberExpression") {
|
||||
return getPropertyName(node);
|
||||
}
|
||||
return node.name;
|
||||
if (node.type === "ChainExpression") {
|
||||
return getReportNodeName(node.expression);
|
||||
}
|
||||
if (node.type === "MemberExpression") {
|
||||
return getPropertyName(node);
|
||||
}
|
||||
return node.name;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "problem",
|
||||
meta: {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow calling global object properties as functions",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-obj-calls",
|
||||
},
|
||||
docs: {
|
||||
description: "Disallow calling global object properties as functions",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-obj-calls"
|
||||
},
|
||||
|
||||
schema: [],
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpectedCall: "'{{name}}' is not a function.",
|
||||
unexpectedRefCall:
|
||||
"'{{name}}' is reference to '{{ref}}', which is not a function.",
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
unexpectedCall: "'{{name}}' is not a function.",
|
||||
unexpectedRefCall: "'{{name}}' is reference to '{{ref}}', which is not a function."
|
||||
}
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
create(context) {
|
||||
|
||||
return {
|
||||
Program(node) {
|
||||
const scope = sourceCode.getScope(node);
|
||||
const tracker = new ReferenceTracker(scope);
|
||||
const traceMap = {};
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
for (const g of nonCallableGlobals) {
|
||||
traceMap[g] = {
|
||||
[CALL]: true,
|
||||
[CONSTRUCT]: true,
|
||||
};
|
||||
}
|
||||
return {
|
||||
Program(node) {
|
||||
const scope = sourceCode.getScope(node);
|
||||
const tracker = new ReferenceTracker(scope);
|
||||
const traceMap = {};
|
||||
|
||||
for (const {
|
||||
node: refNode,
|
||||
path,
|
||||
} of tracker.iterateGlobalReferences(traceMap)) {
|
||||
const name = getReportNodeName(refNode.callee);
|
||||
const ref = path[0];
|
||||
const messageId =
|
||||
name === ref ? "unexpectedCall" : "unexpectedRefCall";
|
||||
for (const g of nonCallableGlobals) {
|
||||
traceMap[g] = {
|
||||
[CALL]: true,
|
||||
[CONSTRUCT]: true
|
||||
};
|
||||
}
|
||||
|
||||
context.report({
|
||||
node: refNode,
|
||||
messageId,
|
||||
data: { name, ref },
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
for (const { node: refNode, path } of tracker.iterateGlobalReferences(traceMap)) {
|
||||
const name = getReportNodeName(refNode.callee);
|
||||
const ref = path[0];
|
||||
const messageId = name === ref ? "unexpectedCall" : "unexpectedRefCall";
|
||||
|
||||
context.report({ node: refNode, messageId, data: { name, ref } });
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user