This repository was archived by the owner on Feb 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
This repository was archived by the owner on Feb 21, 2022. It is now read-only.
no-empty-character-class problem #376
Copy link
Copy link
Closed
Description
Here is my code.
get pText() {
return this.text.replace(/\n/gu, '<br/>').replace(/\s/gu, ' ');
}
And I got the hint
WARNING in U:/vue/src/components/BaseP.vue
35:30 don't use empty classes in regular expressions
33 | // 对text进行处理以在网页上正常显示空格与换行
34 | get pText() {
> 35 | return this.text.replace(/\n/gu, '<br/>').replace(/\s/gu, ' ');
| ^
36 | }
37 |
38 | // 图片加载状态
WARNING in U:/vue/src/components/BaseP.vue
35:55 don't use empty classes in regular expressions
33 | // 对text进行处理以在网页上正常显示空格与换行
34 | get pText() {
> 35 | return this.text.replace(/\n/gu, '<br/>').replace(/\s/gu, ' ');
| ^
36 | }
37 |
38 | // 图片加载状态
WARNING in U:/vue/src/components/BaseTimeAxis.vue
42:42 don't use empty classes in regular expressions
40 |
41 | this.timeList.forEach((element, index) => {
> 42 | list[index] = element.text.replace(/\n/gu, '<br/>').replace(/\s/gu, ' ');
| ^
43 | });
44 |
45 | return list;
WARNING in U:/vue/src/components/BaseTimeAxis.vue
42:67 don't use empty classes in regular expressions
40 |
41 | this.timeList.forEach((element, index) => {
> 42 | list[index] = element.text.replace(/\n/gu, '<br/>').replace(/\s/gu, ' ');
| ^
43 | });
44 |
45 | return list;
I don't think it has a empty class, or could anyone tell me how to write \n
and \s
inroder to prevent this error?
mradcliffe
Metadata
Metadata
Assignees
Labels
No labels