Bump the npm group with 2 updates (#2045)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.55.0 to 8.56.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.55.0...v8.56.0) Updates `eslint-plugin-import` from 2.29.0 to 2.29.1 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.29.0...v2.29.1) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
511f073971
commit
144b7d5b16
32 changed files with 618 additions and 251 deletions
36
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
36
node_modules/eslint/lib/linter/config-comment-parser.js
generated
vendored
|
|
@ -15,7 +15,10 @@ const levn = require("levn"),
|
|||
Legacy: {
|
||||
ConfigOps
|
||||
}
|
||||
} = require("@eslint/eslintrc/universal");
|
||||
} = require("@eslint/eslintrc/universal"),
|
||||
{
|
||||
directivesPattern
|
||||
} = require("../shared/directives");
|
||||
|
||||
const debug = require("debug")("eslint:config-comment-parser");
|
||||
|
||||
|
|
@ -148,4 +151,35 @@ module.exports = class ConfigCommentParser {
|
|||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a directive comment into directive text and value.
|
||||
* @param {Comment} comment The comment node with the directive to be parsed.
|
||||
* @returns {{directiveText: string, directiveValue: string}} The directive text and value.
|
||||
*/
|
||||
parseDirective(comment) {
|
||||
const { directivePart } = this.extractDirectiveComment(comment.value);
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
const directiveText = match[1];
|
||||
const directiveValue = directivePart.slice(match.index + directiveText.length);
|
||||
|
||||
return { directiveText, directiveValue };
|
||||
}
|
||||
};
|
||||
|
|
|
|||
33
node_modules/eslint/lib/linter/linter.js
generated
vendored
33
node_modules/eslint/lib/linter/linter.js
generated
vendored
|
|
@ -44,6 +44,7 @@ const { getRuleFromConfig } = require("../config/flat-config-helpers");
|
|||
const { FlatConfigArray } = require("../config/flat-config-array");
|
||||
const { RuleValidator } = require("../config/rule-validator");
|
||||
const { assertIsRuleOptions, assertIsRuleSeverity } = require("../config/flat-config-schema");
|
||||
const { normalizeSeverityToString } = require("../shared/severity");
|
||||
const debug = require("debug")("eslint:linter");
|
||||
const MAX_AUTOFIX_PASSES = 10;
|
||||
const DEFAULT_PARSER_NAME = "espree";
|
||||
|
|
@ -316,24 +317,6 @@ function createDisableDirectives(options) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the directive and the justification from a given directive comment and trim them.
|
||||
* @param {string} value The comment text to extract.
|
||||
* @returns {{directivePart: string, justificationPart: string}} The extracted directive and justification.
|
||||
*/
|
||||
function extractDirectiveComment(value) {
|
||||
const match = /\s-{2,}\s/u.exec(value);
|
||||
|
||||
if (!match) {
|
||||
return { directivePart: value.trim(), justificationPart: "" };
|
||||
}
|
||||
|
||||
const directive = value.slice(0, match.index).trim();
|
||||
const justification = value.slice(match.index + match[0].length).trim();
|
||||
|
||||
return { directivePart: directive, justificationPart: justification };
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses comments in file to extract file-specific config of rules, globals
|
||||
* and environments and merges them with global config; also code blocks
|
||||
|
|
@ -355,7 +338,7 @@ function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig) {
|
|||
});
|
||||
|
||||
sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
const { directivePart, justificationPart } = extractDirectiveComment(comment.value);
|
||||
const { directivePart, justificationPart } = commentParser.extractDirectiveComment(comment.value);
|
||||
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
|
|
@ -500,7 +483,7 @@ function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper) {
|
|||
const disableDirectives = [];
|
||||
|
||||
sourceCode.getInlineConfigNodes().filter(token => token.type !== "Shebang").forEach(comment => {
|
||||
const { directivePart, justificationPart } = extractDirectiveComment(comment.value);
|
||||
const { directivePart, justificationPart } = commentParser.extractDirectiveComment(comment.value);
|
||||
|
||||
const match = directivesPattern.exec(directivePart);
|
||||
|
||||
|
|
@ -620,7 +603,7 @@ function findEslintEnv(text) {
|
|||
if (match[0].endsWith("*/")) {
|
||||
retv = Object.assign(
|
||||
retv || {},
|
||||
commentParser.parseListConfig(extractDirectiveComment(match[1]).directivePart)
|
||||
commentParser.parseListConfig(commentParser.extractDirectiveComment(match[1]).directivePart)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -671,9 +654,11 @@ function normalizeVerifyOptions(providedOptions, config) {
|
|||
reportUnusedDisableDirectives = reportUnusedDisableDirectives ? "error" : "off";
|
||||
}
|
||||
if (typeof reportUnusedDisableDirectives !== "string") {
|
||||
reportUnusedDisableDirectives =
|
||||
linterOptions.reportUnusedDisableDirectives
|
||||
? "warn" : "off";
|
||||
if (typeof linterOptions.reportUnusedDisableDirectives === "boolean") {
|
||||
reportUnusedDisableDirectives = linterOptions.reportUnusedDisableDirectives ? "warn" : "off";
|
||||
} else {
|
||||
reportUnusedDisableDirectives = linterOptions.reportUnusedDisableDirectives === void 0 ? "off" : normalizeSeverityToString(linterOptions.reportUnusedDisableDirectives);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue