-
-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(linter): use parsed patterns in
no-empty-character-class
rule
- Loading branch information
Showing
2 changed files
with
136 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 60 additions & 32 deletions
92
crates/oxc_linter/src/snapshots/no_empty_character_class.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,86 @@ | ||
--- | ||
source: crates/oxc_linter/src/tester.rs | ||
--- | ||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:11] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:16] | ||
1 │ var foo = /^abc[]/; | ||
· ──────── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:11] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:15] | ||
1 │ var foo = /foo[]bar/; | ||
· ────────── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:15] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:20] | ||
1 │ if (foo.match(/^abc[]/)) {} | ||
· ──────── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:5] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:10] | ||
1 │ if (/^abc[]/.test(foo)) {} | ||
· ──────── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:11] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:12] | ||
1 │ var foo = /[]]/; | ||
· ───── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:11] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:14] | ||
1 │ var foo = /\[[]/; | ||
· ────── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:11] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:21] | ||
1 │ var foo = /\[\[\]a-z[]/; | ||
· ───────────── | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class | ||
╭─[no_empty_character_class.tsx:1:11] | ||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:12] | ||
1 │ var foo = /[]]/d; | ||
· ────── | ||
· ── | ||
╰──── | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:13] | ||
1 │ var foo = /[[][]]/v; | ||
· ── | ||
╰──── | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:15] | ||
1 │ var foo = /[[][]]/v; | ||
· ── | ||
╰──── | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:13] | ||
1 │ var foo = /[[]]|[]/v; | ||
· ── | ||
╰──── | ||
help: Remove the empty character class: `[]` | ||
|
||
⚠ eslint(no-empty-character-class): Empty character class will not match anything | ||
╭─[no_empty_character_class.tsx:1:17] | ||
1 │ var foo = /[[]]|[]/v; | ||
· ── | ||
╰──── | ||
help: Try to remove empty character class `[]` in regexp literal | ||
help: Remove the empty character class: `[]` |