-
Notifications
You must be signed in to change notification settings - Fork 154
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
chore: set default severity for lint config #1292
Conversation
🦋 Changeset detectedLatest commit: bf41ff5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Coverage report
Show files with reduced coverage 🔻
Test suite run success640 tests passing in 93 suites. Report generated by 🧪jest coverage report action from bf41ff5 |
it('should print warnign and error', () => { | ||
printConfigLintTotals({ ...totalProblemsMock, warnings: 2 }); | ||
expect(process.stderr.write).toHaveBeenCalledWith( | ||
'❌ Your config has 1 error and 2 warnings.\n' | ||
); | ||
expect(redColoretteMocks).toHaveBeenCalledWith('❌ Your config has 1 error and 2 warnings.\n'); | ||
}); | ||
|
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.
We have only one rule or configuration, so there can only be one severity, error
or warning
3d0def4
to
ad180c0
Compare
Does it make sense to exit with an error code if config linting fails with errors? |
I would expect an error to exit with a status code, yes |
If we exit with an error when linting the config file (this applies to every command), do we need to add the |
@IgorKarpiuk this makes sense. |
@tatomyr Yes 🙂 |
__tests__/lint-config/invalid-definition-and-config/snapshot.js
Outdated
Show resolved
Hide resolved
65662bd
to
29bcb58
Compare
.changeset/witty-taxis-occur.md
Outdated
'@redocly/cli': patch | ||
--- | ||
|
||
Set default severity for the config validation. |
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.
Please include why this is useful, and what behaviour change the user might experience.
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.
Updated
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.
Thank you for sorting this out and formatting the command pages! I think we should sort the parameters alphabetically rather than adding new ones at the end.
I commented on the changelog wording, and I think it should mention the additional parameter.
__tests__/lint-config/invalid-config-assertation-config-type/snapshot.js
Show resolved
Hide resolved
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.
One tiny nitpick to fix but otherwise, very happy to see this in !
.changeset/witty-taxis-occur.md
Outdated
--- | ||
|
||
Added the possibility to configure the linting severity level of the configuration file for all CLI commands. | ||
Now, Redocly CLI will exit with an error if there are any issues with the configuration file, and the severity is set to `error`. |
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.
Yes, but without the "Now" (sorry, a small thing I know!)
What/Why/How?
Set default severity for the config validation and update warning message.
Add
--lint-config
option to all commands and exit with code2
if config validation failed.Previously, we had the default severity
warn
only for thelint
command.Reference
Related: #1277
Testing
Screenshots (optional)
Check yourself
Security