mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 13:08:06 -05:00
[eslint config] [breaking] add no-useless-escape rule.
This commit is contained in:
14
README.md
14
README.md
@@ -547,6 +547,20 @@ Other Style Guides
|
||||
<a name="strings--eval"></a><a name="6.5"></a>
|
||||
- [6.5](#strings--eval) Never use `eval()` on a string, it opens too many vulnerabilities.
|
||||
|
||||
<a name="strings--escaping"></a>
|
||||
- [6.6](#strings--escaping) Do not unnecessarily escape characters in strings. eslint: [`no-useless-escape`](http://eslint.org/docs/rules/no-useless-escape)
|
||||
|
||||
> Why? Backslashes harm readability, thus they should only be present when necessary.
|
||||
|
||||
```javascript
|
||||
// bad
|
||||
const foo = '\'this\' \i\s \"quoted\"';
|
||||
|
||||
// good
|
||||
const foo = '\'this\' is "quoted"';
|
||||
const foo = `'this' is "quoted"`;
|
||||
```
|
||||
|
||||
**[⬆ back to top](#table-of-contents)**
|
||||
|
||||
|
||||
|
||||
@@ -113,6 +113,9 @@ module.exports = {
|
||||
'no-unused-labels': 2,
|
||||
// disallow unnecessary .call() and .apply()
|
||||
'no-useless-call': 0,
|
||||
// disallow unnecessary string escaping
|
||||
// http://eslint.org/docs/rules/no-useless-escape
|
||||
'no-useless-escape': 2,
|
||||
// disallow use of void operator
|
||||
'no-void': 0,
|
||||
// disallow usage of configurable warning terms in comments: e.g. todo
|
||||
|
||||
Reference in New Issue
Block a user