Commit f20b9e9
authored
']' is only allowed to be unescaped in regular expressions when the engine implements Annex B, a legacy part of the ECMA262 spec which is only normative for browsers. In engines that do not implement Annex B, regular expressions like /]/ are a syntax error. Since ESLint can't tell what engine the code will run on, it shouldn't consider escaping ] to be "useless" since it's only useless on engines that implement Annex B, and only in regular expressions that don't contain the unicode flag. (For example, the regular expression /]/u is a syntax error even on engines that implement Annex B.)
1 parent 3004c1e commit f20b9e9
2 files changed
Lines changed: 11 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
| 28 | + | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
197 | | - | |
| 196 | + | |
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
| |||
237 | 245 | | |
238 | 246 | | |
239 | 247 | | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | 248 | | |
253 | 249 | | |
254 | 250 | | |
| |||
0 commit comments