@putout/plugin-putout 24.1.0 → 24.3.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 +72 -0
- package/lib/apply-exports-to-add-args/index.js +1 -1
- package/lib/apply-exports-to-match-files/index.js +12 -0
- package/lib/apply-exports-to-rename-files/index.js +12 -0
- package/lib/declare/get-rule.cjs +5 -0
- package/lib/declare/index.js +1 -1
- package/lib/index.js +4 -0
- package/package.json +1 -1
- package/lib/declare/get-rule.js +0 -7
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ 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);
|
|
30
|
+
- ✅ [apply-exports-to-rename-files](#apply-exports-to-rename-files);
|
|
29
31
|
- ✅ [apply-for-of-to-track-file](#apply-for-of-to-track-file);
|
|
30
32
|
- ✅ [apply-fixture-name-to-message](#apply-fixture-name-to-message);
|
|
31
33
|
- ✅ [apply-insert-after](#apply-insert-after);
|
|
@@ -98,6 +100,8 @@ npm i @putout/plugin-putout -D
|
|
|
98
100
|
"putout/apply-async-formatter": "on",
|
|
99
101
|
"putout/apply-declare": "on",
|
|
100
102
|
"putout/apply-exports-to-add-args": "on",
|
|
103
|
+
"putout/apply-exports-to-match-files": "on",
|
|
104
|
+
"putout/apply-exports-to-rename-files": "on",
|
|
101
105
|
"putout/apply-report": "on",
|
|
102
106
|
"putout/apply-processors-destructuring": "on",
|
|
103
107
|
"putout/apply-rename": "on",
|
|
@@ -484,6 +488,74 @@ export {
|
|
|
484
488
|
};
|
|
485
489
|
```
|
|
486
490
|
|
|
491
|
+
## apply-exports-to-match-files
|
|
492
|
+
|
|
493
|
+
Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/d40ac85b974249c51f9874919468fd30/4194c9b21d065bd1359ffc7298aaeb1835fbbb48).
|
|
494
|
+
|
|
495
|
+
### ❌ Example of incorrect code
|
|
496
|
+
|
|
497
|
+
```js
|
|
498
|
+
export default matchFiles({
|
|
499
|
+
'*.cjs': plugin,
|
|
500
|
+
});
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### ✅ Example of correct code
|
|
504
|
+
|
|
505
|
+
```js
|
|
506
|
+
const {
|
|
507
|
+
report,
|
|
508
|
+
fix,
|
|
509
|
+
scan,
|
|
510
|
+
} = matchFiles({
|
|
511
|
+
'*.cjs': plugin,
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
export {
|
|
515
|
+
report,
|
|
516
|
+
fix,
|
|
517
|
+
scan,
|
|
518
|
+
};
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## apply-exports-to-rename-files
|
|
522
|
+
|
|
523
|
+
Check out in 🐊[**Putout Editor**](https://putout.cloudcmd.io/#/gist/999f7a582825fa88691ba87324365f3f/c679723b7ff2159d738ab7681f8c7c6460dd4326).
|
|
524
|
+
|
|
525
|
+
### ❌ Example of incorrect code
|
|
526
|
+
|
|
527
|
+
```js
|
|
528
|
+
export default renameFiles({
|
|
529
|
+
type: 'module',
|
|
530
|
+
mask: '*.mjs',
|
|
531
|
+
rename(name) {
|
|
532
|
+
return name.replace(/mjs$/, 'js');
|
|
533
|
+
},
|
|
534
|
+
});
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### ✅ Example of correct code
|
|
538
|
+
|
|
539
|
+
```js
|
|
540
|
+
const {
|
|
541
|
+
report,
|
|
542
|
+
fix,
|
|
543
|
+
scan,
|
|
544
|
+
} = renameFiles({
|
|
545
|
+
type: 'module',
|
|
546
|
+
mask: '*.mjs',
|
|
547
|
+
rename(name) {
|
|
548
|
+
return name.replace(/mjs$/, 'js');
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
export {
|
|
553
|
+
report,
|
|
554
|
+
fix,
|
|
555
|
+
scan,
|
|
556
|
+
};
|
|
557
|
+
```
|
|
558
|
+
|
|
487
559
|
## apply-async-formatter
|
|
488
560
|
|
|
489
561
|
### ❌ Example of incorrect code
|
package/lib/declare/index.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as applyExportsToRenameFiles from './apply-exports-to-rename-files/index.js';
|
|
2
|
+
import * as applyExportsToMatchFiles from './apply-exports-to-match-files/index.js';
|
|
1
3
|
import * as applyProcessorsDestructuring from './apply-processors-destructuring/index.js';
|
|
2
4
|
import * as applyAsyncFormatter from './apply-async-formatter/index.js';
|
|
3
5
|
import * as applyCreateTest from './apply-create-test/index.js';
|
|
@@ -132,4 +134,6 @@ export const rules = {
|
|
|
132
134
|
'apply-lowercase-to-node-builders': applyLowercaseToNodeBuilders,
|
|
133
135
|
'apply-create-nested-directory': applyCreateNestedDirectory,
|
|
134
136
|
'apply-report': applyReport,
|
|
137
|
+
'apply-exports-to-match-files': applyExportsToMatchFiles,
|
|
138
|
+
'apply-exports-to-rename-files': applyExportsToRenameFiles,
|
|
135
139
|
};
|
package/package.json
CHANGED