Fix ESLint error when commiting bin/webpack-helpers.js (https://github.com/woocommerce/woocommerce-blocks/pull/1729)

This commit is contained in:
Albert Juhé Lluveras 2020-02-13 14:16:16 +01:00 committed by GitHub
parent bd8bd4f009
commit 8297530e95
3 changed files with 16 additions and 12 deletions

View File

@ -154,17 +154,19 @@ function testIsUsedInStrictBinaryExpression( node, context ) {
}
}
context.report( {
node,
loc: providedFlag.loc,
messageId: 'whiteListedFlag',
data: {
flags: flags.join( ', ' ),
},
fix( fixer ) {
return fixer.replaceText( providedFlag, "'experimental'" );
},
} );
if ( providedFlag && providedFlag.loc ) {
context.report( {
node,
loc: providedFlag.loc,
messageId: 'whiteListedFlag',
data: {
flags: flags.join( ', ' ),
},
fix( fixer ) {
return fixer.replaceText( providedFlag, "'experimental'" );
},
} );
}
}
/**

View File

@ -327,6 +327,7 @@ const getMainConfig = ( options = {} ) => {
new DefinePlugin( {
// Inject the `WOOCOMMERCE_BLOCKS_PHASE` global, used for feature flagging.
'process.env.WOOCOMMERCE_BLOCKS_PHASE': JSON.stringify(
// eslint-disable-next-line woocommerce/feature-flag
process.env.WOOCOMMERCE_BLOCKS_PHASE || 'experimental'
),
} ),
@ -428,6 +429,7 @@ const getFrontConfig = ( options = {} ) => {
new DefinePlugin( {
// Inject the `WOOCOMMERCE_BLOCKS_PHASE` global, used for feature flagging.
'process.env.WOOCOMMERCE_BLOCKS_PHASE': JSON.stringify(
// eslint-disable-next-line woocommerce/feature-flag
process.env.WOOCOMMERCE_BLOCKS_PHASE || 'experimental'
),
} ),

View File

@ -38,7 +38,7 @@
"lint:php": "composer run-script phpcs ./src",
"lint:css": "stylelint 'assets/**/*.scss'",
"lint:css-fix": "stylelint 'assets/**/*.scss' --fix",
"lint:js": "eslint assets/js --ext=js,jsx",
"lint:js": "eslint assets/js bin --ext=js,jsx",
"lint:js-fix": "eslint assets/js --ext=js,jsx --fix",
"package-plugin": "./bin/build-plugin-zip.sh",
"reformat-files": "prettier --ignore-path .eslintignore --write \"**/*.{js,jsx,json,ts,tsx}\"",