@putout/plugin-putout 11.9.0 → 11.10.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 +17 -0
- package/lib/convert-number-to-numeric/index.js +14 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
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,22 @@ const test = createTest({
|
|
|
130
131
|
});
|
|
131
132
|
```
|
|
132
133
|
|
|
134
|
+
## convert-number-to-numeric
|
|
135
|
+
|
|
136
|
+
### ❌ Example of incorrect code
|
|
137
|
+
|
|
138
|
+
```js
|
|
139
|
+
const {isNumberLiteral} = types;
|
|
140
|
+
isNumberLiteral(node);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### ✅ Example of correct code
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
const {isNumericLiteral} = types;
|
|
147
|
+
isNumericLiteral(node);
|
|
148
|
+
```
|
|
149
|
+
|
|
133
150
|
## convert-putout-test-to-create-test
|
|
134
151
|
|
|
135
152
|
Fixes results of [@putout/convert-commonjs-to-esm](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-commonjs-to-esm) work.
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
8
|
+
|
|
9
|
+
module.exports.traverse = ({push}) => ({
|
|
10
|
+
'isNumberLiteral(__a)': (path) => {
|
|
11
|
+
push(path);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
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