@putout/plugin-putout 11.8.0 → 11.11.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
CHANGED
|
@@ -24,6 +24,7 @@ npm i @putout/plugin-putout -D
|
|
|
24
24
|
"putout/add-push": "on",
|
|
25
25
|
"putout/convert-putout-test-to-create-test": "on",
|
|
26
26
|
"putout/convert-to-no-transform-code": "on",
|
|
27
|
+
"putout/convert-number-to-numeric": "on",
|
|
27
28
|
"putout/convert-replace-with": "on",
|
|
28
29
|
"putout/convert-replace-with-multiple": "on",
|
|
29
30
|
"putout/convert-replace-to-function": "on",
|
|
@@ -130,6 +131,24 @@ const test = createTest({
|
|
|
130
131
|
});
|
|
131
132
|
```
|
|
132
133
|
|
|
134
|
+
## convert-number-to-numeric
|
|
135
|
+
|
|
136
|
+
Prevent `Babel` warning: `The node type NumberLiteral has been renamed to NumericLiteral`.
|
|
137
|
+
|
|
138
|
+
### ❌ Example of incorrect code
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
const {isNumberLiteral} = types;
|
|
142
|
+
isNumberLiteral(node);
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### ✅ Example of correct code
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
const {isNumericLiteral} = types;
|
|
149
|
+
isNumericLiteral(node);
|
|
150
|
+
```
|
|
151
|
+
|
|
133
152
|
## convert-putout-test-to-create-test
|
|
134
153
|
|
|
135
154
|
Fixes results of [@putout/convert-commonjs-to-esm](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-commonjs-to-esm) work.
|
|
@@ -278,7 +297,7 @@ const {
|
|
|
278
297
|
} = require('putout').types;
|
|
279
298
|
```
|
|
280
299
|
|
|
281
|
-
## convert-to-
|
|
300
|
+
## convert-destructuring-to-identifier
|
|
282
301
|
|
|
283
302
|
### ❌ Example of incorrect code
|
|
284
303
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports.report = () => `Use 'isNumericLiteral()' instead of 'isNumberLiteral()'`;
|
|
4
|
+
|
|
5
|
+
module.exports.fix = (path) => {
|
|
6
|
+
path.scope.rename('isNumberLiteral', 'isNumericLiteral');
|
|
7
|
+
path.scope.rename('NumberLiteral', 'NumericLiteral');
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
module.exports.traverse = ({push}) => ({
|
|
11
|
+
'isNumberLiteral(__a)': (path) => {
|
|
12
|
+
push(path);
|
|
13
|
+
},
|
|
14
|
+
'NumberLiteral(__a)': (path) => {
|
|
15
|
+
push(path);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
package/lib/declare/operator.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = {
|
|
|
5
5
|
compare: `const {compare} = operator`,
|
|
6
6
|
compareAll: `const {compareAll} = operator`,
|
|
7
7
|
compareAny: `const {compareAny} = operator`,
|
|
8
|
+
compute: `const {compute} = operator`,
|
|
8
9
|
contains: `const {contains} = operator`,
|
|
9
10
|
declare: `const {declare} = operator`,
|
|
10
11
|
extract: `const {extract} = operator`,
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,7 @@ module.exports.rules = {
|
|
|
13
13
|
...getRule('convert-to-no-transform-code'),
|
|
14
14
|
...getRule('convert-find-to-traverse'),
|
|
15
15
|
...getRule('convert-destructuring-to-identifier'),
|
|
16
|
+
...getRule('convert-number-to-numeric'),
|
|
16
17
|
...getRule('convert-replace-with'),
|
|
17
18
|
...getRule('convert-replace-with-multiple'),
|
|
18
19
|
...getRule('convert-replace-to-function'),
|
package/package.json
CHANGED