You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[no-zero-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-zero-quantifier.html)| disallow quantifiers with a maximum of zero | ✅ ||| 💡 |
160
-
|[optimal-lookaround-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/optimal-lookaround-quantifier.html)| disallow the alternatives of lookarounds that end with a non-constant quantifier || ✅ |||
160
+
|[optimal-lookaround-quantifier](https://ota-meshi.github.io/eslint-plugin-regexp/rules/optimal-lookaround-quantifier.html)| disallow the alternatives of lookarounds that end with a non-constant quantifier || ✅ ||💡|
|[prefer-escape-replacement-dollar-char](https://ota-meshi.github.io/eslint-plugin-regexp/rules/prefer-escape-replacement-dollar-char.html)| enforces escape of replacement `$` character (`$$`). |||||
|[no-zero-quantifier](no-zero-quantifier.md)| disallow quantifiers with a maximum of zero | ✅ ||| 💡 |
67
-
|[optimal-lookaround-quantifier](optimal-lookaround-quantifier.md)| disallow the alternatives of lookarounds that end with a non-constant quantifier || ✅ |||
67
+
|[optimal-lookaround-quantifier](optimal-lookaround-quantifier.md)| disallow the alternatives of lookarounds that end with a non-constant quantifier || ✅ ||💡|
remove: "The quantified expression {{expr}} at the {{endOrStart}} of the expression tree should only be matched a constant number of times. The expression can be removed without affecting the lookaround.",
71
72
replacedWith:
72
73
"The quantified expression {{expr}} at the {{endOrStart}} of the expression tree should only be matched a constant number of times. The expression can be replaced with {{replacer}} without affecting the lookaround.",
74
+
suggestRemove: "Remove the expression.",
75
+
suggestReplace: "Replace the expression with {{replacer}}.",
Copy file name to clipboardExpand all lines: tests/lib/rules/optimal-lookaround-quantifier.ts
+6-6
Original file line number
Diff line number
Diff line change
@@ -17,8 +17,8 @@ tester.run("optimal-lookaround-quantifier", rule as any, {
17
17
{
18
18
message:
19
19
"The quantified expression 'a*' at the end of the expression tree should only be matched a constant number of times. The expression can be removed without affecting the lookaround.",
20
-
line: 1,
21
20
column: 6,
21
+
suggestions: [{output: `/(?=b)/`}],
22
22
},
23
23
],
24
24
},
@@ -28,8 +28,8 @@ tester.run("optimal-lookaround-quantifier", rule as any, {
28
28
{
29
29
message:
30
30
"The quantified expression 'c*' at the end of the expression tree should only be matched a constant number of times. The expression can be removed without affecting the lookaround.",
31
-
line: 1,
32
31
column: 14,
32
+
suggestions: [{output: `/(?=(?:a|b|ab))/`}],
33
33
},
34
34
],
35
35
},
@@ -39,8 +39,8 @@ tester.run("optimal-lookaround-quantifier", rule as any, {
39
39
{
40
40
message:
41
41
"The quantified expression 'c+' at the end of the expression tree should only be matched a constant number of times. The expression can be replaced with 'c' (no quantifier) without affecting the lookaround.",
42
-
line: 1,
43
42
column: 14,
43
+
suggestions: [{output: `/(?=(?:a|b|abc))/`}],
44
44
},
45
45
],
46
46
},
@@ -50,8 +50,8 @@ tester.run("optimal-lookaround-quantifier", rule as any, {
50
50
{
51
51
message:
52
52
"The quantified expression 'c{4,9}' at the end of the expression tree should only be matched a constant number of times. The expression can be replaced with 'c{4}' without affecting the lookaround.",
53
-
line: 1,
54
53
column: 14,
54
+
suggestions: [{output: `/(?=(?:a|b|abc{4}))/`}],
55
55
},
56
56
],
57
57
},
@@ -61,8 +61,8 @@ tester.run("optimal-lookaround-quantifier", rule as any, {
61
61
{
62
62
message:
63
63
"The quantified expression '[a-c]*' at the start of the expression tree should only be matched a constant number of times. The expression can be removed without affecting the lookaround.",
64
-
line: 1,
65
64
column: 6,
65
+
suggestions: [{output: `/(?<=)/`}],
66
66
},
67
67
],
68
68
},
@@ -72,8 +72,8 @@ tester.run("optimal-lookaround-quantifier", rule as any, {
72
72
{
73
73
message:
74
74
"The quantified expression '(?:d|c)*' at the start of the expression tree should only be matched a constant number of times. The expression can be removed without affecting the lookaround.",
0 commit comments