Skip to content
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

feat: exclude common inconsistent property names #230

Merged
merged 1 commit into from
Jan 26, 2021

Conversation

christiancompton
Copy link

Closes #181 .

@@ -65,7 +65,7 @@ const defaults = {
'no_property_description': 'warning',
'description_mentions_json': 'warning',
'array_of_arrays': 'warning',
'inconsistent_property_type': 'warning',
'inconsistent_property_type': ['warning', 'code', 'default', 'type', 'value'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense this way?

Suggested change
'inconsistent_property_type': ['warning', 'code', 'default', 'type', 'value'],
'inconsistent_property_type': ['warning', ['code', 'default', 'type', 'value']],

Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, I think the approach is great. I left a few comments for very small changes that we can discuss if need be

@@ -65,7 +65,7 @@ const defaults = {
'no_property_description': 'warning',
'description_mentions_json': 'warning',
'array_of_arrays': 'warning',
'inconsistent_property_type': 'warning',
'inconsistent_property_type': ['warning', 'code', 'default', 'type', 'value'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make a suggestion for a small tweak here. I think the list of keys to exclude should be their own list. Right now, it looks to me like these values are separate arguments with potentially different purposes. Since they are all meant to be grouped as a list though, I think it makes more sense to have them be one argument in list form, like:

['warning', ['code', 'default', 'type', 'value']]

README.md Outdated
@@ -483,7 +483,7 @@ The default values for each rule are described below.
| no_property_description | warning |
| description_mentions_json | warning |
| array_of_arrays | warning |
| inconsistent_property_type | warning |
| inconsistent_property_type | warning, code, default, type, value] |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For rules with config options like warning, lower_snake_case and case_convention in the name, it's fairly obvious what the configuration represents.

In this new case, it may not be as obvious. I think we should document what the list means. Something like

Suggested change
| inconsistent_property_type | warning, code, default, type, value] |
| inconsistent_property_type | warning, [code, default, type, value] | (List of property names excluded for this check)

I don't know if that would screw up the table formatting though. Maybe there's another place we could document it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did need to modify this slightly to get the table to render properly

printed: false
};
if (configOption && !configOption.includes(key)) {
// add property if the name is not generic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really picky 😅, but users may exclude non-generic properties

Suggested change
// add property if the name is not generic
// add property if the name is not excluded

@christiancompton christiancompton force-pushed the inconsistent_property branch 3 times, most recently from 1a70f0d to 312e331 Compare January 26, 2021 17:16
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@christiancompton christiancompton merged commit d1b9909 into master Jan 26, 2021
@christiancompton christiancompton deleted the inconsistent_property branch January 26, 2021 18:32
dpopp07 pushed a commit that referenced this pull request Jan 26, 2021
# [0.34.0](v0.33.2...v0.34.0) (2021-01-26)

### Features

* exclude common inconsistent property names ([#230](#230)) ([d1b9909](d1b9909))
@dpopp07
Copy link
Member

dpopp07 commented Jan 26, 2021

🎉 This PR is included in version 0.34.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inconsistent_property_type is too aggressive, with no individual way to skip
3 participants