-
Notifications
You must be signed in to change notification settings - Fork 909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): improve format module resolving #464
fix(cli): improve format module resolving #464
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! I have a minor nitpick
@commitlint/cli/src/cli.js
Outdated
@@ -260,17 +262,23 @@ function selectParserOpts(parserPreset) { | |||
return parserPreset.parserOpts; | |||
} | |||
|
|||
function resolveModulePath(name, cwd) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could avoid the catch block via
function resolveModulePath(name, cwd) {
return resolveFrom.silent(__dirname, name) || resolveFrom.silent(cwd, name) || resolveGlobal.silent(name);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are those "Doh!" moments for me 😅 I've no clue why I didn't think about this. I will change it now! Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! I've removed the extra resolveModulePath
method. I used it for the try-catch contraption. Right now it's both easy to read, and the order is readable (at least, that's my opinion). 😄
@byCedric Have you pushed your latest changes? |
@marionebl Now I have! 😅 |
Thanks <3 |
Description
Fixes #463
Motivation and Context
See issue #463
Usage examples
See issue #463
How Has This Been Tested?
See issue #463
Types of changes
Checklist: