@putout/plugin-putout 11.9.0 → 11.12.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.
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ module.exports.report = () => `Use 'isNumericLiteral()' instead of 'isNumberLiteral()'`;
4
+
5
+ module.exports.fix = (path) => {
6
+ const bindings = path.scope.getAllBindings();
7
+ const {name} = path.node.callee;
8
+
9
+ if (!bindings.isNumericLiteral)
10
+ path.scope.rename('isNumberLiteral', 'isNumericLiteral');
11
+
12
+ if (!bindings.NumericLiteral)
13
+ path.scope.rename('NumberLiteral', 'NumericLiteral');
14
+
15
+ path.node.callee.name = name.replace('Number', 'Numeric');
16
+ };
17
+
18
+ module.exports.traverse = ({push}) => ({
19
+ 'isNumberLiteral(__a)': (path) => {
20
+ push(path);
21
+ },
22
+ 'NumberLiteral(__a)': (path) => {
23
+ push(path);
24
+ },
25
+ });
26
+
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "11.9.0",
3
+ "version": "11.12.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊Putout plugin helps with plugins development",
@@ -39,8 +39,8 @@
39
39
  "@putout/test": "^5.0.0",
40
40
  "c8": "^7.5.0",
41
41
  "eslint": "^8.0.1",
42
- "eslint-plugin-node": "^11.0.0",
43
- "eslint-plugin-putout": "^15.0.0",
42
+ "eslint-plugin-n": "^15.2.4",
43
+ "eslint-plugin-putout": "^16.0.0",
44
44
  "lerna": "^5.0.0",
45
45
  "madrun": "^9.0.0",
46
46
  "montag": "^1.2.1",