-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Tweak gap regex for Flow #13703
Tweak gap regex for Flow #13703
Conversation
type PropTypes = {| | ||
TestComponent: React.AbstractComponent<any>, | ||
hello: HelloType, | ||
|}; |
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.
I forgot to move this test in #13687
// gap ^^^^ | ||
return /^[\s(]*(\/\*(\s*::)?[\s(]*)?$/; | ||
} | ||
} |
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.
I remember there is one regexp for babel-ts? Where is it...
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.
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.
Ah, removed in #10457, forgot.
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.
Will /^(\s|\(|\/\*\s*::)*$/
work? This is more readable to me.
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.
Can we use isGap
? So we can use a function, the regexp is hard to read when it's long.
function isGap(text) {
text = text.replace(/[\s\(]/g, '')
return !text || text === '/*::'
}
Description
fix for #13687 (comment)
Checklist
docs/
directory).changelog_unreleased/*/XXXX.md
file followingchangelog_unreleased/TEMPLATE.md
.✨Try the playground for this PR✨