admin管理员组文章数量:1344973
I am using thing url regex validation and also have eslint integrated in project.
let url = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/
But when I pile my code getting below errors
4:49 error Unnecessary escape character: \` no-useless-escape
4:62 error Unnecessary escape character: \. no-useless-escape
4:75 error Unnecessary escape character: \$ no-useless-escape
4:79 error Unnecessary escape character: \( no-useless-escape
4:81 error Unnecessary escape character: \) no-useless-escape
4:83 error Unnecessary escape character: \* no-useless-escape
4:85 error Unnecessary escape character: \+ no-useless-escape
I am using thing url regex validation and also have eslint integrated in project.
let url = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$/
But when I pile my code getting below errors
4:49 error Unnecessary escape character: \` no-useless-escape
4:62 error Unnecessary escape character: \. no-useless-escape
4:75 error Unnecessary escape character: \$ no-useless-escape
4:79 error Unnecessary escape character: \( no-useless-escape
4:81 error Unnecessary escape character: \) no-useless-escape
4:83 error Unnecessary escape character: \* no-useless-escape
4:85 error Unnecessary escape character: \+ no-useless-escape
Share
Improve this question
asked Mar 29, 2019 at 5:09
ProferProfer
64310 gold badges47 silver badges97 bronze badges
0
1 Answer
Reset to default 8Well from a quick glance I can see that you are escaping characters inside your regex character classes which probably don't need to be escaped. So, try removing those no-useless-escape
s:
let url = /^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/
本文标签: javascriptUnnecessary escape characternouselessescapeStack Overflow
版权声明:本文标题:javascript - Unnecessary escape character: ` no-useless-escape - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743795339a2540325.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论