@putout/plugin-putout 22.0.0 → 22.1.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
@@ -62,6 +62,7 @@ npm i @putout/plugin-putout -D
62
62
  - ✅ [move-require-on-top-level](#move-require-on-top-level);
63
63
  - ✅ [remove-empty-array-from-process](#remove-empty-array-from-process);
64
64
  - ✅ [remove-unused-get-properties-argument](#remove-unused-get-properties-argument);
65
+ - ✅ [remove-useless-printer-option](#remove-useless-printer-option);
65
66
  - ✅ [rename-operate-to-operator](#rename-operate-to-operator);
66
67
  - ✅ [replace-operate-with-operator](#replace-operate-with-operator);
67
68
  - ✅ [replace-test-message](#replace-test-message);
@@ -125,6 +126,7 @@ npm i @putout/plugin-putout -D
125
126
  "putout/replace-test-message": "on",
126
127
  "putout/remove-unused-get-properties-argument": "on",
127
128
  "putout/remove-empty-array-from-process": "on",
129
+ "putout/remove-useless-printer-option": "on",
128
130
  "putout/simplify-replace-template": "on"
129
131
  }
130
132
  }
@@ -1345,6 +1347,32 @@ const {
1345
1347
  } = getProperties(__jsonPath, ['parser', 'rules', 'extends']);
1346
1348
  ```
1347
1349
 
1350
+ ## remove-useless-printer-option
1351
+
1352
+ Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/f176313cf67fd6d7138470385511319f/5b26aa45db21f250016d228b7bbabbb3c10b582b).
1353
+ `putout` printer used by default, so there is no need to pass it.
1354
+
1355
+ ### ❌ Example of incorrect code
1356
+
1357
+ ```js
1358
+ const test = createTest(__dirname, {
1359
+ printer: 'putout',
1360
+ plugins: [
1361
+ ['remove-unchanged-zero-declarations', plugin],
1362
+ ],
1363
+ });
1364
+ ```
1365
+
1366
+ ### ✅ Example of correct code
1367
+
1368
+ ```js
1369
+ const test = createTest(__dirname, {
1370
+ plugins: [
1371
+ ['remove-unchanged-zero-declarations', plugin],
1372
+ ],
1373
+ });
1374
+ ```
1375
+
1348
1376
  ## simplify-replace-template
1349
1377
 
1350
1378
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/a012fc12f4d38038da022f7c8f379fe2/c65bf97c42650aa31c5481849bc934323df892a6).
package/lib/index.js CHANGED
@@ -54,6 +54,7 @@ const removeEmptyArrayFromProcess = require('./remove-empty-array-from-process')
54
54
  const addPlacesToComparePlaces = require('./add-places-to-compare-places');
55
55
  const addPathArgToFix = require('./add-path-arg-to-fix');
56
56
  const convertIncludeToTraverse = require('./convert-include-to-traverse');
57
+ const removeUselessPrinterOption = require('./remove-useless-printer-option');
57
58
 
58
59
  module.exports.rules = {
59
60
  'apply-processors-destructuring': applyProcessorsDestructuring,
@@ -110,4 +111,5 @@ module.exports.rules = {
110
111
  'add-places-to-compare-places': addPlacesToComparePlaces,
111
112
  'add-path-arg-to-fix': addPathArgToFix,
112
113
  'convert-include-to-traverse': convertIncludeToTraverse,
114
+ 'remove-useless-printer-option': removeUselessPrinterOption,
113
115
  };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ const {operator, types} = require('putout');
4
+ const {
5
+ isCallExpression,
6
+ isIdentifier,
7
+ } = types;
8
+ const {remove} = operator;
9
+
10
+ module.exports.report = () => `Avoid useless 'printer' option`;
11
+
12
+ module.exports.fix = (path) => {
13
+ remove(path);
14
+ };
15
+
16
+ module.exports.traverse = ({push}) => ({
17
+ ObjectProperty(path) {
18
+ const {value} = path.node;
19
+
20
+ if (value.value !== 'putout')
21
+ return;
22
+
23
+ const {parentPath} = path.parentPath;
24
+
25
+ if (!isCallExpression(parentPath))
26
+ return;
27
+
28
+ const name = 'createTest';
29
+
30
+ if (!isIdentifier(parentPath.node.callee, {name}))
31
+ return;
32
+
33
+ push(path);
34
+ },
35
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "22.0.0",
3
+ "version": "22.1.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",