@putout/plugin-putout 25.11.1 → 25.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
@@ -74,6 +74,7 @@ npm i @putout/plugin-putout -D
74
74
  - ✅ [includer](#includer);
75
75
  - ✅ [move-require-on-top-level](#move-require-on-top-level);
76
76
  - ✅ [remove-empty-array-from-process](#remove-empty-array-from-process);
77
+ - ✅ [remove-empty-object-from-transform](#remove-empty-object-from-transform);
77
78
  - ✅ [remove-unused-get-properties-argument](#remove-unused-get-properties-argument);
78
79
  - ✅ [remove-useless-printer-option](#remove-useless-printer-option);
79
80
  - ✅ [rename-operate-to-operator](#rename-operate-to-operator);
@@ -152,6 +153,7 @@ npm i @putout/plugin-putout -D
152
153
  "putout/replace-test-message": "on",
153
154
  "putout/remove-unused-get-properties-argument": "on",
154
155
  "putout/remove-empty-array-from-process": "on",
156
+ "putout/remove-empty-object-from-transform": "on",
155
157
  "putout/remove-useless-printer-option": "on",
156
158
  "putout/simplify-replace-template": "on"
157
159
  }
@@ -1702,6 +1704,27 @@ await process('input', []);
1702
1704
  await process('input');
1703
1705
  ```
1704
1706
 
1707
+ ## remove-empty-object-from-transform
1708
+
1709
+ Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f6e8710edf3501a8883f769c82a93048/8060cb8e1505324bb13de511a67d051217a2c39c).
1710
+
1711
+ ### ❌ Example of incorrect code
1712
+
1713
+ ```js
1714
+ test('hello', (t) => {
1715
+ t.transform('nested-labels', {});
1716
+ });
1717
+ ```
1718
+
1719
+ ### ✅ Example of correct code
1720
+
1721
+ ```js
1722
+ test('hello', (t) => {
1723
+ t.transform('nested-labels');
1724
+ });
1725
+ ```
1726
+
1727
+
1705
1728
  ## remove-unused-get-properties-argument
1706
1729
 
1707
1730
  Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/fc32ff87e91fd28f26a03f55eba0663e/3423926ba0a80d30beafe2ac66c70c517df173e1).
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as removeEmptyObjectFromTransform from './remove-empty-object-from-transform/index.js';
1
2
  import * as applyExports from './apply-exports/index.js';
2
3
  import * as applyExportsToRenameFiles from './apply-exports-to-rename-files/index.js';
3
4
  import * as applyExportsToMatchFiles from './apply-exports-to-match-files/index.js';
@@ -136,4 +137,5 @@ export const rules = {
136
137
  'apply-exports-to-match-files': applyExportsToMatchFiles,
137
138
  'apply-exports-to-rename-files': applyExportsToRenameFiles,
138
139
  'apply-exports': ['off', applyExports],
140
+ 'remove-empty-object-from-transform': removeEmptyObjectFromTransform,
139
141
  };
@@ -0,0 +1,15 @@
1
+ import {types} from 'putout';
2
+
3
+ const {isFunction} = types;
4
+
5
+ export const report = () => `Avoid useless empty object passed to 't.transform()'`;
6
+
7
+ export const match = () => ({
8
+ 't.transform(__a, {})': (vars, {parentPath}) => {
9
+ return isFunction(parentPath.parentPath.parentPath);
10
+ },
11
+ });
12
+
13
+ export const replace = () => ({
14
+ 't.transform(__a, {})': 't.transform(__a)',
15
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "25.11.1",
3
+ "version": "25.12.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",