Skip to content

Commit

Permalink
Fix linter issues and update Syncpack (woocommerce#38523)
Browse files Browse the repository at this point in the history
  • Loading branch information
samueljseay authored May 30, 2023
1 parent 4e530ba commit b076a7b
Show file tree
Hide file tree
Showing 25 changed files with 256 additions and 333 deletions.
20 changes: 18 additions & 2 deletions .syncpackrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,9 @@
},
{
"dependencies": [
"@wordpress/eslint-plugin",
"@wordpress/babel-plugin-import-jsx-pragma",
"@wordpress/babel-preset-default",
"@wordpress/stylelint-config",
"@wordpress/prettier-config",
"@wordpress/scripts",
"@wordpress/jest-console",
"@wordpress/dependency-extraction-webpack-plugin",
Expand Down Expand Up @@ -115,6 +113,24 @@
],
"isIgnored": true
},
{
"dependencies": [
"@wordpress/prettier-config"
],
"packages": [
"**"
],
"pinVersion": "2.17.0"
},
{
"dependencies": [
"@wordpress/eslint-plugin"
],
"packages": [
"**"
],
"pinVersion": "14.7.0"
},
{
"dependencies": [
"@wordpress/env"
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
"@types/node": "^16.18.18",
"@woocommerce/eslint-plugin": "workspace:*",
"@wordpress/data": "wp-6.0",
"@wordpress/eslint-plugin": "^11.1.0",
"@wordpress/prettier-config": "^1.4.0",
"@wordpress/eslint-plugin": "14.7.0",
"@wordpress/prettier-config": "2.17.0",
"babel-loader": "^8.3.0",
"chalk": "^4.1.2",
"copy-webpack-plugin": "^10.2.4",
Expand All @@ -53,12 +53,12 @@
"moment": "^2.29.4",
"node-stream-zip": "^1.15.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",
"request": "^2.88.2",
"sass": "^1.59.3",
"sass-loader": "^10.4.1",
"syncpack": "^9.8.4",
"syncpack": "^10.1.0",
"turbo": "^1.9.3",
"typescript": "^4.9.5",
"url-loader": "^1.1.2",
Expand Down
4 changes: 4 additions & 0 deletions packages/js/components/changelog/dev-linter-fixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Lint fixes
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function SelectControl< ItemType = DefaultItemType >( {
) }
>
{ /* 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
{ ...getLabelProps() }
Expand All @@ -289,7 +289,7 @@ function SelectControl< ItemType = DefaultItemType >( {
{ label }
</label>
) }
{ /* eslint-enable jsx-a11y/label-has-for */ }
{ /* eslint-enable jsx-a11y/label-has-for, jsx-a11y/label-has-associated-control */ }
<ComboBox
comboBoxProps={ getComboboxProps() }
getToggleButtonProps={ getToggleButtonProps }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const TreeItem = forwardRef( function ForwardedTreeItem(
{ ...headingProps }
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">
{ selection.multiple ? (
<CheckboxControl
Expand Down
4 changes: 4 additions & 0 deletions packages/js/data/changelog/dev-linter-fixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Lint fixes
2 changes: 1 addition & 1 deletion packages/js/data/src/products/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const productReadOnlyProperties = [
'variations',
] as const;

export type ReadOnlyProperties = typeof productReadOnlyProperties[ number ];
export type ReadOnlyProperties = ( typeof productReadOnlyProperties )[ number ];

export type PartialProduct = Partial< Product > & Pick< Product, 'id' >;

Expand Down
4 changes: 4 additions & 0 deletions packages/js/eslint-plugin/changelog/dev-linter-fixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Warn for jsdoc errors, use wp-prettier
2 changes: 2 additions & 0 deletions packages/js/eslint-plugin/configs/recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
radix: 'error',
yoda: [ 'error', 'never' ],
// 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-text-domain': [
'error',
Expand Down
5 changes: 3 additions & 2 deletions packages/js/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
"dependencies": {
"@typescript-eslint/parser": "^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-testing-library": "^5.10.2"
"eslint-plugin-testing-library": "^5.10.2",
"prettier": "npm:wp-prettier@^2.8.5"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 4 additions & 0 deletions packages/js/product-editor/changelog/dev-linter-fixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Lint fixes
2 changes: 1 addition & 1 deletion packages/js/product-editor/src/utils/init-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type BlockRepresentation = {
*
* @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`.
*/
export default function initBlock( block: BlockRepresentation ) {
Expand Down
5 changes: 4 additions & 1 deletion plugins/woocommerce-admin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
module.exports = {
extends: [ 'plugin:@woocommerce/eslint-plugin/recommended', 'plugin:xstate/all' ],
extends: [
'plugin:@woocommerce/eslint-plugin/recommended',
'plugin:xstate/all',
],
plugins: [ 'xstate' ],
root: true,
overrides: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const POSSIBLY_DEFAULT_STORE_NAMES = [
'Site Title',
'',
];
export type IndustryChoice = typeof industryChoices[ number ][ 'key' ];
export type IndustryChoice = ( typeof industryChoices )[ number ][ 'key' ];
export const industryChoices = [
{
label: __( 'Clothing and accessories', 'woocommerce' ),
Expand Down Expand Up @@ -58,7 +58,7 @@ export const industryChoices = [
},
];

export type IndustryChoiceOption = typeof industryChoices[ number ];
export type IndustryChoiceOption = ( typeof industryChoices )[ number ];

export const selectIndustryMapping = {
im_just_starting_my_business: __(
Expand Down Expand Up @@ -221,7 +221,9 @@ export const BusinessInfo = ( {
excludeSelectedOptions={ false }
help={ <Icon icon={ chevronDown } /> }
onChange={ (
results: Array< typeof industryChoices[ number ] >
results: Array<
( typeof industryChoices )[ number ]
>
) => {
if ( results.length ) {
setIndustry( results[ 0 ] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ const platformOptions = [
},
];

export type BusinessChoice = typeof businessOptions[ 0 ][ 'value' ];
export type SellingOnlineAnswer = typeof sellingOnlineOptions[ 0 ][ 'value' ];
export type SellingPlatform = typeof platformOptions[ 0 ][ 'value' ];
export type BusinessChoice = ( typeof businessOptions )[ 0 ][ 'value' ];
export type SellingOnlineAnswer =
( typeof sellingOnlineOptions )[ 0 ][ 'value' ];
export type SellingPlatform = ( typeof platformOptions )[ 0 ][ 'value' ];

export const UserProfile = ( {
sendEvent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function getStoreAddressValidator(/* locale: Locale = {} */) {
* @return {Object} Key value of fields and error messages, { myField: 'This field is required' }
*/
return (
values: Record< typeof storeAddressFields[ number ], string >
values: Record< ( typeof storeAddressFields )[ number ], string >
) => {
const errors: {
[ key: string ]: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const JetpackPluginStates = {
} as const;

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const SendMagicLinkStates = {
ERROR: 'error',
} as const;
export type SendMagicLinkStates =
typeof SendMagicLinkStates[ keyof typeof SendMagicLinkStates ];
( typeof SendMagicLinkStates )[ keyof typeof SendMagicLinkStates ];

export type MagicLinkResponse = {
data: unknown;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const LoadSampleProductType = {
};

export type ProductType =
| typeof productTypes[ number ]
| ( typeof productTypes )[ number ]
| typeof LoadSampleProductType;
export type ProductTypeKey = ProductType[ 'key' ];

Expand Down
4 changes: 2 additions & 2 deletions plugins/woocommerce-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"@wordpress/jest-preset-default": "^8.0.1",
"@wordpress/postcss-plugins-preset": "^1.6.0",
"@wordpress/postcss-themes": "^1.0.5",
"@wordpress/prettier-config": "^1.1.2",
"@wordpress/prettier-config": "2.17.0",
"@wordpress/scripts": "^12.6.1",
"@wordpress/stylelint-config": "^20.0.2",
"@xstate/inspect": "0.8.0",
Expand Down Expand Up @@ -206,7 +206,7 @@
"postcss": "^8.4.7",
"postcss-color-function": "^4.1.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",
"prop-types": "^15.8.1",
"puppeteer": "^2.0.0",
Expand Down
4 changes: 4 additions & 0 deletions plugins/woocommerce-beta-tester/changelog/dev-linter-fixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Consolidate wp-prettier version with rest of monorepo.
4 changes: 2 additions & 2 deletions plugins/woocommerce-beta-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"@woocommerce/dependency-extraction-webpack-plugin": "workspace:*",
"@woocommerce/eslint-plugin": "workspace:*",
"@wordpress/env": "^8.0.0",
"@wordpress/prettier-config": "^2.5.0",
"@wordpress/prettier-config": "2.17.0",
"@wordpress/scripts": "^19.2.4",
"eslint": "^8.32.0",
"prettier": "npm:wp-prettier@^2.6.2",
"prettier": "npm:wp-prettier@^2.8.5",
"ts-loader": "^9.4.1",
"typescript": "^4.9.5",
"uglify-js": "^3.5.3"
Expand Down
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/dev-linter-fixes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Lint fixes
2 changes: 1 addition & 1 deletion plugins/woocommerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"istanbul": "1.0.0-alpha.2",
"jest": "^27.5.1",
"mocha": "7.2.0",
"prettier": "npm:wp-prettier@2.0.5",
"prettier": "npm:wp-prettier@^2.8.5",
"stylelint": "^13.8.0",
"typescript": "^4.9.5",
"uuid": "^8.3.2",
Expand Down
Loading

0 comments on commit b076a7b

Please sign in to comment.