@putout/plugin-putout 12.5.0 → 12.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.
@@ -1,10 +1,15 @@
1
1
  'use strict';
2
2
 
3
+ const {operator} = require('putout');
4
+ const {rename} = operator;
5
+
3
6
  module.exports.report = () => 'Use addArgs instead of addArgument';
4
7
 
5
8
  module.exports.replace = () => ({
6
9
  'addArgument(__args)': (vars, path) => {
7
- path.scope.rename('addArgument', 'addArgs');
10
+ const program = path.scope.getProgramParent().path;
11
+ rename(program, 'addArgument', 'addArgs');
12
+
8
13
  return path;
9
14
  },
10
15
  });
@@ -1,25 +1,26 @@
1
1
  'use strict';
2
2
 
3
+ const {operator} = require('putout');
4
+ const {rename} = operator;
5
+
3
6
  module.exports.report = () => `Use 'isNumericLiteral()' instead of 'isNumberLiteral()'`;
4
7
 
5
8
  module.exports.fix = (path) => {
6
9
  const bindings = path.scope.getAllBindings();
7
10
  const {name} = path.node.callee;
11
+ const program = path.scope.getProgramParent().path;
8
12
 
9
13
  if (!bindings.isNumericLiteral)
10
- path.scope.rename('isNumberLiteral', 'isNumericLiteral');
14
+ rename(program, 'isNumberLiteral', 'isNumericLiteral');
11
15
 
12
16
  if (!bindings.NumericLiteral)
13
- path.scope.rename('NumberLiteral', 'NumericLiteral');
17
+ rename(program, 'NumberLiteral', 'NumericLiteral');
14
18
 
15
19
  path.node.callee.name = name.replace('Number', 'Numeric');
16
20
  };
17
21
 
18
- module.exports.traverse = ({push}) => ({
19
- 'isNumberLiteral(__a)': (path) => {
20
- push(path);
21
- },
22
- 'NumberLiteral(__a)': (path) => {
23
- push(path);
24
- },
25
- });
22
+ module.exports.include = () => [
23
+ 'isNumberLiteral(__a)',
24
+ 'NumberLiteral(__a)',
25
+ ];
26
+
@@ -8,6 +8,8 @@ module.exports = {
8
8
  compute: `const {compute} = operator`,
9
9
  contains: `const {contains} = operator`,
10
10
  declare: `const {declare} = operator`,
11
+ rename: `const {rename} = operator`,
12
+ renameProperty: `const {renameProperty} = operator`,
11
13
  extract: `const {extract} = operator`,
12
14
  getPathAfterImports: `const {getPathAfterImports} = operator`,
13
15
  traverse: `const {traverse} = operator`,
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const {operator} = require('putout');
4
+ const {rename} = operator;
5
+
3
6
  module.exports.report = () => '"operator" should be used instead of "operate"';
4
7
 
5
8
  module.exports.include = () => [
@@ -14,5 +17,5 @@ module.exports.filter = (path) => {
14
17
  };
15
18
 
16
19
  module.exports.fix = (path) => {
17
- path.scope.rename('operate', 'operator');
20
+ rename(path, 'operate', 'operator');
18
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "12.5.0",
3
+ "version": "12.6.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,7 +39,7 @@
39
39
  "@putout/test": "^6.0.0",
40
40
  "c8": "^7.5.0",
41
41
  "eslint": "^8.0.1",
42
- "eslint-plugin-n": "^15.2.4",
42
+ "eslint-plugin-n": "^16.0.0",
43
43
  "eslint-plugin-putout": "^17.0.0",
44
44
  "lerna": "^6.0.1",
45
45
  "madrun": "^9.0.0",