Skip to content

Commit

Permalink
Suppress the behavior of treating a leading ! character as negation o…
Browse files Browse the repository at this point in the history
…n dependencies check
  • Loading branch information
creativebay committed Mar 30, 2023
1 parent 1ded6f2 commit 53fa473
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/validation/validateDependencyRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ function validateConfig(config, sourceFile, importRecord) {
// Check whether:
// 1) The import matches the rule
// 2) If necessary, the source file has a relevant tag
if (minimatch(importRecord.rawImport, dependencyRule.dependency) &&
if (minimatch(importRecord.rawImport, dependencyRule.dependency, {
matchBase: true,
nonegate: true,
}) &&
fileHasNecessaryTag_1.default(sourceFile, dependencyRule.accessibleTo)) {
// A rule matched, so the dependency is valid
return;
Expand Down
6 changes: 5 additions & 1 deletion src/validation/validateDependencyRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function validateConfig(config: Config, sourceFile: NormalizedPath, importRecord
// Check whether:
// 1) The import matches the rule
// 2) If necessary, the source file has a relevant tag

if (
minimatch(importRecord.rawImport, dependencyRule.dependency) &&
minimatch(importRecord.rawImport, dependencyRule.dependency, {
matchBase: true,
nonegate: true,
}) &&
fileHasNecessaryTag(sourceFile, dependencyRule.accessibleTo)
) {
// A rule matched, so the dependency is valid
Expand Down

0 comments on commit 53fa473

Please sign in to comment.