@putout/plugin-putout 24.0.0 → 24.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
@@ -26,6 +26,7 @@ npm i @putout/plugin-putout -D
26
26
  - ✅ [apply-create-nested-directory](#apply-create-nested-directory);
27
27
  - ✅ [apply-declare](#apply-declare);
28
28
  - ✅ [apply-exports-to-add-args](#apply-exports-to-add-args);
29
+ - ✅ [apply-exports-to-match-files](#apply-exports-to-match-files);
29
30
  - ✅ [apply-for-of-to-track-file](#apply-for-of-to-track-file);
30
31
  - ✅ [apply-fixture-name-to-message](#apply-fixture-name-to-message);
31
32
  - ✅ [apply-insert-after](#apply-insert-after);
@@ -98,6 +99,7 @@ npm i @putout/plugin-putout -D
98
99
  "putout/apply-async-formatter": "on",
99
100
  "putout/apply-declare": "on",
100
101
  "putout/apply-exports-to-add-args": "on",
102
+ "putout/apply-exports-to-match-files": "on",
101
103
  "putout/apply-report": "on",
102
104
  "putout/apply-processors-destructuring": "on",
103
105
  "putout/apply-rename": "on",
@@ -484,6 +486,36 @@ export {
484
486
  };
485
487
  ```
486
488
 
489
+ ## apply-exports-to-match-files
490
+
491
+ Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d40ac85b974249c51f9874919468fd30/4194c9b21d065bd1359ffc7298aaeb1835fbbb48).
492
+
493
+ ### ❌ Example of incorrect code
494
+
495
+ ```js
496
+ export default matchFiles({
497
+ '*.cjs': plugin,
498
+ });
499
+ ```
500
+
501
+ ### ✅ Example of correct code
502
+
503
+ ```js
504
+ const {
505
+ report,
506
+ fix,
507
+ scan,
508
+ } = matchFiles({
509
+ '*.cjs': plugin,
510
+ });
511
+
512
+ export {
513
+ report,
514
+ fix,
515
+ scan,
516
+ };
517
+ ```
518
+
487
519
  ## apply-async-formatter
488
520
 
489
521
  ### ❌ Example of incorrect code
@@ -0,0 +1,12 @@
1
+ export const report = () => `Apply 'exports' to 'matchFiles`;
2
+
3
+ export const replace = () => ({
4
+ 'export default matchFiles(__args)': `{
5
+ const {report, fix, scan} = matchFiles(__args);
6
+ export {
7
+ report,
8
+ fix,
9
+ scan,
10
+ };
11
+ }`,
12
+ });
@@ -5,12 +5,16 @@ const {
5
5
  isTemplateLiteral,
6
6
  } = types;
7
7
 
8
+ const check = ({__a}) => isStringLiteral(__a) || isTemplateLiteral(__a);
9
+
8
10
  export const report = () => `Typeof 'report' should be a 'function'`;
9
11
 
10
12
  export const match = () => ({
11
- 'module.exports.report = __a': ({__a}) => isStringLiteral(__a) || isTemplateLiteral(__a),
13
+ 'module.exports.report = __a': check,
14
+ 'export const report = __a': check,
12
15
  });
13
16
 
14
17
  export const replace = () => ({
15
18
  'module.exports.report = __a': 'module.exports.report = () => __a',
19
+ 'export const report = __a': 'export const report = () => __a',
16
20
  });
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as applyExportsToMatchFiles from './apply-exports-to-match-files/index.js';
1
2
  import * as applyProcessorsDestructuring from './apply-processors-destructuring/index.js';
2
3
  import * as applyAsyncFormatter from './apply-async-formatter/index.js';
3
4
  import * as applyCreateTest from './apply-create-test/index.js';
@@ -132,4 +133,5 @@ export const rules = {
132
133
  'apply-lowercase-to-node-builders': applyLowercaseToNodeBuilders,
133
134
  'apply-create-nested-directory': applyCreateNestedDirectory,
134
135
  'apply-report': applyReport,
136
+ 'apply-exports-to-match-files': applyExportsToMatchFiles,
135
137
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/plugin-putout",
3
- "version": "24.0.0",
3
+ "version": "24.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,7 +51,7 @@
51
51
  "eslint": "^9.0.0",
52
52
  "eslint-plugin-n": "^17.0.0",
53
53
  "eslint-plugin-putout": "^26.0.0",
54
- "madrun": "^10.0.0",
54
+ "madrun": "^11.0.0",
55
55
  "montag": "^1.2.1",
56
56
  "nodemon": "^3.0.1",
57
57
  "supertape": "^10.0.0"