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

Chore: refactor regex in config comment parser #12662

Merged
merged 1 commit into from Dec 20, 2019

Conversation

mdjermanovic
Copy link
Member

What is the purpose of this pull request? (put an "X" next to item)

[X] Other, please explain:

A chore to avoid an error that occurs while bundling linter for the online demo.

regjsparser treats escaped - in character classes in a regex with the u flag as invalid syntax.

E.g., /[\-]/u

ref: jviereck/regjsparser#98

What changes did you make? (Give an overview)

Modified one regex in linter/config-comment-parser.js to avoid escaping -.

Is there anything you'd like reviewers to focus on?

Are the new and the old regexes equivalent.

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Dec 14, 2019
@mdjermanovic mdjermanovic added chore This change is not user-facing core Relates to ESLint's core APIs and features evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Dec 14, 2019
@kaicataldo
Copy link
Member

Was there a recent release that broke this? If so, could we lock it at an old version? Looks like it's breaking our CI builds.

@mdjermanovic
Copy link
Member Author

It's happening with v0.6.1 of regjsparser, released less than 24h ago.

Would it be possible to lock it at the previous version? It seems to be a deep dependency.

Looks like this chore PR fixed the problem (this build is passing). On the other hand, refactoring a core feat because of the demo build doesn't look nice, although it's a very small change.

@Conduitry Conduitry mentioned this pull request Dec 15, 2019
2 tasks
@kaicataldo
Copy link
Member

@eslint/eslint-team Can we get some other opinions on this? This is currently making CI fail in master.

Copy link
Member

@platinumazure platinumazure left a comment

Choose a reason for hiding this comment

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

Might as well put this in. The regexes should be equivalent (- does not need to be escaped at the beginning or end of a character class, but does need to be escaped elsewhere, and order of characters in a character class shouldn't matter).

@mysticatea
Copy link
Member

mysticatea commented Dec 17, 2019

It may be good if we update webpack.config.js. For example, ["@babel/preset-env", { targets: "> 1%, not ie 11" }] will fix this as not using that problematic parser.

@kaicataldo
Copy link
Member

I don't think we support IE 11 on the site anymore anyway.

@mysticatea
Copy link
Member

Right. The demo of our site doesn't support IE11 while a time.

Since jviereck/regjsparser#98 doesn't have positive reaction, I think better that we update our build to stop using regjsparser.

Copy link
Member

@kaicataldo kaicataldo left a comment

Choose a reason for hiding this comment

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

I think it would be prudent to land this to fix CI ASAP and to follow up with @mysticatea's suggestion.

Copy link
Member

@btmills btmills left a comment

Choose a reason for hiding this comment

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

👍 to this as a temporary solution until @mysticatea's suggestion is implemented.

@kaicataldo kaicataldo merged commit 7171fca into master Dec 20, 2019
@kaicataldo kaicataldo deleted the commentparser-regex-avoidescape branch December 20, 2019 04:18
@kaicataldo
Copy link
Member

Thanks for contributing!

@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Dec 20, 2019
@kaicataldo
Copy link
Member

Sorry, meant to mark this as accepted before merging since it had three approvals from TSC members in addition to being proposed by a team member.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion chore This change is not user-facing core Relates to ESLint's core APIs and features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants