Skip to content

Conversation

thorn0
Copy link
Member

@thorn0 thorn0 commented Oct 22, 2022

Description

fix for #13687 (comment)

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

type PropTypes = {|
TestComponent: React.AbstractComponent<any>,
hello: HelloType,
|};
Copy link
Member Author

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

@thorn0 thorn0 marked this pull request as draft October 22, 2022 22:34
@thorn0 thorn0 marked this pull request as ready for review October 23, 2022 07:55
// gap ^^^^
return /^[\s(]*(\/\*(\s*::)?[\s(]*)?$/;
}
}
Copy link
Member

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...

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@fisker fisker Oct 23, 2022

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.

Copy link
Member

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.

Copy link
Member

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 === '/*::'
}

@thorn0 thorn0 merged commit 7682464 into prettier:next Oct 24, 2022
@thorn0 thorn0 deleted the flow-gap-regex branch October 24, 2022 09:20
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants