Skip to content

match-description options #294

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

Merged
merged 10 commits into from
Jun 27, 2019
Merged

Conversation

brettz9
Copy link
Collaborator

@brettz9 brettz9 commented Jun 25, 2019

  • BREAKING CHANGE(require-description): remove noDefaults option and change contexts to always override defaults
  • feat(match-description): allow mainDescription: string|boolean to override or disable main description separate from default
  • feat(match-description): add contexts options for control on which contexts the rules apply
  • feat(match-description): report line number with match-description
  • feat(match-description): allow reporting multiple errors when main description validation fails
  • feat(require-jsdoc): add contexts option to allow working with any node type
  • fix(match-description, require-description): allow contexts to work with any node type
  • fix(match-description): tighten default regex to require punctuation at the end even if only a single character

matchDescription: {
format: 'regex',
type: 'string'
},
noDefaults: {
Copy link
Collaborator

@golopot golopot Jun 25, 2019

Choose a reason for hiding this comment

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

Why this option? Isn't it more intuitive to let provided contexts to override the default context?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is extra work for users. I believe people will almost always want to keep the defaults. Also, that is the existing behavior for require-description.

Copy link
Owner

Choose a reason for hiding this comment

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

Why this option? Isn't it more intuitive to let provided contexts to override the default context?

Agreed. Otherwise, I need to be aware of what the defaults are. contexts should just override the default.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There have been a few rules already added using this approach, e.g., require-description, check-types. Revert them as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(check-types is somewhat different in referring to avoid the defaults for your preferred types, while require-description is more like as in this PR.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I went ahead and added a commit to make a breaking change to remove noDefaults from require-description (and for match-description) though I haven't done so for check-types unless you want to confirm. Let me know if that is ok.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gajus : Since your approval kind of overlapped with my reversion, I just wanted to confirm--are you happy with my breaking change to undo require-description's use of noDefaults (in addition to removing it in match-description)?

Copy link
Collaborator

@golopot golopot left a comment

Choose a reason for hiding this comment

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

I would prefer not providing the option contexts, why would you want to include or exclude some node type?

@brettz9
Copy link
Collaborator Author

brettz9 commented Jun 25, 2019

contexts is very useful as one can, as per the request in #293 , ensure that one has valid descriptions, e.g., above properties--not only the default behavior of matching descriptions on functions only.

@golopot
Copy link
Collaborator

golopot commented Jun 25, 2019

I mean the rule should apply to all jsdoc without exception (#214).

@brettz9
Copy link
Collaborator Author

brettz9 commented Jun 25, 2019

I think it is better to be under user control, whether for performance or just because projects differ from one another in their needs; but if you want to expand the defaults, I can change to support all node types by default.

matchDescription: {
format: 'regex',
type: 'string'
},
noDefaults: {
Copy link
Owner

Choose a reason for hiding this comment

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

Why this option? Isn't it more intuitive to let provided contexts to override the default context?

Agreed. Otherwise, I need to be aware of what the defaults are. contexts should just override the default.

@golopot
Copy link
Collaborator

golopot commented Jun 25, 2019

In the future please keep unrelated changes in different pull requests. Stuffing all changes in a pr 1) makes it much harder to review, 2) make the reviewer unable to accept one part of change and reject another.

@brettz9
Copy link
Collaborator Author

brettz9 commented Jun 26, 2019

This PR has now been narrowed somewhat, and I think it is ready for merging, @gajus , if you could respond to my comments ending at #294 (comment) mentioning how I added a breaking change that I understood you wanted around the time you approved this PR, so I wanted to confirm that breaking change was indeed ok.

Copy link
Collaborator

@golopot golopot left a comment

Choose a reason for hiding this comment

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

LGTM.

Would you like to rebase the commits? The commit history of master can be less noisy. Also allows sematic-release to generate proper release notes.

@brettz9
Copy link
Collaborator Author

brettz9 commented Jun 26, 2019

If y'all are ready for rebasing, sure.

@brettz9 brettz9 force-pushed the match-description-options branch 2 times, most recently from d718c34 to 91344a4 Compare June 27, 2019 10:58
@brettz9 brettz9 force-pushed the match-description-options branch from 91344a4 to 2c34e21 Compare June 27, 2019 12:03
@brettz9 brettz9 merged commit ecc27c5 into gajus:master Jun 27, 2019
@gajus
Copy link
Owner

gajus commented Jun 27, 2019

🎉 This PR is included in version 9.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Jun 27, 2019
@brettz9 brettz9 deleted the match-description-options branch June 27, 2019 13:01
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.

3 participants