@putout/plugin-putout 29.0.0 → 29.2.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
@@ -88,6 +88,7 @@ npm i @putout/plugin-putout -D
88
88
  - ✅ [remove-empty-object-from-transform](#remove-empty-object-from-transform);
89
89
  - ✅ [remove-unused-get-properties-argument](#remove-unused-get-properties-argument);
90
90
  - ✅ [remove-useless-printer-option](#remove-useless-printer-option);
91
+ - ✅ [remove-useless-source-argument](#remove-useless-source-argument);
91
92
  - ✅ [remove-message-from-no-report-after-transform](#remove-message-from-no-report-after-transform);
92
93
  - ✅ [rename-operate-to-operator](#rename-operate-to-operator);
93
94
  - ✅ [replace-operate-with-operator](#replace-operate-with-operator);
@@ -178,6 +179,7 @@ npm i @putout/plugin-putout -D
178
179
  "putout/remove-empty-array-from-process": "on",
179
180
  "putout/remove-empty-object-from-transform": "on",
180
181
  "putout/remove-useless-printer-option": "on",
182
+ "putout/remove-useless-source-argument": "on",
181
183
  "putout/remove-message-from-no-report-after-transform": "on",
182
184
  "putout/simplify-replace-template": "on"
183
185
  }
@@ -1323,9 +1325,6 @@ This is additional tests, if you forget to test some case (from a big list of ru
1323
1325
 
1324
1326
  ## declare
1325
1327
 
1326
- Depends on [@putout/convert-esm-to-commonjs](https://github.com/coderaiser/putout/tree/master/packages/plugin-convert-esm-to-commonjs#readme) and
1327
- [@putout/declare](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare#readme).
1328
-
1329
1328
  ### ❌ Example of incorrect code
1330
1329
 
1331
1330
  ```js
@@ -1336,7 +1335,7 @@ isIdentifier(a);
1336
1335
  ### ✅ Example of correct code
1337
1336
 
1338
1337
  ```js
1339
- const {operator, types} = require('putout');
1338
+ import {operator, types} from 'putout';
1340
1339
 
1341
1340
  const {compare} = operator;
1342
1341
  const {isIdentifier} = types;
@@ -2081,6 +2080,36 @@ const test = createTest(__dirname, {
2081
2080
  });
2082
2081
  ```
2083
2082
 
2083
+ ## remove-useless-source-argument
2084
+
2085
+ Check it out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/9b5f94d6a60f3337f925fcc338370d83/0f47ee0e979ae4ea27007c2f9751a1376b36de01).
2086
+
2087
+ ### ❌ Example of incorrect code
2088
+
2089
+ ```js
2090
+ import {tryCatch} from 'try-catch';
2091
+
2092
+ transform(ast, options);
2093
+ findPlaces(ast, options);
2094
+
2095
+ tryCatch(transform, ast, {});
2096
+
2097
+ tryCatch(findPlaces, ast, resultOptions);
2098
+ ```
2099
+
2100
+ ### ✅ Example of correct code
2101
+
2102
+ ```js
2103
+ import {tryCatch} from 'try-catch';
2104
+
2105
+ transform(ast, options);
2106
+ findPlaces(ast, options);
2107
+
2108
+ tryCatch(transform, ast, {});
2109
+
2110
+ tryCatch(findPlaces, ast, resultOptions);
2111
+ ```
2112
+
2084
2113
  ## simplify-replace-template
2085
2114
 
2086
2115
  Checkout in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/a012fc12f4d38038da022f7c8f379fe2/c65bf97c42650aa31c5481849bc934323df892a6).
@@ -16,7 +16,7 @@ export default (rootPath, source) => {
16
16
 
17
17
  const getVar = createVarStore(rootPath);
18
18
 
19
- transform(ast, source, {
19
+ transform(ast, {
20
20
  rules: {
21
21
  generate: ['on', {
22
22
  getVar,
@@ -114,7 +114,7 @@ const createTraverseReplacer = ({once, push}) => (path) => {
114
114
  isTS: true,
115
115
  });
116
116
 
117
- const [transformError] = tryCatch(transform, ast, keyCode, {
117
+ const [transformError] = tryCatch(transform, ast, {
118
118
  plugins: [
119
119
  ['evaluate', {
120
120
  report: noop,
@@ -0,0 +1,4 @@
1
+ {
2
+ "renameProperties": "const {renameProperties} = operator",
3
+ "renameFiles": "const {renameFiles} = operator"
4
+ }
@@ -3,7 +3,6 @@ export default {
3
3
  findFile: 'const {findFile} = operator',
4
4
  findFileUp: 'const {findFileUp} = operator',
5
5
  renameFile: 'const {renameFile} = operator',
6
- renameFiles: 'const {renameFiles} = operator',
7
6
  removeFile: 'const {removeFile} = operator',
8
7
  moveFile: 'const {moveFile} = operator',
9
8
  createFile: 'const {createFile} = operator',
@@ -4,8 +4,12 @@ import jsx from './jsx.js';
4
4
  import keyword from './keyword.js';
5
5
  import parens from './parens.js';
6
6
  import regexp from './regexp.js';
7
+ import creators from './creators.json' with {
8
+ type: 'json',
9
+ };
7
10
 
8
11
  export default {
12
+ ...creators,
9
13
  ...filesystem,
10
14
  ...json,
11
15
  ...jsx,
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as removeUselessSourceArgument from './remove-useless-source-argument/index.js';
1
2
  import * as applyTraverserToIgnore from './apply-traverser-to-ignore/index.js';
2
3
  import * as addPathArgToMatch from './add-path-arg-to-match/index.js';
3
4
  import * as removeMessageFromNoReportAfterTransform from './remove-message-from-no-report-after-transform/index.js';
@@ -162,4 +163,5 @@ export const rules = {
162
163
  'remove-message-from-no-report-after-transform': removeMessageFromNoReportAfterTransform,
163
164
  'add-path-arg-to-match': addPathArgToMatch,
164
165
  'apply-traverser-to-ignore': applyTraverserToIgnore,
166
+ 'remove-useless-source-argument': removeUselessSourceArgument,
165
167
  };
@@ -0,0 +1,14 @@
1
+ import {types} from 'putout';
2
+
3
+ const {isObjectProperty} = types;
4
+
5
+ export const report = () => `Avoid useless 'source' argument`;
6
+
7
+ export const filter = (path) => !isObjectProperty(path.parentPath);
8
+
9
+ export const replace = () => ({
10
+ 'findPlaces(__a, __b, __c)': 'findPlaces(__a, __c)',
11
+ 'transform(__a, __b, __c)': 'transform(__a, __c)',
12
+ 'tryCatch(transform, __a, __b, __c)': 'tryCatch(transform, __a, __c)',
13
+ 'tryCatch(findPlaces, __a, __b, __c)': 'tryCatch(findPlaces, __a, __c)',
14
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "29.0.0",
3
+ "version": "29.2.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",
@@ -51,8 +51,8 @@
51
51
  "c8": "^10.0.0",
52
52
  "eslint": "^10.0.0",
53
53
  "eslint-plugin-n": "^17.0.0",
54
- "eslint-plugin-putout": "^30.0.0",
55
- "madrun": "^12.0.0",
54
+ "eslint-plugin-putout": "^31.0.0",
55
+ "madrun": "^13.0.0",
56
56
  "montag": "^1.2.1",
57
57
  "nodemon": "^3.0.1",
58
58
  "supertape": "^12.0.0"