@putout/plugin-putout 25.12.0 → 26.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
CHANGED
|
@@ -1724,7 +1724,6 @@ test('hello', (t) => {
|
|
|
1724
1724
|
});
|
|
1725
1725
|
```
|
|
1726
1726
|
|
|
1727
|
-
|
|
1728
1727
|
## remove-unused-get-properties-argument
|
|
1729
1728
|
|
|
1730
1729
|
Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fc32ff87e91fd28f26a03f55eba0663e/3423926ba0a80d30beafe2ac66c70c517df173e1).
|
|
@@ -1,48 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
operator,
|
|
3
|
-
template,
|
|
4
|
-
types,
|
|
5
|
-
} from 'putout';
|
|
1
|
+
import {operator} from 'putout';
|
|
6
2
|
|
|
7
|
-
const {
|
|
8
|
-
const {replaceWith, insertBefore} = operator;
|
|
3
|
+
const {replaceWith} = operator;
|
|
9
4
|
|
|
10
5
|
export const report = () => {
|
|
11
|
-
return `
|
|
6
|
+
return `Use 'operator.replaceWithMultiple()' instead of 'path.replaceWithMultiple()'`;
|
|
12
7
|
};
|
|
13
8
|
|
|
14
|
-
const
|
|
15
|
-
const {replaceWithMultiple} = require('putout').operate;
|
|
16
|
-
`);
|
|
17
|
-
|
|
18
|
-
export const fix = ({path, calleePath, property, object, program}) => {
|
|
19
|
-
const first = program.get('body.0');
|
|
20
|
-
const {bindings} = program.scope;
|
|
21
|
-
|
|
9
|
+
export const fix = ({path, calleePath, property, object}) => {
|
|
22
10
|
replaceWith(calleePath, property);
|
|
23
11
|
path.node.arguments.unshift(object);
|
|
24
|
-
|
|
25
|
-
if (bindings.replaceWithMultiple)
|
|
26
|
-
return;
|
|
27
|
-
|
|
28
|
-
if (!bindings.replaceWith && !bindings.insertAfter)
|
|
29
|
-
return insertBefore(first, replaceWithAST);
|
|
30
|
-
|
|
31
|
-
const id = identifier('replaceWithMultiple');
|
|
32
|
-
const varPath = getVarPath(bindings);
|
|
33
|
-
|
|
34
|
-
varPath.node.id.properties.push(objectProperty(id, id, false, true));
|
|
35
12
|
};
|
|
36
13
|
|
|
37
|
-
function getVarPath(bindings) {
|
|
38
|
-
const {replaceWith, insertAfter} = bindings;
|
|
39
|
-
|
|
40
|
-
if (replaceWith)
|
|
41
|
-
return replaceWith.path;
|
|
42
|
-
|
|
43
|
-
return insertAfter.path;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
14
|
export const traverse = ({push}) => ({
|
|
47
15
|
CallExpression(path) {
|
|
48
16
|
const calleePath = path.get('callee');
|
|
@@ -51,6 +51,11 @@ export const traverse = ({push}) => ({
|
|
|
51
51
|
incorrect: INCORRECT.NO_REPORT_AFTER_TRANSFORM,
|
|
52
52
|
correct: ': no report after transform',
|
|
53
53
|
}),
|
|
54
|
+
't.noReportAfterTransform(__a, __b)': convert({
|
|
55
|
+
push,
|
|
56
|
+
incorrect: INCORRECT.NO_REPORT_AFTER_TRANSFORM,
|
|
57
|
+
correct: ': no report after transform',
|
|
58
|
+
}),
|
|
54
59
|
});
|
|
55
60
|
|
|
56
61
|
const convert = ({push, correct, incorrect}) => (path) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with plugins development",
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@putout/eslint-flat": "^3.0.0",
|
|
46
|
+
"@putout/plugin-esm": "*",
|
|
47
|
+
"@putout/plugin-merge-destructuring-properties": "*",
|
|
46
48
|
"@putout/plugin-nodejs": "*",
|
|
47
49
|
"@putout/plugin-tape": "*",
|
|
48
50
|
"@putout/test": "^13.0.0",
|