-
Notifications
You must be signed in to change notification settings - Fork 887
Restricted Linter options type #1168
Restricted Linter options type #1168
Conversation
👍 We can probably get away without a test here for now, it would break some of the full CLI tests if it didn't accept valid input. Do you think we should also add a check for |
Yeah, that sounds like a good thing to add. Do you consider any option fields mandatory? If so, instead of checking for |
Strangely enough, it looks like On the other hand, if everything is optional, passing |
It will now auto-correct them to some sane defaults.
…to linter-options-type
Thoughts on this draft? Is there some source of truth for what |
return { | ||
configuration: configuration || DEFAULT_CONFIG, | ||
formatter: formatter || "json", | ||
formattersDirectory: formattersDirectory || "", |
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.
let's not add the || ""
here, it's fine if this stays null
. (An empty string would get treated as the current directory which could lead to unexpected behavior)
Left my thoughts above @JoshuaKGoldberg, feel free to disagree on any of them! |
Beautiful! This turn out very nice |
Also provide sane defaults for all linter configuration options.
Fixes #1167
Wasn't sure where unit tests for this would go, if you do want to test constructor logic.