Switch lint:js command to use wp-scripts and address errors. (https://github.com/woocommerce/woocommerce-blocks/pull/1837)

* switch js lint command to use wp-scripts.

* fix lint warning for improper jsdoc syntax

* fix linting errors
This commit is contained in:
Darren Ethier 2020-02-28 16:54:07 -05:00 committed by GitHub
parent 6b110d00f2
commit 12a28556db
4 changed files with 15 additions and 9 deletions

View File

@ -39,11 +39,13 @@ export const formatPriceRange = ( minPrice, maxPrice ) => {
/**
* Render a removable item in the active filters block list.
*
* @param {string} type Type string.
* @param {string} name Name string.
* @param {string} prefix Prefix shown before item name.
* @param {Function} removeCallback Callback to remove item.
* @param {boolean} [showLabel=true] Should the label be shown for this item?
* @param {Object} listItem The removable item to render.
* @param {string} listItem.type Type string.
* @param {string} listItem.name Name string.
* @param {string} listItem.prefix Prefix shown before item name.
* @param {Function} listItem.removeCallback Callback to remove item.
* @param {boolean} [listItem.showLabel=true] Should the label be shown for
* this item?
*/
export const renderRemovableListItem = ( {
type,

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 bin --ext=js,jsx",
"lint:js": "wp-scripts lint-js",
"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}\"",

View File

@ -21,7 +21,7 @@ if ( program.dev ) {
const envVars = Object.assign( {}, process.env, testEnvVars );
let jestProcess = spawnSync(
const jestProcess = spawnSync(
'jest',
[
'--maxWorkers=1',
@ -36,6 +36,7 @@ let jestProcess = spawnSync(
}
);
// eslint-disable-next-line no-console
console.log( 'Jest exit code: ' + jestProcess.status );
// Pass Jest exit code to npm

View File

@ -88,6 +88,7 @@ const CoreConfig = {
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'
),
} ),
@ -96,8 +97,10 @@ const CoreConfig = {
// file name
fileName: 'blocks.ini',
// content of the file
content: `woocommerce_blocks_phase = ${ process.env
.WOOCOMMERCE_BLOCKS_PHASE || 'experimental' }`,
content: `woocommerce_blocks_phase = ${
// eslint-disable-next-line woocommerce/feature-flag
process.env.WOOCOMMERCE_BLOCKS_PHASE || 'experimental'
}`,
} ),
],
};