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:
+82
-87
@@ -10,106 +10,101 @@ const astUtils = require("./utils/ast-utils");
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../types').Rule.RuleModule} */
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [{}],
|
||||
docs: {
|
||||
description: "Disallow inline comments after code",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-inline-comments"
|
||||
},
|
||||
|
||||
docs: {
|
||||
description: "Disallow inline comments after code",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-inline-comments",
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
ignorePattern: {
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
],
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
ignorePattern: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
unexpectedInlineComment: "Unexpected comment inline with code."
|
||||
}
|
||||
},
|
||||
|
||||
messages: {
|
||||
unexpectedInlineComment: "Unexpected comment inline with code.",
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const options = context.options[0];
|
||||
let customIgnoreRegExp;
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
const [{ ignorePattern }] = context.options;
|
||||
const customIgnoreRegExp =
|
||||
ignorePattern && new RegExp(ignorePattern, "u");
|
||||
if (options && options.ignorePattern) {
|
||||
customIgnoreRegExp = new RegExp(options.ignorePattern, "u");
|
||||
}
|
||||
|
||||
/**
|
||||
* Will check that comments are not on lines starting with or ending with code
|
||||
* @param {ASTNode} node The comment node to check
|
||||
* @private
|
||||
* @returns {void}
|
||||
*/
|
||||
function testCodeAroundComment(node) {
|
||||
const startLine = String(sourceCode.lines[node.loc.start.line - 1]),
|
||||
endLine = String(sourceCode.lines[node.loc.end.line - 1]),
|
||||
preamble = startLine.slice(0, node.loc.start.column).trim(),
|
||||
postamble = endLine.slice(node.loc.end.column).trim(),
|
||||
isPreambleEmpty = !preamble,
|
||||
isPostambleEmpty = !postamble;
|
||||
/**
|
||||
* Will check that comments are not on lines starting with or ending with code
|
||||
* @param {ASTNode} node The comment node to check
|
||||
* @private
|
||||
* @returns {void}
|
||||
*/
|
||||
function testCodeAroundComment(node) {
|
||||
|
||||
// Nothing on both sides
|
||||
if (isPreambleEmpty && isPostambleEmpty) {
|
||||
return;
|
||||
}
|
||||
const startLine = String(sourceCode.lines[node.loc.start.line - 1]),
|
||||
endLine = String(sourceCode.lines[node.loc.end.line - 1]),
|
||||
preamble = startLine.slice(0, node.loc.start.column).trim(),
|
||||
postamble = endLine.slice(node.loc.end.column).trim(),
|
||||
isPreambleEmpty = !preamble,
|
||||
isPostambleEmpty = !postamble;
|
||||
|
||||
// Matches the ignore pattern
|
||||
if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) {
|
||||
return;
|
||||
}
|
||||
// Nothing on both sides
|
||||
if (isPreambleEmpty && isPostambleEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
// JSX Exception
|
||||
if (
|
||||
(isPreambleEmpty || preamble === "{") &&
|
||||
(isPostambleEmpty || postamble === "}")
|
||||
) {
|
||||
const enclosingNode = sourceCode.getNodeByRangeIndex(
|
||||
node.range[0],
|
||||
);
|
||||
// Matches the ignore pattern
|
||||
if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
enclosingNode &&
|
||||
enclosingNode.type === "JSXEmptyExpression"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// JSX Exception
|
||||
if (
|
||||
(isPreambleEmpty || preamble === "{") &&
|
||||
(isPostambleEmpty || postamble === "}")
|
||||
) {
|
||||
const enclosingNode = sourceCode.getNodeByRangeIndex(node.range[0]);
|
||||
|
||||
// Don't report ESLint directive comments
|
||||
if (astUtils.isDirectiveComment(node)) {
|
||||
return;
|
||||
}
|
||||
if (enclosingNode && enclosingNode.type === "JSXEmptyExpression") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedInlineComment",
|
||||
});
|
||||
}
|
||||
// Don't report ESLint directive comments
|
||||
if (astUtils.isDirectiveComment(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
context.report({
|
||||
node,
|
||||
messageId: "unexpectedInlineComment"
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
Program() {
|
||||
sourceCode
|
||||
.getAllComments()
|
||||
.filter(token => token.type !== "Shebang")
|
||||
.forEach(testCodeAroundComment);
|
||||
},
|
||||
};
|
||||
},
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
Program() {
|
||||
sourceCode.getAllComments()
|
||||
.filter(token => token.type !== "Shebang")
|
||||
.forEach(testCodeAroundComment);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user