Bump the npm group with 4 updates (#2015)
* Bump the npm group with 4 updates Bumps the npm group with 4 updates: [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin), [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser), [eslint](https://github.com/eslint/eslint) and [nock](https://github.com/nock/nock). Updates `@typescript-eslint/eslint-plugin` from 6.13.0 to 6.13.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.2/packages/eslint-plugin) Updates `@typescript-eslint/parser` from 6.13.0 to 6.13.2 - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.13.2/packages/parser) Updates `eslint` from 8.54.0 to 8.55.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.54.0...v8.55.0) Updates `nock` from 13.3.8 to 13.4.0 - [Release notes](https://github.com/nock/nock/releases) - [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md) - [Commits](https://github.com/nock/nock/compare/v13.3.8...v13.4.0) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: nock dependency-type: direct:development update-type: version-update:semver-minor 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
a16ac98583
commit
bc50092bdb
168 changed files with 813 additions and 330 deletions
83
node_modules/eslint/lib/rules/no-restricted-imports.js
generated
vendored
83
node_modules/eslint/lib/rules/no-restricted-imports.js
generated
vendored
|
|
@ -74,6 +74,9 @@ const arrayOfStringsOrObjectPatterns = {
|
|||
minItems: 1,
|
||||
uniqueItems: true
|
||||
},
|
||||
importNamePattern: {
|
||||
type: "string"
|
||||
},
|
||||
message: {
|
||||
type: "string",
|
||||
minLength: 1
|
||||
|
|
@ -115,8 +118,12 @@ module.exports = {
|
|||
patternAndImportNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}",
|
||||
|
||||
patternAndEverything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern.",
|
||||
|
||||
patternAndEverythingWithRegexImportName: "* import is invalid because import name matching '{{importNames}}' pattern from '{{importSource}}' is restricted from being used.",
|
||||
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
||||
patternAndEverythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted from being used by a pattern. {{customMessage}}",
|
||||
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
||||
patternAndEverythingWithRegexImportNameAndCustomMessage: "* import is invalid because import name matching '{{importNames}}' pattern from '{{importSource}}' is restricted from being used. {{customMessage}}",
|
||||
|
||||
everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.",
|
||||
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
|
||||
|
|
@ -175,10 +182,11 @@ module.exports = {
|
|||
}
|
||||
|
||||
// relative paths are supported for this rule
|
||||
const restrictedPatternGroups = restrictedPatterns.map(({ group, message, caseSensitive, importNames }) => ({
|
||||
const restrictedPatternGroups = restrictedPatterns.map(({ group, message, caseSensitive, importNames, importNamePattern }) => ({
|
||||
matcher: ignore({ allowRelativePaths: true, ignorecase: !caseSensitive }).add(group),
|
||||
customMessage: message,
|
||||
importNames
|
||||
importNames,
|
||||
importNamePattern
|
||||
}));
|
||||
|
||||
// if no imports are restricted we don't need to check
|
||||
|
|
@ -262,12 +270,13 @@ module.exports = {
|
|||
|
||||
const customMessage = group.customMessage;
|
||||
const restrictedImportNames = group.importNames;
|
||||
const restrictedImportNamePattern = group.importNamePattern ? new RegExp(group.importNamePattern, "u") : null;
|
||||
|
||||
/*
|
||||
* If we are not restricting to any specific import names and just the pattern itself,
|
||||
* report the error and move on
|
||||
*/
|
||||
if (!restrictedImportNames) {
|
||||
if (!restrictedImportNames && !restrictedImportNamePattern) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: customMessage ? "patternWithCustomMessage" : "patterns",
|
||||
|
|
@ -279,40 +288,54 @@ module.exports = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (importNames.has("*")) {
|
||||
const specifierData = importNames.get("*")[0];
|
||||
importNames.forEach((specifiers, importName) => {
|
||||
if (importName === "*") {
|
||||
const [specifier] = specifiers;
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: customMessage ? "patternAndEverythingWithCustomMessage" : "patternAndEverything",
|
||||
loc: specifierData.loc,
|
||||
data: {
|
||||
importSource,
|
||||
importNames: restrictedImportNames,
|
||||
customMessage
|
||||
if (restrictedImportNames) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: customMessage ? "patternAndEverythingWithCustomMessage" : "patternAndEverything",
|
||||
loc: specifier.loc,
|
||||
data: {
|
||||
importSource,
|
||||
importNames: restrictedImportNames,
|
||||
customMessage
|
||||
}
|
||||
});
|
||||
} else {
|
||||
context.report({
|
||||
node,
|
||||
messageId: customMessage ? "patternAndEverythingWithRegexImportNameAndCustomMessage" : "patternAndEverythingWithRegexImportName",
|
||||
loc: specifier.loc,
|
||||
data: {
|
||||
importSource,
|
||||
importNames: restrictedImportNamePattern,
|
||||
customMessage
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
restrictedImportNames.forEach(importName => {
|
||||
if (!importNames.has(importName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const specifiers = importNames.get(importName);
|
||||
|
||||
specifiers.forEach(specifier => {
|
||||
context.report({
|
||||
node,
|
||||
messageId: customMessage ? "patternAndImportNameWithCustomMessage" : "patternAndImportName",
|
||||
loc: specifier.loc,
|
||||
data: {
|
||||
importSource,
|
||||
customMessage,
|
||||
importName
|
||||
}
|
||||
if (
|
||||
(restrictedImportNames && restrictedImportNames.includes(importName)) ||
|
||||
(restrictedImportNamePattern && restrictedImportNamePattern.test(importName))
|
||||
) {
|
||||
specifiers.forEach(specifier => {
|
||||
context.report({
|
||||
node,
|
||||
messageId: customMessage ? "patternAndImportNameWithCustomMessage" : "patternAndImportName",
|
||||
loc: specifier.loc,
|
||||
data: {
|
||||
importSource,
|
||||
customMessage,
|
||||
importName
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue