@putout/plugin-putout 24.2.0 → 24.3.1
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 +40 -0
- package/lib/apply-exports-to-add-args/index.js +1 -1
- package/lib/apply-exports-to-match-files/index.js +1 -1
- 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 +2 -0
- package/package.json +1 -1
- package/lib/declare/get-rule.js +0 -7
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ npm i @putout/plugin-putout -D
|
|
|
27
27
|
- ✅ [apply-declare](#apply-declare);
|
|
28
28
|
- ✅ [apply-exports-to-add-args](#apply-exports-to-add-args);
|
|
29
29
|
- ✅ [apply-exports-to-match-files](#apply-exports-to-match-files);
|
|
30
|
+
- ✅ [apply-exports-to-rename-files](#apply-exports-to-rename-files);
|
|
30
31
|
- ✅ [apply-for-of-to-track-file](#apply-for-of-to-track-file);
|
|
31
32
|
- ✅ [apply-fixture-name-to-message](#apply-fixture-name-to-message);
|
|
32
33
|
- ✅ [apply-insert-after](#apply-insert-after);
|
|
@@ -100,6 +101,7 @@ npm i @putout/plugin-putout -D
|
|
|
100
101
|
"putout/apply-declare": "on",
|
|
101
102
|
"putout/apply-exports-to-add-args": "on",
|
|
102
103
|
"putout/apply-exports-to-match-files": "on",
|
|
104
|
+
"putout/apply-exports-to-rename-files": "on",
|
|
103
105
|
"putout/apply-report": "on",
|
|
104
106
|
"putout/apply-processors-destructuring": "on",
|
|
105
107
|
"putout/apply-rename": "on",
|
|
@@ -516,6 +518,44 @@ export {
|
|
|
516
518
|
};
|
|
517
519
|
```
|
|
518
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
|
+
|
|
519
559
|
## apply-async-formatter
|
|
520
560
|
|
|
521
561
|
### ❌ Example of incorrect code
|
package/lib/declare/index.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as applyExportsToRenameFiles from './apply-exports-to-rename-files/index.js';
|
|
1
2
|
import * as applyExportsToMatchFiles from './apply-exports-to-match-files/index.js';
|
|
2
3
|
import * as applyProcessorsDestructuring from './apply-processors-destructuring/index.js';
|
|
3
4
|
import * as applyAsyncFormatter from './apply-async-formatter/index.js';
|
|
@@ -134,4 +135,5 @@ export const rules = {
|
|
|
134
135
|
'apply-create-nested-directory': applyCreateNestedDirectory,
|
|
135
136
|
'apply-report': applyReport,
|
|
136
137
|
'apply-exports-to-match-files': applyExportsToMatchFiles,
|
|
138
|
+
'apply-exports-to-rename-files': applyExportsToRenameFiles,
|
|
137
139
|
};
|
package/package.json
CHANGED