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
Add --print-config CLI flag (fixes #3127) #3532
Add --print-config CLI flag (fixes #3127) #3532
Conversation
lib/cli.js
Outdated
process.stdout.write(JSON.stringify(config, null, " ")); | ||
}) | ||
.catch((err /*: { stack: any, code: any }*/) => { | ||
console.log(err.stack); // eslint-disable-line no-console |
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.
Maybe we need to create a new function to catch errors, not just copy these lines.
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.
👌 thanks for the suggestion, should be taken care of now. I'm not familiar with the stylelint codebase at all so let me know if there are other parts of the code that could use a refactor or two.
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.
LGTM, thanks!
|
Resolves #3127.
This PR is largely inspired by the ESLint implementation. Also recycles its (succinct) docs. Most of the functionality is taken care of by
getConfigForFile
, so what I added is mostly an integration of that into the CLI, replicating howgetConfigForFile
gets called inlintSource
.Here are useful commands to use while testing this that should cover the various scenarios:
Sample output:
And the errors: