@putout/plugin-types 2.6.0 → 4.0.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 +4 -4
- package/lib/declare/index.js +2 -0
- package/lib/index.js +12 -9
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ Supported assertions:
|
|
|
43
43
|
- `isSymbol`;
|
|
44
44
|
- `isNull`;
|
|
45
45
|
- `isBigInt`;
|
|
46
|
+
- `isArray`;
|
|
47
|
+
- `isEmptyArray`;
|
|
46
48
|
|
|
47
49
|
#### ❌ Example of incorrect code
|
|
48
50
|
|
|
@@ -117,17 +119,15 @@ const a = [1].includes(1);
|
|
|
117
119
|
#### ❌ Example of incorrect code
|
|
118
120
|
|
|
119
121
|
```js
|
|
120
|
-
if (!!a)
|
|
122
|
+
if (!!a)
|
|
121
123
|
console.log('hi');
|
|
122
|
-
}
|
|
123
124
|
```
|
|
124
125
|
|
|
125
126
|
#### ✅ Example of correct code
|
|
126
127
|
|
|
127
128
|
```js
|
|
128
|
-
if (a)
|
|
129
|
+
if (a)
|
|
129
130
|
console.log('hi');
|
|
130
|
-
}
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
### remove-useless-typeof
|
package/lib/declare/index.js
CHANGED
|
@@ -11,4 +11,6 @@ module.exports.declare = () => ({
|
|
|
11
11
|
isSymbol: `const isSymbol = (a) => typeof a === 'symbol'`,
|
|
12
12
|
isBigInt: `const isBigInt = (a) => typeof a === 'bigint'`,
|
|
13
13
|
isNull: `const isNull = (a) => !a && typeof a === 'object'`,
|
|
14
|
+
isArray: 'const {isArray} = Array',
|
|
15
|
+
isEmptyArray: 'const isEmptyArray = (a) => isArray(a) && !a.length',
|
|
14
16
|
});
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const applyIsArray = require('./apply-is-array');
|
|
4
|
+
const declare = require('./declare');
|
|
5
|
+
const convertTypeofToIsType = require('./convert-typeof-to-is-type');
|
|
6
|
+
const removeUselessConversion = require('./remove-useless-conversion');
|
|
7
|
+
const removeDoubleNegations = require('./remove-double-negations');
|
|
8
|
+
const removeUselessTypeof = require('./remove-useless-typeof');
|
|
6
9
|
|
|
7
10
|
module.exports.rules = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
'apply-is-array': applyIsArray,
|
|
12
|
+
declare,
|
|
13
|
+
'convert-typeof-to-is-type': convertTypeofToIsType,
|
|
14
|
+
'remove-useless-conversion': removeUselessConversion,
|
|
15
|
+
'remove-double-negations': removeDoubleNegations,
|
|
16
|
+
'remove-useless-typeof': removeUselessTypeof,
|
|
14
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.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",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
],
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@putout/plugin-putout": "*",
|
|
35
|
-
"@putout/test": "^
|
|
36
|
-
"c8": "^
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint-plugin-n": "^
|
|
39
|
-
"eslint-plugin-putout": "^
|
|
35
|
+
"@putout/test": "^9.0.0",
|
|
36
|
+
"c8": "^9.0.0",
|
|
37
|
+
"eslint": "^9.0.0",
|
|
38
|
+
"eslint-plugin-n": "^17.0.0",
|
|
39
|
+
"eslint-plugin-putout": "^22.0.0",
|
|
40
40
|
"lerna": "^6.0.1",
|
|
41
|
-
"madrun": "^
|
|
41
|
+
"madrun": "^10.0.0",
|
|
42
42
|
"montag": "^1.2.1",
|
|
43
43
|
"nodemon": "^3.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"putout": ">=
|
|
46
|
+
"putout": ">=35"
|
|
47
47
|
},
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
50
|
+
"node": ">=18"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|