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
Add wildcard support to new-cap: capIsNewExceptions #5187
Comments
@SimonSchick Thanks for the issue! If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. |
There's not enough information here to know how to respond. Please either add more details to the problem you're reporting or more details to the proposal you're making. |
Hi @SimonSchick, thanks for the issue. It looks like there's not enough information for us to know how to help you. If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. If it's something else, please just provide as much additional information as possible. Thanks! |
Sorry, I wrote this in a hurry. What I want to request is something like this:
So you don't have to whitelist all function separately. |
I also run into this issue whilst using Sequelize with the rule. In my .eslintrc.json I have to list specifically the items I want to whitelist. Such as
I think it would be much better if wildcard support was added so it could turn into something like:
|
Seems reasonable. We would need to stick to just |
I might, just a little low on time right now. Is there any simple pattern matching utility included in the code base? |
I might be able to. I think using glob would help with this (which is included in ESLint) , I'll take a look and see |
I think minimatch is ok since it's already a sub dependency via glob. |
imo using a dependency is better than relying on its sub. I'll start working on it as soon as I get the time 👍 , actually wait, does glob even work for this case? Maybe just using a regex would work better? |
You just need to create a regex. Replace |
Sorry, @SimonSchick are you able to work on this? I haven't started yet on adding it in. |
I sent a pull request |
On the PR, a proposal was made for having full regular expression support and using a different option I'm not sure I like the additional complexity, wheras the initial proposal was fairly simple. What do others think? |
My concern is overloading "a string property name" with "also maybe a wildcard" - it feels very much like repeating some of the language mistakes where it takes both a string and a regex. Note that |
I'm +1 for a separate name with RegEx support. We support regexes for identifier names in other places too. |
I think adding "Immutable.*" to existing options kind of violates plugin schema as it looks like regex, also that may create an impression like i can put any regex here. |
So what are we proposing here? |
Almost that but not sure if they should be array. I think we can cover all cases with a single RegExp. If we have multiple patterns, we can always combine them using |
I think either an array or a single pattern would work well - an array has the advantage that it's harder to cause a bug in the regex when adding or removing a pattern tho. |
@ljharb supporting an array of regexes would be harder and less performant I think, that's why I resist a bit. |
Why would an array of strings that's |
As for performance, certainly internally it could be concat'd to a single pipe-delimited string in the array case. |
That would work. Still unsure. Gonna defer to @eslint/eslint-team |
Looks like we use one string for the |
consistency wins, fair enough |
i can continue work on this since that PR was never merged! |
In some cases it would be nice to be able to specify to ignore a whole library for instance.
I ran into this problem when using sequelize types.
eg.
The text was updated successfully, but these errors were encountered: