Fix linter issues and update Syncpack (#38523)

This commit is contained in:
Sam Seay 2023-05-31 11:45:10 +12:00 committed by GitHub
parent 4e530ba2e2
commit b076a7b521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 256 additions and 333 deletions

View File

@ -75,11 +75,9 @@
}, },
{ {
"dependencies": [ "dependencies": [
"@wordpress/eslint-plugin",
"@wordpress/babel-plugin-import-jsx-pragma", "@wordpress/babel-plugin-import-jsx-pragma",
"@wordpress/babel-preset-default", "@wordpress/babel-preset-default",
"@wordpress/stylelint-config", "@wordpress/stylelint-config",
"@wordpress/prettier-config",
"@wordpress/scripts", "@wordpress/scripts",
"@wordpress/jest-console", "@wordpress/jest-console",
"@wordpress/dependency-extraction-webpack-plugin", "@wordpress/dependency-extraction-webpack-plugin",
@ -115,6 +113,24 @@
], ],
"isIgnored": true "isIgnored": true
}, },
{
"dependencies": [
"@wordpress/prettier-config"
],
"packages": [
"**"
],
"pinVersion": "2.17.0"
},
{
"dependencies": [
"@wordpress/eslint-plugin"
],
"packages": [
"**"
],
"pinVersion": "14.7.0"
},
{ {
"dependencies": [ "dependencies": [
"@wordpress/env" "@wordpress/env"

View File

@ -38,8 +38,8 @@
"@types/node": "^16.18.18", "@types/node": "^16.18.18",
"@woocommerce/eslint-plugin": "workspace:*", "@woocommerce/eslint-plugin": "workspace:*",
"@wordpress/data": "wp-6.0", "@wordpress/data": "wp-6.0",
"@wordpress/eslint-plugin": "^11.1.0", "@wordpress/eslint-plugin": "14.7.0",
"@wordpress/prettier-config": "^1.4.0", "@wordpress/prettier-config": "2.17.0",
"babel-loader": "^8.3.0", "babel-loader": "^8.3.0",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"copy-webpack-plugin": "^10.2.4", "copy-webpack-plugin": "^10.2.4",
@ -53,12 +53,12 @@
"moment": "^2.29.4", "moment": "^2.29.4",
"node-stream-zip": "^1.15.0", "node-stream-zip": "^1.15.0",
"postcss-loader": "^4.3.0", "postcss-loader": "^4.3.0",
"prettier": "npm:wp-prettier@^2.6.2", "prettier": "npm:wp-prettier@^2.8.5",
"regenerator-runtime": "^0.13.11", "regenerator-runtime": "^0.13.11",
"request": "^2.88.2", "request": "^2.88.2",
"sass": "^1.59.3", "sass": "^1.59.3",
"sass-loader": "^10.4.1", "sass-loader": "^10.4.1",
"syncpack": "^9.8.4", "syncpack": "^10.1.0",
"turbo": "^1.9.3", "turbo": "^1.9.3",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"url-loader": "^1.1.2", "url-loader": "^1.1.2",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Lint fixes

View File

@ -280,7 +280,7 @@ function SelectControl< ItemType = DefaultItemType >( {
) } ) }
> >
{ /* Downshift's getLabelProps handles the necessary label attributes. */ } { /* Downshift's getLabelProps handles the necessary label attributes. */ }
{ /* eslint-disable jsx-a11y/label-has-for */ } { /* eslint-disable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ }
{ label && ( { label && (
<label <label
{ ...getLabelProps() } { ...getLabelProps() }
@ -289,7 +289,7 @@ function SelectControl< ItemType = DefaultItemType >( {
{ label } { label }
</label> </label>
) } ) }
{ /* eslint-enable jsx-a11y/label-has-for */ } { /* eslint-enable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ }
<ComboBox <ComboBox
comboBoxProps={ getComboboxProps() } comboBoxProps={ getComboboxProps() }
getToggleButtonProps={ getToggleButtonProps } getToggleButtonProps={ getToggleButtonProps }

View File

@ -48,7 +48,7 @@ export const TreeItem = forwardRef( function ForwardedTreeItem(
{ ...headingProps } { ...headingProps }
className="experimental-woocommerce-tree-item__heading" className="experimental-woocommerce-tree-item__heading"
> >
{ /* eslint-disable-next-line jsx-a11y/label-has-for */ } { /* eslint-disable-next-line jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ }
<label className="experimental-woocommerce-tree-item__label"> <label className="experimental-woocommerce-tree-item__label">
{ selection.multiple ? ( { selection.multiple ? (
<CheckboxControl <CheckboxControl

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Lint fixes

View File

@ -128,7 +128,7 @@ export const productReadOnlyProperties = [
'variations', 'variations',
] as const; ] as const;
export type ReadOnlyProperties = typeof productReadOnlyProperties[ number ]; export type ReadOnlyProperties = ( typeof productReadOnlyProperties )[ number ];
export type PartialProduct = Partial< Product > & Pick< Product, 'id' >; export type PartialProduct = Partial< Product > & Pick< Product, 'id' >;

View File

@ -0,0 +1,4 @@
Significance: minor
Type: add
Warn for jsdoc errors, use wp-prettier

View File

@ -16,6 +16,8 @@ module.exports = {
radix: 'error', radix: 'error',
yoda: [ 'error', 'never' ], yoda: [ 'error', 'never' ],
// temporary conversion to warnings until the below are all handled. // temporary conversion to warnings until the below are all handled.
'jsdoc/check-line-alignment': 'warn',
'jsdoc/require-returns-check': 'warn',
'@wordpress/i18n-translator-comments': 'warn', '@wordpress/i18n-translator-comments': 'warn',
'@wordpress/i18n-text-domain': [ '@wordpress/i18n-text-domain': [
'error', 'error',

View File

@ -32,9 +32,10 @@
"dependencies": { "dependencies": {
"@typescript-eslint/parser": "^5.54.0", "@typescript-eslint/parser": "^5.54.0",
"@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/eslint-plugin": "^5.54.0",
"@wordpress/eslint-plugin": "^14.0.0", "@wordpress/eslint-plugin": "14.7.0",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^5.10.2" "eslint-plugin-testing-library": "^5.10.2",
"prettier": "npm:wp-prettier@^2.8.5"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Lint fixes

View File

@ -27,7 +27,7 @@ type BlockRepresentation = {
* *
* @param {Object} block The block to be registered. * @param {Object} block The block to be registered.
* *
* @return {?WPBlockType} The block, if it has been successfully registered; * @return {WPBlockType|void} The block, if it has been successfully registered;
* otherwise `undefined`. * otherwise `undefined`.
*/ */
export default function initBlock( block: BlockRepresentation ) { export default function initBlock( block: BlockRepresentation ) {

View File

@ -1,5 +1,8 @@
module.exports = { module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended', 'plugin:xstate/all' ], extends: [
'plugin:@woocommerce/eslint-plugin/recommended',
'plugin:xstate/all',
],
plugins: [ 'xstate' ], plugins: [ 'xstate' ],
root: true, root: true,
overrides: [ overrides: [

View File

@ -26,7 +26,7 @@ export const POSSIBLY_DEFAULT_STORE_NAMES = [
'Site Title', 'Site Title',
'', '',
]; ];
export type IndustryChoice = typeof industryChoices[ number ][ 'key' ]; export type IndustryChoice = ( typeof industryChoices )[ number ][ 'key' ];
export const industryChoices = [ export const industryChoices = [
{ {
label: __( 'Clothing and accessories', 'woocommerce' ), label: __( 'Clothing and accessories', 'woocommerce' ),
@ -58,7 +58,7 @@ export const industryChoices = [
}, },
]; ];
export type IndustryChoiceOption = typeof industryChoices[ number ]; export type IndustryChoiceOption = ( typeof industryChoices )[ number ];
export const selectIndustryMapping = { export const selectIndustryMapping = {
im_just_starting_my_business: __( im_just_starting_my_business: __(
@ -221,7 +221,9 @@ export const BusinessInfo = ( {
excludeSelectedOptions={ false } excludeSelectedOptions={ false }
help={ <Icon icon={ chevronDown } /> } help={ <Icon icon={ chevronDown } /> }
onChange={ ( onChange={ (
results: Array< typeof industryChoices[ number ] > results: Array<
( typeof industryChoices )[ number ]
>
) => { ) => {
if ( results.length ) { if ( results.length ) {
setIndustry( results[ 0 ] ); setIndustry( results[ 0 ] );

View File

@ -113,9 +113,10 @@ const platformOptions = [
}, },
]; ];
export type BusinessChoice = typeof businessOptions[ 0 ][ 'value' ]; export type BusinessChoice = ( typeof businessOptions )[ 0 ][ 'value' ];
export type SellingOnlineAnswer = typeof sellingOnlineOptions[ 0 ][ 'value' ]; export type SellingOnlineAnswer =
export type SellingPlatform = typeof platformOptions[ 0 ][ 'value' ]; ( typeof sellingOnlineOptions )[ 0 ][ 'value' ];
export type SellingPlatform = ( typeof platformOptions )[ 0 ][ 'value' ];
export const UserProfile = ( { export const UserProfile = ( {
sendEvent, sendEvent,

View File

@ -39,7 +39,7 @@ export function getStoreAddressValidator(/* locale: Locale = {} */) {
* @return {Object} Key value of fields and error messages, { myField: 'This field is required' } * @return {Object} Key value of fields and error messages, { myField: 'This field is required' }
*/ */
return ( return (
values: Record< typeof storeAddressFields[ number ], string > values: Record< ( typeof storeAddressFields )[ number ], string >
) => { ) => {
const errors: { const errors: {
[ key: string ]: string; [ key: string ]: string;

View File

@ -26,7 +26,7 @@ export const JetpackPluginStates = {
} as const; } as const;
export type JetpackPluginStates = export type JetpackPluginStates =
typeof JetpackPluginStates[ keyof typeof JetpackPluginStates ]; ( typeof JetpackPluginStates )[ keyof typeof JetpackPluginStates ];
/** /**
* Utility hook to determine and manipulate the state of the Jetpack plugin on the WordPress installation * Utility hook to determine and manipulate the state of the Jetpack plugin on the WordPress installation

View File

@ -15,7 +15,7 @@ export const SendMagicLinkStates = {
ERROR: 'error', ERROR: 'error',
} as const; } as const;
export type SendMagicLinkStates = export type SendMagicLinkStates =
typeof SendMagicLinkStates[ keyof typeof SendMagicLinkStates ]; ( typeof SendMagicLinkStates )[ keyof typeof SendMagicLinkStates ];
export type MagicLinkResponse = { export type MagicLinkResponse = {
data: unknown; data: unknown;

View File

@ -85,7 +85,7 @@ export const LoadSampleProductType = {
}; };
export type ProductType = export type ProductType =
| typeof productTypes[ number ] | ( typeof productTypes )[ number ]
| typeof LoadSampleProductType; | typeof LoadSampleProductType;
export type ProductTypeKey = ProductType[ 'key' ]; export type ProductTypeKey = ProductType[ 'key' ];

View File

@ -167,7 +167,7 @@
"@wordpress/jest-preset-default": "^8.0.1", "@wordpress/jest-preset-default": "^8.0.1",
"@wordpress/postcss-plugins-preset": "^1.6.0", "@wordpress/postcss-plugins-preset": "^1.6.0",
"@wordpress/postcss-themes": "^1.0.5", "@wordpress/postcss-themes": "^1.0.5",
"@wordpress/prettier-config": "^1.1.2", "@wordpress/prettier-config": "2.17.0",
"@wordpress/scripts": "^12.6.1", "@wordpress/scripts": "^12.6.1",
"@wordpress/stylelint-config": "^20.0.2", "@wordpress/stylelint-config": "^20.0.2",
"@xstate/inspect": "0.8.0", "@xstate/inspect": "0.8.0",
@ -206,7 +206,7 @@
"postcss": "^8.4.7", "postcss": "^8.4.7",
"postcss-color-function": "^4.1.0", "postcss-color-function": "^4.1.0",
"postcss-loader": "^4.3.0", "postcss-loader": "^4.3.0",
"prettier": "npm:wp-prettier@^2.2.1-beta-1", "prettier": "npm:wp-prettier@^2.8.5",
"promptly": "^3.2.0", "promptly": "^3.2.0",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"puppeteer": "^2.0.0", "puppeteer": "^2.0.0",

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Consolidate wp-prettier version with rest of monorepo.

View File

@ -16,10 +16,10 @@
"@woocommerce/dependency-extraction-webpack-plugin": "workspace:*", "@woocommerce/dependency-extraction-webpack-plugin": "workspace:*",
"@woocommerce/eslint-plugin": "workspace:*", "@woocommerce/eslint-plugin": "workspace:*",
"@wordpress/env": "^8.0.0", "@wordpress/env": "^8.0.0",
"@wordpress/prettier-config": "^2.5.0", "@wordpress/prettier-config": "2.17.0",
"@wordpress/scripts": "^19.2.4", "@wordpress/scripts": "^19.2.4",
"eslint": "^8.32.0", "eslint": "^8.32.0",
"prettier": "npm:wp-prettier@^2.6.2", "prettier": "npm:wp-prettier@^2.8.5",
"ts-loader": "^9.4.1", "ts-loader": "^9.4.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"uglify-js": "^3.5.3" "uglify-js": "^3.5.3"

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Lint fixes

View File

@ -87,7 +87,7 @@
"istanbul": "1.0.0-alpha.2", "istanbul": "1.0.0-alpha.2",
"jest": "^27.5.1", "jest": "^27.5.1",
"mocha": "7.2.0", "mocha": "7.2.0",
"prettier": "npm:wp-prettier@2.0.5", "prettier": "npm:wp-prettier@^2.8.5",
"stylelint": "^13.8.0", "stylelint": "^13.8.0",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"uuid": "^8.3.2", "uuid": "^8.3.2",

File diff suppressed because it is too large Load Diff