From 327795bf3c9bb8e4777d7b36387d01304dd7f46d Mon Sep 17 00:00:00 2001
From: Pirasis Leelatanon <1pete@users.noreply.github.com>
Date: Thu, 26 Oct 2017 02:36:13 +0700
Subject: [PATCH] [doc] add eslint rule reference for `no-new-wrappers`
---
README.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index c5f79a6f..dd9e3324 100644
--- a/README.md
+++ b/README.md
@@ -2796,11 +2796,14 @@ Other Style Guides
- [22.1](#coercion--explicit) Perform type coercion at the beginning of the statement.
- - [22.2](#coercion--strings) Strings:
+ - [22.2](#coercion--strings) Strings: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)
```javascript
// => this.reviewScore = 9;
+ // bad
+ const totalScore = new String(this.reviewScore); // typeof totalScore is "object" not "string"
+
// bad
const totalScore = this.reviewScore + ''; // invokes this.reviewScore.valueOf()
@@ -2812,7 +2815,7 @@ Other Style Guides
```
- - [22.3](#coercion--numbers) Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings. eslint: [`radix`](http://eslint.org/docs/rules/radix)
+ - [22.3](#coercion--numbers) Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings. eslint: [`radix`](http://eslint.org/docs/rules/radix) [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)
```javascript
const inputValue = '4';
@@ -2859,7 +2862,7 @@ Other Style Guides
```
- - [22.6](#coercion--booleans) Booleans:
+ - [22.6](#coercion--booleans) Booleans: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)
```javascript
const age = 0;