File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed
packages/plugin-putout/lib/convert-report-to-function Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 1+ export const report = ( ) => 'hello' ;
Original file line number Diff line number Diff line change 1+ export const report = 'hello' ;
Original file line number Diff line number Diff line change @@ -5,12 +5,16 @@ const {
55 isTemplateLiteral,
66} = types ;
77
8+ const check = ( { __a} ) => isStringLiteral ( __a ) || isTemplateLiteral ( __a ) ;
9+
810export const report = ( ) => `Typeof 'report' should be a 'function'` ;
911
1012export const match = ( ) => ( {
11- 'module.exports.report = __a' : ( { __a} ) => isStringLiteral ( __a ) || isTemplateLiteral ( __a ) ,
13+ 'module.exports.report = __a' : check ,
14+ 'export const report = __a' : check ,
1215} ) ;
1316
1417export const replace = ( ) => ( {
1518 'module.exports.report = __a' : 'module.exports.report = () => __a' ,
19+ 'export const report = __a' : 'export const report = () => __a' ,
1620} ) ;
Original file line number Diff line number Diff line change @@ -7,17 +7,22 @@ const test = createTest(import.meta.url, {
77 ] ,
88} ) ;
99
10- test ( 'plugin-putout: convert report to function: report: convert-report-to-function' , ( t ) => {
10+ test ( 'plugin-putout: convert- report-to- function: report: convert-report-to-function' , ( t ) => {
1111 t . report ( 'convert-report-to-function' , `Typeof 'report' should be a 'function'` ) ;
1212 t . end ( ) ;
1313} ) ;
1414
15- test ( 'plugin-putout: convert report to function: transform: convert-report-to-function' , ( t ) => {
15+ test ( 'plugin-putout: convert- report-to- function: transform: convert-report-to-function' , ( t ) => {
1616 t . transform ( 'convert-report-to-function' ) ;
1717 t . end ( ) ;
1818} ) ;
1919
20- test ( 'plugin-putout: convert report to function: transform: template' , ( t ) => {
20+ test ( 'plugin-putout: convert- report-to- function: transform: template' , ( t ) => {
2121 t . transform ( 'template' ) ;
2222 t . end ( ) ;
2323} ) ;
24+
25+ test ( 'plugin-putout: convert-report-to-function: transform: esm' , ( t ) => {
26+ t . transform ( 'esm' ) ;
27+ t . end ( ) ;
28+ } ) ;
You can’t perform that action at this time.
0 commit comments