报错:Unexpected control character(s) in regular expression
Screenshot of error report:
How to solve:
The first solution:
//.eslintrc.js
/**
* "off"或者0 //关闭规则关闭
"warn"或者1 //在打开的规则作为警告(不影响退出代码)
"error"或者2 //把规则作为一个错误(退出代码触发时为1)
*/
rules: {
"no-control-regex": 0,
}
The second solution (add an eslint test ignore or a more detailed test ignore statement directly to a certain code):
//.eslintrc.js 是这个项目的通用,肯定不能为了个别特殊而去改变整体的规则
// eslint-disable-next-line no-control-regex 用这个
var pattern = /[^\x00-\xff]|\s/ // eslint-disable-line 或者用这个