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
id-match bug incorrectly errors on NewExpression
#4042
Comments
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. |
I think your RegExp is wrong. You should remove the first |
I want to allow for $ to start a variable name in the case that it is a jQuery variable. |
|
I was under the impression that it would only flag the name of the variable I created, I wasn't expecting to to validate the right hand side. I suppose ignoring globals would be one way, but even then you may run into this issue if using a third party component. I guess I misunderstood the rule in that I was only expecting it to validate the name of the variable I crated. More specifically, I was expecting it to only validate the left hand side. |
@nickInMN - hmm, what you say also makes sense. That's how I constructed my |
Okay, looks like this only happens if you use |
@BYK - Yes, you are correct. If I remove |
@nickInMN - Alright, I'm gonna update the title of your issue then and try to submit a patch soon :) |
Am I misunderstanding what this rule is supposed to do? Version 1.1.0 of ESLint.
I have the following line:
var startDate = new Date();
The rule is configured as:
"id-match": [ 2, "^[a-z$]+([A-Z][a-z]+)*$", { "properties": false } ]
The error I am getting is:
32:25 error Identifier 'Date' does not match the pattern '^[a-z$]+([A-Z][a-z]+)*$' id-match
I thought the idea of this rule is define naming conventions for variables and functions. I get the same error if I try: (yes, I know use [] but was simply a test)
var myArray = new Array();
The text was updated successfully, but these errors were encountered: