Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Update linting, testing, @types/* dependencies #8475

Merged
merged 23 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8d4850d
Update husky from 4 to 7
chihsuan Mar 16, 2022
52955bd
Update @types/jest from 26 to 27
chihsuan Mar 16, 2022
0cee77c
Update lint-staged from 10 to 12
chihsuan Mar 16, 2022
24545aa
Update babel-jest from 26 to 27
chihsuan Mar 16, 2022
3fda387
Update @typescript-eslint/eslint-plugin from 4 to 5
chihsuan Mar 16, 2022
e588a48
Update @typescript-eslint/parser from 4 to 5
chihsuan Mar 16, 2022
5fe896a
Update chalk from 4 to 5
chihsuan Mar 16, 2022
04825fe
Update concurrently from 5 to 7
chihsuan Mar 16, 2022
d906fa3
Update stylelint from 9 to 14 and stylelint-config-wordpress from 13 …
chihsuan Mar 16, 2022
08f55ff
Update @wordpress/prettier-config from 0.4 to 1.1
chihsuan Mar 16, 2022
c2e5350
Update eslint from 7 to 8, @wordpress/eslint-plugin from 8 to 10, esl…
chihsuan Mar 16, 2022
bcb85ff
Fix lint errors after updating eslint-plugin-testing-library
chihsuan Mar 16, 2022
4a1e162
Fix style lint
chihsuan Mar 16, 2022
9fbfb64
Rename .stylelintrc.json -> stylelint.config.js & add todo comment
chihsuan Mar 16, 2022
5bbe51f
Remove @wordpress/e2e-test-utils
chihsuan Mar 17, 2022
5d030bf
Add changelogs for eslint-plugin
chihsuan Mar 17, 2022
0d865f5
Update storybook/preview.js since addDecorator has been deprecated
chihsuan Mar 17, 2022
2ecaaa8
Import directly from @storybook/addon-docs
chihsuan Mar 17, 2022
4182240
Migrate some stories to use @storybook/addon-controls
chihsuan Mar 17, 2022
7d67afa
Update changelogs
chihsuan Mar 17, 2022
c7b07c8
Update preview.js to fix lint warning
chihsuan Mar 18, 2022
18a31a4
Update pnpm-lock.yaml
chihsuan Mar 18, 2022
d722038
Fix eslint layout errors (#8484)
chihsuan Mar 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm exec lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

node bin/pre-push-hook.js
21 changes: 0 additions & 21 deletions .stylelintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions client/activity-panel/panels/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,9 @@ function getListItems( props ) {
* Filter an array of help items for the setup task.
*
* @filter woocommerce_admin_setup_task_help_items
* @param {Array.<Object>} items Array items object based on task.
* @param {('products'|'appearance'|'shipping'|'tax'|'payments'|'marketing')} task url query parameters.
* @param {Object} props React component props.
* @param {Array.<Object>} items Array items object based on task.
* @param {('products'|'appearance'|'shipping'|'tax'|'payments'|'marketing')} task url query parameters.
* @param {Object} props React component props.
*/
const filteredItems = applyFilters(
SETUP_TASK_HELP_ITEMS_FILTER,
Expand Down
2 changes: 1 addition & 1 deletion client/analytics/components/report-error/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EmptyContent } from '@woocommerce/components';
* Component to render when there is an error in a report component due to data
* not being loaded or being invalid.
*
* @param {Object} props React props.
* @param {Object} props React props.
* @param {string} [props.className] Additional class name to style the component.
*/
function ReportError( { className } ) {
Expand Down
12 changes: 6 additions & 6 deletions client/analytics/components/report-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ const ReportTable = ( props ) => {
* Enables manipulation of data used to create the report CSV.
*
* @filter woocommerce_admin_report_table
* @param {Object} reportTableData - data used to create the table.
* @param {Object} reportTableData - data used to create the table.
* @param {string} reportTableData.endpoint - table api endpoint.
* @param {Array} reportTableData.headers - table headers data.
* @param {Array} reportTableData.rows - table rows data.
* @param {Object} reportTableData.totals - total aggregates for request.
* @param {Array} reportTableData.summary - summary numbers data.
* @param {Object} reportTableData.items - response from api requerst.
* @param {Array} reportTableData.headers - table headers data.
* @param {Array} reportTableData.rows - table rows data.
* @param {Object} reportTableData.totals - total aggregates for request.
* @param {Array} reportTableData.summary - summary numbers data.
* @param {Object} reportTableData.items - response from api requerst.
*/
return applyFilters( TABLE_FILTER, {
endpoint,
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/categories/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const charts = applyFilters( CATEGORY_REPORT_CHARTS_FILTER, [
* Category Report Advanced Filters.
*
* @filter woocommerce_admin_category_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/coupons/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export const charts = applyFilters( COUPON_REPORT_CHARTS_FILTER, [
* Coupons Report Advanced Filters.
*
* @filter woocommerce_admin_coupon_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/customers/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export const filters = applyFilters( CUSTOMERS_REPORT_FILTERS_FILTER, [
* Customers Report Advanced Filters.
*
* @filter woocommerce_admin_customers_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/downloads/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export const filters = applyFilters( DOWLOADS_REPORT_FILTERS_FILTER, [
* Downloads Report Advanced Filters.
*
* @filter woocommerce_admin_downloads_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
8 changes: 4 additions & 4 deletions client/analytics/report/get-reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ export default () => {
* An object defining a report page.
*
* @typedef {Object} report
* @property {string} report Report slug.
* @property {string} title Report title.
* @property {Node} component React Component to render.
* @property {Object} navArgs Arguments supplied to WooCommerce Navigation.
* @property {string} report Report slug.
* @property {string} title Report title.
* @property {Node} component React Component to render.
* @property {Object} navArgs Arguments supplied to WooCommerce Navigation.
*/

/**
Expand Down
18 changes: 9 additions & 9 deletions client/analytics/report/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ import getReports from './get-reports';
* An object defining a chart.
*
* @typedef {Object} chart
* @property {string} key Chart slug.
* @property {string} label Chart label.
* @property {string} order Default way to order the `orderby` property.
* @property {string} orderby Column by which to order.
* @property {('number'|'currency')} type Specify the type of number.
* @property {string} key Chart slug.
* @property {string} label Chart label.
* @property {string} order Default way to order the `orderby` property.
* @property {string} orderby Column by which to order.
* @property {('number'|'currency')} type Specify the type of number.
*/

/**
* An object defining a set of report filters.
*
* @typedef {Object} filter
* @property {string} label Label describing the set of filters.
* @property {string} param Url query param this set of filters operates on.
* @property {string} label Label describing the set of filters.
* @property {string} param Url query param this set of filters operates on.
* @property {Array.<string>} staticParams Array of `param` that remain constant when other params are manipulated.
* @property {Function} showFilters A function with url query as an argument returning a Boolean depending on whether or not the filters should be shown.
* @property {Array} filters An array of filter objects.
* @property {Function} showFilters A function with url query as an argument returning a Boolean depending on whether or not the filters should be shown.
* @property {Array} filters An array of filter objects.
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/orders/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export const filters = applyFilters( ORDERS_REPORT_FILTERS_FILTER, [
* Orders Report Advanced Filters.
*
* @filter woocommerce_admin_orders_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/products/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ const variationsConfig = {
* Produts Report Advanced Filters.
*
* @filter woocommerce_admin_products_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/revenue/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export const charts = applyFilters( REVENUE_REPORT_CHARTS_FILTER, [
* Revenue Report Advanced Filters.
*
* @filter woocommerce_admin_revenue_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/revenue/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ RevenueReportTable.contextType = CurrencyContext;
*
* @param {boolean} isError
* @param {boolean} isRequesting
* @param {Object} tableQuery
* @param {Object} revenueData
* @param {Object} tableQuery
* @param {Object} revenueData
* @return {Object} formatted tableData prop
*/
const formatProps = memoize(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/stock/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const showDatePicker = false;
* Stock Report Advanced Filters.
*
* @filter woocommerce_admin_stock_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/taxes/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export const charts = applyFilters( TAXES_REPORT_CHARTS_FILTER, [
* Taxes Report Advanced Filters.
*
* @filter woocommerce_admin_taxes_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
4 changes: 2 additions & 2 deletions client/analytics/report/variations/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export const filters = applyFilters( VARIATIONS_REPORT_FILTERS_FILTER, [
* Variations Report Advanced Filters.
*
* @filter woocommerce_admin_variations_report_advanced_filters
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters Report Advanced Filters.
* @param {string} advancedFilters.title Interpolated component string for Advanced Filters title.
* @param {Object} advancedFilters.filters An object specifying a report's Advanced Filters.
*/
export const advancedFilters = applyFilters(
Expand Down
6 changes: 3 additions & 3 deletions client/analytics/report/variations/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ class VariationsReportTable extends Component {
*
* @filter experimental_woocommerce_admin_variations_report_table_summary_variations_count_label
*
* @param {string} label Label used for the count.
* @param {string} label Label used for the count.
* @param {string} variationsCount Number of variations.
* @param {Array} query Query parameters.
* @param {Array} query Query parameters.
*/
label: applyFilters(
EXPERIMENTAL_VARIATIONS_REPORT_TABLE_SUMMARY_VARIATIONS_COUNT_LABEL_FILTER,
Expand Down Expand Up @@ -305,7 +305,7 @@ class VariationsReportTable extends Component {
* @filter experimental_woocommerce_admin_variations_report_table_title
*
* @param {string} title Title used for the report table.
* @param {Array} query Query parameters.
* @param {Array} query Query parameters.
*/
title={ applyFilters(
EXPERIMENTAL_VARIATIONS_REPORT_TABLE_TITLE_FILTER,
Expand Down
16 changes: 8 additions & 8 deletions client/analytics/settings/historical-data/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ function HistoricalDataStatus( { importDate, status } ) {
*
* @filter woocommerce_admin_import_status
*
* @param {Object} statuses Import statuses.
* @param {string} statuses.nothing Nothing to import.
* @param {string} statuses.ready Ready to import.
* @param {Array} statuses.initializing Initializing string and spinner.
* @param {Array} statuses.customers Importing customers string and spinner.
* @param {Array} statuses.orders Importing orders string and spinner.
* @param {Array} statuses.finalizing Finalizing string and spinner.
* @param {string} statuses.finished Message displayed after import.
* @param {Object} statuses Import statuses.
* @param {string} statuses.nothing Nothing to import.
* @param {string} statuses.ready Ready to import.
* @param {Array} statuses.initializing Initializing string and spinner.
* @param {Array} statuses.customers Importing customers string and spinner.
* @param {Array} statuses.orders Importing orders string and spinner.
* @param {Array} statuses.finalizing Finalizing string and spinner.
* @param {string} statuses.finished Message displayed after import.
*/
const statusLabels = applyFilters( HISTORICAL_DATA_STATUS_FILTER, {
nothing: __( 'Nothing To Import', 'woocommerce-admin' ),
Expand Down
18 changes: 9 additions & 9 deletions client/customer-effort-score-tracks/data/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TYPES from './action-types';
/**
* Initialize the state
*
* @param {Object} queue initial queue
* @param {Object} queue initial queue
*/
export function setCesSurveyQueue( queue ) {
return {
Expand All @@ -23,19 +23,19 @@ export function setCesSurveyQueue( queue ) {
/**
* Add a new CES track to the state.
*
* @param {string} action action name for the survey
* @param {string} label label for the snackback
* @param {string} pageNow value of window.pagenow
* @param {string} adminPage value of window.adminpage
* @param {string} onsubmit_label label for the snackback onsubmit
* @param {Object} props object for optional props
* @param {string} action action name for the survey
* @param {string} label label for the snackback
* @param {string} pageNow value of window.pagenow
* @param {string} adminPage value of window.adminpage
* @param {string} onsubmitLabel label for the snackback onsubmit
* @param {Object} props object for optional props
*/
export function addCesSurvey(
action,
label,
pageNow = window.pagenow,
adminPage = window.adminpage,
onsubmit_label = undefined,
onsubmitLabel = undefined,
props = {}
) {
return {
Expand All @@ -44,7 +44,7 @@ export function addCesSurvey(
label,
pageNow,
adminPage,
onsubmit_label,
onsubmit_label: onsubmitLabel,
props,
};
}
Expand Down
14 changes: 7 additions & 7 deletions client/dashboard/components/settings/general/store-address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Option = { key: string; label: string };
* Check if a given address field is required for the locale.
*
* @param {string} fieldName Name of the field to check.
* @param {Object} locale Locale data.
* @param {Object} locale Locale data.
* @return {boolean} Field requirement.
*/
export function isAddressFieldRequired(
Expand Down Expand Up @@ -147,7 +147,7 @@ export const normalizeState = ( state: string ): string => {
/**
* Get state filter
*
* @param {string} isStateAbbreviation Whether to use state abbreviation or not.
* @param {string} isStateAbbreviation Whether to use state abbreviation or not.
* @param {string} normalizedAutofillState The value of the autofillState field.
* @return {Function} filter function.
*/
Expand Down Expand Up @@ -189,9 +189,9 @@ export const getStateFilter = (
/**
* Get the autofill countryState fields and set value from filtered options.
*
* @param {Array} options Array of filterable options.
* @param {string} countryState The value of the countryState field.
* @param {Function} setValue Set value of the countryState input.
* @param {Array} options Array of filterable options.
* @param {string} countryState The value of the countryState field.
* @param {Function} setValue Set value of the countryState input.
* @return {Object} React component.
*/
export function useGetCountryStateAutofill(
Expand Down Expand Up @@ -328,9 +328,9 @@ type StoreAddressProps = {
/**
* Store address fields.
*
* @param {Object} props Props for input components.
* @param {Object} props Props for input components.
* @param {Function} props.getInputProps Get input props.
* @param {Function} props.setValue Set value of the countryState input.
* @param {Function} props.setValue Set value of the countryState input.
* @return {Object} -
*/
export function StoreAddress( {
Expand Down
10 changes: 5 additions & 5 deletions client/dashboard/default-sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ const DEFAULT_SECTIONS_FILTER = 'woocommerce_dashboard_default_sections';
* An object defining a dashboard section.
*
* @typedef {Object} section
* @property {string} key Unique identifying string.
* @property {Node} component React component to render.
* @property {string} title Title.
* @property {boolean} isVisible The default visibilty.
* @property {Node} icon Section icon.
* @property {string} key Unique identifying string.
* @property {Node} component React component to render.
* @property {string} title Title.
* @property {boolean} isVisible The default visibilty.
* @property {Node} icon Section icon.
* @property {Array.<string>} hiddenBlocks Blocks that are hidden by default.
*/

Expand Down
Loading