-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix: SyntaxError message for v flag with RegExpValidator#validatePattern #110
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as far as I can tell. Just left one question.
throw new RegExpSyntaxError( | ||
source, | ||
{ unicode, unicodeSets }, | ||
sourceEnd + 1 /* `/` */, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example:
const validator = new RegExpValidator();
validator.validatePattern("abcd", 0, 2, { unicode: true, unicodeSets: true });
It throws error with an index that doesn't seem to point to the /
in the whole source:
{
"message": "Invalid regular expression: /abcd/uv: Invalid regular expression flags"
"index": 3
}
Is that okay? (I guess 5
would be wrong as out-of-range for the parsed part of the pattern).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for checking this PR!
Hmm. I think it's probably a pre-existing bug.
For example, the following case also returns the wrong pattern.
validator.validatePattern("[A]", 0, 2, { unicode: true, unicodeSets: false });
{
"message": "Invalid regular expression: /[A]/u: Unterminated character class",
"index": 2,
}
I think it's a bug that doesn't occur via ESLint, so I think it can be addressed in another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I posted an issue #112.
Thank you for the review! |
🎉 This PR is included in version 4.6.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
See eslint/eslint#17404 (comment)