Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

implement no-empty-character-class #135

Merged
merged 5 commits into from
Mar 4, 2020
Merged

implement no-empty-character-class #135

merged 5 commits into from
Mar 4, 2020

Conversation

Kelbie
Copy link
Contributor

@Kelbie Kelbie commented Mar 4, 2020

Hi, this is my first serious pull-request on an open-source project so I'd appretiate any feedback you could give.

I implemented all the same tests that eslint has with some modification because the rome linter was complaining.

The regex I used for checking if there is an empty character class is /^([^\\[]|\\.|\[([^\\\]]|\\.)+\])*$/u which comes from the eslint regex: /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gimuys]*$/u. I trimmed it down because in rome it's testing the pattern and in eslint it's testing the full regex.

#94

@sebmck
Copy link
Contributor

sebmck commented Mar 4, 2020

Looks good! Could you format the files with prettier? scripts/prettier-format will do it for you.

@sebmck
Copy link
Contributor

sebmck commented Mar 4, 2020

I would love to add a regex parser and enrich the RegExpLiteral node. It would allow a ton of amazing transforms and lints. Hopefully if we can make this happen this lint can be a whole lot simpler and more reliable. Thank you for the PR!

@sebmck sebmck merged commit c1186ce into rome:master Mar 4, 2020
@sebmck sebmck mentioned this pull request Mar 4, 2020
27 tasks
@Kelbie Kelbie deleted the lint/no-empty-character-class branch March 4, 2020 21:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants