Skip to content

Commit

Permalink
Resolve ESLint issues with twig-to-php-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanPak committed Jun 18, 2024
1 parent 51ca619 commit 67be3f9
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions packages/twig-to-php-parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function twigToPhpParser( thisConfig = {} ) {
execPhp(
path.resolve( __dirname, './lib/twig-to-php-parser.php' ),
thisConfig.phpBinaryPath,
function ( error, php, output ) {
function ( error, php ) {
if ( error ) {
reject( error );
}
Expand All @@ -57,9 +57,9 @@ function twigToPhpParser( thisConfig = {} ) {
twigDir,
phpDir,
isUsingPlugin,
function ( error, result, output, printed ) {
if ( error ) {
reject( error );
function ( thisError, result ) {
if ( thisError ) {
reject( thisError );
}

resolve( result );
Expand All @@ -80,7 +80,7 @@ function parseIncludePath(
execPhp(
path.resolve( __dirname, './lib/twig-to-php-parser.php' ),
config.phpBinaryPath,
function ( error, php, output ) {
function ( error, php ) {
if ( error ) {
reject( error );
}
Expand All @@ -90,9 +90,9 @@ function parseIncludePath(
patternName,
dataName,
isUsingPlugin,
function ( error, result, output, printed ) {
if ( error ) {
reject( error );
function ( thisError, result ) {
if ( thisError ) {
reject( thisError );
}

resolve( result );
Expand All @@ -108,7 +108,7 @@ function parseSvgPath( twigSvgIncludeStr, svgName, isUsingPlugin = false ) {
execPhp(
path.resolve( __dirname, './lib/twig-to-php-parser.php' ),
config.phpBinaryPath,
function ( error, php, output ) {
function ( error, php ) {
if ( error ) {
reject( error );
}
Expand All @@ -117,9 +117,9 @@ function parseSvgPath( twigSvgIncludeStr, svgName, isUsingPlugin = false ) {
twigSvgIncludeStr,
svgName,
isUsingPlugin,
function ( error, result, output, printed ) {
if ( error ) {
reject( error );
function ( thisError, result ) {
if ( thisError ) {
reject( thisError );
}

resolve( result );
Expand All @@ -135,16 +135,16 @@ function parseWpAction( twigMarkup ) {
execPhp(
path.resolve( __dirname, './lib/twig-to-php-parser.php' ),
config.phpBinaryPath,
function ( error, php, output ) {
function ( error, php ) {
if ( error ) {
reject( error );
}

php.parse_wp_action(
twigMarkup,
function ( error, result, output, printed ) {
if ( error ) {
reject( error );
function ( thisError, result ) {
if ( thisError ) {
reject( thisError );
}

resolve( result );
Expand All @@ -164,12 +164,15 @@ module.exports = {
},
run: () => {
twigToPhpParser( config )
// eslint-disable-next-line no-console
.catch( ( e ) => console.log( e ) ) // PHP errors
.then( ( result ) =>
.then( () =>
// eslint-disable-next-line no-console
console.log(
chalk.green( 'Completed parsing Twig templates to PHP.' )
)
)
// eslint-disable-next-line no-console
.catch( ( e ) => console.log( e ) );
},
};

0 comments on commit 67be3f9

Please sign in to comment.