Repository navigation
feat(linter): noMisleadingCharacterClass - #909
Conversation
38493ce to
11e307b
Compare
|
@togami2864 Could you execute just codegen and commit/push changes? |
|
@togami2864 cc: @ematipico ref:
We may not have to be so particular now. I'd like anyone to share any opinions. |
|
Oh, this is a WIP pull request. I see. |
11e307b to
0e69ea1
Compare
✅ Deploy Preview for rad-torte-839a59 canceled.
|
There was a problem hiding this comment.
As a first look, this looks good! I need more time to review your PR, I was nnot expecting that it also handle nons-static regex. I just left a first comment for the docs.
There was a problem hiding this comment.
I left some suggestions, and the usage of global_identifier for the globalThis.
I think we should add more test cases:
window.RegExpglobalThis.globalThis
I leave the decision to you @togami2864 , this is a nursery rule, so you can decide make a second PR after we merge this one. Let us know what you want to do and we're happy to help.
| let is_global_this = match callee.object().ok()? { | ||
| AnyJsExpression::JsIdentifierExpression(e) => { | ||
| e.name().ok()?.has_name("globalThis") | ||
| } | ||
| _ => false, | ||
| }; |
There was a problem hiding this comment.
We have an utility called global_identifier for these cases, and you use this one. That's needed because it handles recursive cases of global identifiers, like this:
globalThis.globalThis.globalThis.RegExp|
@ematipico |
|
Thank you @togami2864 ! When you merge this PR, please make sure to open a new task (issue) to track your work :) |
Summary
close: #52
implement no-misleading-character-class
This rule isn't 100% compatible with ESLint because it requires an ECMAScript regex parser for certain cases.
Test Plan
add snaps for valid/invalid cases