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
Feature request: [jsx-pascal-case] Support regex/glob match #2905
Comments
It's not a good idea to allow regex configs. Globs are acceptable, though. (in the future, it may be best to wait on a PR until a maintainer has responded to the issue). |
Hey, thanks for the quick response and review! I figured the worst thing that can happen with user-supplied regex is it might make this specific ESLint rule run a bit slow (and only for a pathological case, eg. lots of backtracking in an old V8), and this is a worthwhile cost in order to provide an API consistent with ESLint core rules. That said, I don't have a strong opinion, and am happy to use a glob instead. Do you have a preference between minimatch, micromatch, or hand-rolling something? I'll also respond to your question on the linked PR here, to keep the convo in one place:
The specific motivating use case is for a part of the FB codebase we ban import aliasing, and have an existing lint rule to warn about I'm also more than happy to fork the rule for our own use case, and not contribute the fix to this repo -- let me know what you prefer. |
To be honest, the bigger danger is getting caught in another worthless CVE (like most of them are) about catastrophic regex backtracking. eslint-plugin-import uses minimatch, so we might as well follow suit here. Banning import aliasing is an ... interesting ... choice. would it be too much to suggest naming them |
We certainly could, though we tend to prefer suffixes like Let me update the diff with minimatch. Hopefully it comes in handy for others, too. |
Like the ESLint camelcase rule: https://github.com/eslint/eslint/blob/master/docs/rules/camelcase.md
This is to support suffixes like
_DEPRECATED
, etc.The text was updated successfully, but these errors were encountered: