@putout/plugin-types 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/lib/index.js +1 -0
- package/lib/remove-useless-typeof/index.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,8 @@ npm i putout @putout/plugin-types -D
|
|
|
19
19
|
"types/declare": "on",
|
|
20
20
|
"types/convert-typeof-to-istype": "on",
|
|
21
21
|
"types/remove-useless-conversion": "on",
|
|
22
|
-
"types/remove-double-negations": "on"
|
|
22
|
+
"types/remove-double-negations": "on",
|
|
23
|
+
"types/remove-useless-typeof": "on"
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
```
|
|
@@ -89,7 +90,6 @@ if (isBool(a))
|
|
|
89
90
|
return x;
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
|
|
93
93
|
### remove-useless-conversion
|
|
94
94
|
|
|
95
95
|
#### ❌ Example of incorrect code
|
|
@@ -129,6 +129,24 @@ if (a) {
|
|
|
129
129
|
}
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
### remove-useless-typeof
|
|
133
|
+
|
|
134
|
+
> The `typeof` operator returns a string indicating the type of the unevaluated operand.
|
|
135
|
+
>
|
|
136
|
+
> (c) [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof)
|
|
137
|
+
|
|
138
|
+
#### ❌ Example of incorrect code
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
typeof typeof 'hello';
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### ✅ Example of correct code
|
|
145
|
+
|
|
146
|
+
```js
|
|
147
|
+
typeof 'hello';
|
|
148
|
+
```
|
|
149
|
+
|
|
132
150
|
## Comparison
|
|
133
151
|
|
|
134
152
|
Linter | Rule | Fix
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-types",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin adds ability to transform code related to types assertions",
|