-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Provide Basic Syntax Check for Regular Expression Literals #54744
Comments
You forgot to fill out the issue template. Duplicate of #3432. |
It does look like a duplicate, but this issue does cover something more than #3432. |
Nonetheless, they are (note the canned response followed by issue closure). Maintainers will almost invariably ignore issues that don't follow the template. |
I don’t mean to start a dispute, but this is called Quod licet Iovi, non licet bovi. |
@graphemecluster the reason we ask people to fill out the template is to ensure that people have done their due diligence working through necessary background research. Generally if someone is not willing to do this minimum amount of legwork, they are filing a very low-quality issue, or a duplicate of an existing issue, as occurred here. |
@RyanCavanaugh I apologize for my faults. I did search for existing things beforehand. To be specific, I firstly searched if there are any PRs related to RegExp. Since no significant PRs exist, I looked over the source code and started to work on it while encountering something to inquiry. So I quickly wrote the issue without other checks. This is the reason why I made the duplication. Please pardon me and comment on #3432. |
No worries, I file dupes sometimes too 😅 |
Edit: Since someone is complaining about the failure to follow issue templates, I copied the content to #3432 (comment). Please continue the discussion in that issue.
Original content
Previously worked on #51837, I found that TypeScript gives almost no syntax errors for regular expressions. I would like to file a PR about it, thus I am opening this issue for easier tracking.
But before I work on the issue, I would like to hear some opinions from the Team. I am not sure, but I suppose the job of providing syntax check should not be shirked to linters right?
Something I would like to do are:
But this should be done only for RegExps with
u
orv
flag, i.e. inUnicodeMode
, that means if we encounter au
orv
flag we will need to rescan the whole RegExp again (!!) (i.e. redoing what is done in the currentreScanSlashToken
method)And to check for invalid
DecimalEscape
s and k<GroupName>
s we will also need to count the number of capture groups and record the names of all named capture groups along the way.Am I doing too much or too less? I know doing too much may cause serious performace regressions (well, luckily regular expression literals are not that common compared with string literals). It should be better than doing nothing after all though.
The text was updated successfully, but these errors were encountered: