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

Use regex instead of two includes methods #11314

Merged
merged 1 commit into from Aug 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/language-js/parse/babel.js
Expand Up @@ -105,7 +105,7 @@ function createParse(parseMethod, ...optionsCombinations) {
}));
}

if (text.includes("#{") || text.includes("#[")) {
if (/#({|\[)/.test(text)) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (/#({|\[)/.test(text)) {
if (/#[[{]/.test(text)) {

Copy link
Member

@fisker fisker Aug 6, 2021

Choose a reason for hiding this comment

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

I'm surprised that eslint-plugin-import didn't report

I thought #11013 already merged.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I missed your review sorry. I want to review the PR, but I'm not familiar with regex.

combinations = combinations.map((options) =>
appendPlugins([recordAndTuplePlugin], options)
);
Expand Down