-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: add breaking change pr check ci #9050
chore: add breaking change pr check ci #9050
Conversation
Thanks for the PR, @yeonjuan! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
function checkTitle(title) { | ||
if (/!/.test(title)) { | ||
raiseError(`Do not use exclamation mark ('!') in your PR Title.`); | ||
} | ||
} |
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.
Hmmm, isn't this too restrictive? I can imagine the several cases when !
might be used not in the "breaking changes" position (before the semicolon)
Here are several real world PRs that have an exclamation mark in their titles:
- feat(eslint-plugin): [prefer-optional-chain] support suggesting
!foo || !foo.bar
as a valid match for the rule #5594 - docs: add missing ! (...) around comparison cases in no-unnecessary-boolean-literal-compare fixer #6968
- feat(eslint-plugin): [no-extra-non-null-assertion] flag optional chain after a non-null assertion #1460
I guess we should restrict only the use of feat(...)!: ...
and feat!: ...
. What do you think?
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 small note on PR title RegExp, otherwise LGTM!
} | ||
|
||
function checkTitle(title) { | ||
if (/^[a-z]+(\([a-z]+\))?!: /.test(title)) { |
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.
if (/^[a-z]+(\([a-z]+\))?!: /.test(title)) { | |
if (/^[a-z]+(\([a-z-]+\))?!: /.test(title)) { |
Without the dash, this regexp won't catch feat(eslint-plugin)!: ...
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! I fixed it cde7ec4
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.
try { | ||
checkTitle(pullRequest.title); | ||
checkDescription(pullRequest.body, pullRequest.labels); | ||
} catch (e) { | ||
core.setFailed(e.message); | ||
} |
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.
Nit: I'd personally rather something like const error = checkTitle(...) || checkDescription(...)
. But this is fine for an internal script. If it does end up getting changed much later, we can always refactor. 🙂
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.
🚀
PR Checklist
Overview
Add CI that checks breaking change pr title and body.
!
) in PR title.