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

Make it work with https://www.npmjs.com/package/regex #794

Open
punkpeye opened this issue Dec 21, 2024 · 4 comments
Open

Make it work with https://www.npmjs.com/package/regex #794

punkpeye opened this issue Dec 21, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@punkpeye
Copy link

The main downside of otherwise amazing https://www.npmjs.com/package/regex package is that it does not work with this plugin.

It would be great power combo! @slevithan

@punkpeye punkpeye added the enhancement New feature or request label Dec 21, 2024
@slevithan
Copy link

slevithan commented Dec 21, 2024

If @ota-meshi thinks this is a good idea, I'd be all for it. And I'd be happy to help, at least with answering any questions and making changes to Regex+ that might help with this.

There are some things that make this more feasible:

  • Regex+ syntax is a strict superset of JS regex syntax with flag v enabled. So apart from Regex+'s relatively minimal new syntax and (implicit) flags, there are no changes to native RegExp syntax.
  • Several of Regex+'s additions (implicit flag x, atomic groups, and possessive quantifiers) are based on existing ECMAScript proposals, so supporting them for Regex+ is likely to be reusable for native RegExp in the future.

The biggest challenge I see is that the regex parser eslint-plugin-regexp uses (@eslint-community/regexpp) doesn't support Regex+'s extended syntax and doesn't seem to have a plugin system, so it would need to be forked.

@ota-meshi
Copy link
Owner

Thank you for the feature request.

It would be great if it were possible to support regexp syntaxes in the future, but I don't think that's possible 😓
I also maintain @eslint-community/regexpp, but working on the parser is very hard for me, even to keep up with the latest syntax.
Can you fork @eslint-community/regexpp to support future syntaxes?

@slevithan
Copy link

slevithan commented Jan 8, 2025

I'm also not able to work on this for similar reasons.

But maybe there's an opportunity to do something much simpler?

If eslint-plugin-regexp could run on the .toString() (or .source and .flags) of regexes generated by Regex+'s regex template tag, that would presumably provide much of the benefit, and it would mean that eslint-plugin-regexp never has to know about any new syntax.

@ota-meshi
Copy link
Owner

Hmm... If we don't fork the parser, we won't be able to report to the correct location, so for now I'm hoping someone will create a new parser 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants