-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
578e30b
commit 6d67583
Showing
4 changed files
with
24 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,9 @@ You can ignore this rule for a specific dependency and version or all versions o | |
# Ignore only the specific dependency version mismatch | ||
sherif -i [email protected] -i [email protected] | ||
|
||
# Ignore all versions mismatch of dependencies that starts with @next/ | ||
sherif -i @next/* | ||
|
||
# Completely ignore all versions mismatch of these dependencies | ||
sherif -i react -i next | ||
``` | ||
|
@@ -168,4 +171,3 @@ Dependencies should be ordered alphabetically to prevent complex diffs when inst | |
## License | ||
|
||
[MIT](./LICENSE) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"name": "docs", | ||
"dependencies": { | ||
"@eslint/js": "7.8.9", | ||
"eslint": "7.8.9", | ||
"next": "1.2.3", | ||
"react": "4.5.6" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"name": "abc", | ||
"dependencies": { | ||
"@eslint/js": "9.8.7", | ||
"next": "4.5.6", | ||
"react": "1.2.3" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,6 +320,18 @@ pub fn collect_issues(args: &Args, packages_list: PackagesList) -> IssuesList<'_ | |
.windows(2) | ||
.all(|window| window[0] == window[1]) | ||
&& !args.ignore_dependency.contains(&name) | ||
&& !args.ignore_dependency.iter().any(|dependency| { | ||
if dependency.ends_with('*') { | ||
if dependency.starts_with('*') { | ||
return name | ||
.contains(dependency.trim_start_matches('*').trim_end_matches('*')); | ||
} | ||
return name.starts_with(dependency.trim_end_matches('*')); | ||
} else if dependency.starts_with('*') { | ||
return name.ends_with(dependency.trim_start_matches('*')); | ||
} | ||
false | ||
}) | ||
{ | ||
filtered_versions.sort_keys(); | ||
|
||
|
@@ -607,7 +619,7 @@ mod test { | |
assert_eq!(packages_list.root_package.get_name(), "dependencies"); | ||
|
||
let issues = collect_issues(&args, packages_list); | ||
assert_eq!(issues.total_len(), 3); | ||
assert_eq!(issues.total_len(), 4); | ||
|
||
let issues = issues.into_iter().collect::<IndexMap<_, _>>(); | ||
|
||
|
@@ -623,6 +635,10 @@ mod test { | |
issues.get(&PackageType::None).unwrap()[2].name(), | ||
"multiple-dependency-versions" | ||
); | ||
assert_eq!( | ||
issues.get(&PackageType::None).unwrap()[3].name(), | ||
"multiple-dependency-versions" | ||
); | ||
} | ||
|
||
#[test] | ||
|
@@ -633,25 +649,21 @@ mod test { | |
no_install: false, | ||
ignore_rule: Vec::new(), | ||
ignore_package: Vec::new(), | ||
ignore_dependency: vec!["[email protected]".to_string()], | ||
ignore_dependency: vec!["[email protected]".to_string(), "*eslint*".to_string()], | ||
}; | ||
|
||
let packages_list = collect_packages(&args).unwrap(); | ||
assert_eq!(packages_list.root_package.get_name(), "dependencies"); | ||
|
||
let issues = collect_issues(&args, packages_list); | ||
assert_eq!(issues.total_len(), 2); | ||
assert_eq!(issues.total_len(), 1); | ||
|
||
let issues = issues.into_iter().collect::<IndexMap<_, _>>(); | ||
|
||
assert_eq!( | ||
issues.get(&PackageType::None).unwrap()[0].name(), | ||
"multiple-dependency-versions" | ||
); | ||
assert_eq!( | ||
issues.get(&PackageType::None).unwrap()[1].name(), | ||
"multiple-dependency-versions" | ||
); | ||
} | ||
|
||
#[test] | ||
|