@putout/plugin-types 1.4.0 → 1.6.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 +2 -1
- package/lib/apply-is-array/index.js +0 -1
- package/lib/convert-typeof-to-is-type/index.js +7 -2
- package/lib/declare/index.js +1 -1
- package/lib/index.js +0 -1
- package/lib/remove-double-negations/index.js +0 -1
- package/lib/remove-useless-conversion/index.js +0 -1
- package/lib/remove-useless-typeof/index.js +0 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ npm i putout @putout/plugin-types -D
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
|
+
|
|
28
29
|
## Rules
|
|
29
30
|
|
|
30
31
|
### declare
|
|
@@ -33,6 +34,7 @@ Based on [`@putout/operator-declare`](https://github.com/coderaiser/putout/tree/
|
|
|
33
34
|
Supported assertions:
|
|
34
35
|
|
|
35
36
|
- `isString`;
|
|
37
|
+
- `isEmptyString`;
|
|
36
38
|
- `isNumber`;
|
|
37
39
|
- `isFn`;
|
|
38
40
|
- `isBool`;
|
|
@@ -187,7 +189,6 @@ Array.isArray(x);
|
|
|
187
189
|
|
|
188
190
|
MIT
|
|
189
191
|
|
|
190
|
-
|
|
191
192
|
## Comparison
|
|
192
193
|
|
|
193
194
|
Linter | Rule | Fix
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {operator} = require('putout');
|
|
4
|
-
const {
|
|
4
|
+
const {
|
|
5
|
+
compare,
|
|
6
|
+
getBindingPath,
|
|
7
|
+
} = operator;
|
|
5
8
|
|
|
6
9
|
const NAMES = {
|
|
7
10
|
function: 'isFn',
|
|
@@ -57,8 +60,10 @@ function isBind(path, name) {
|
|
|
57
60
|
if (!bindingPath)
|
|
58
61
|
return false;
|
|
59
62
|
|
|
63
|
+
if (!bindingPath.isVariableDeclarator())
|
|
64
|
+
return false;
|
|
65
|
+
|
|
60
66
|
const {body} = bindingPath.node.init;
|
|
61
67
|
|
|
62
68
|
return !compare(body, fnBody);
|
|
63
69
|
}
|
|
64
|
-
|
package/lib/declare/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports.declare = () => ({
|
|
4
4
|
isString: `const isString = (a) => typeof a === 'string'`,
|
|
5
|
+
isEmptyString: `const isEmptyString = (a) => !a && isString(a)`,
|
|
5
6
|
isNumber: `const isNumber = (a) => typeof a === 'number'`,
|
|
6
7
|
isFn: `const isFn = (a) => typeof a === 'function'`,
|
|
7
8
|
isBool: `const isBool = (a) => typeof a === 'boolean'`,
|
|
@@ -10,4 +11,3 @@ module.exports.declare = () => ({
|
|
|
10
11
|
isSymbol: `const isSymbol = (a) => typeof a === 'symbol'`,
|
|
11
12
|
isNull: `const isNull = (a) => !a && typeof a === 'object'`,
|
|
12
13
|
});
|
|
13
|
-
|
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.6.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",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@putout/test": "^6.0.0",
|
|
36
36
|
"c8": "^7.5.0",
|
|
37
37
|
"eslint": "^8.0.1",
|
|
38
|
-
"eslint-plugin-n": "^
|
|
39
|
-
"eslint-plugin-putout": "^
|
|
38
|
+
"eslint-plugin-n": "^16.0.0",
|
|
39
|
+
"eslint-plugin-putout": "^17.0.0",
|
|
40
40
|
"lerna": "^6.0.1",
|
|
41
41
|
"madrun": "^9.0.0",
|
|
42
42
|
"montag": "^1.2.1",
|