[eslint config] [breaking] add no-useless-escape rule.

This commit is contained in:
Jordan Harband
2016-03-26 23:11:23 -07:00
parent 24565121c1
commit 81241b83cf
2 changed files with 17 additions and 0 deletions

View File

@@ -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)**

View File

@@ -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