Skip to content

Commit

Permalink
Merge pull request #2578 from 10up/chore/lint-4.x.x
Browse files Browse the repository at this point in the history
Lint JS and PHP for EP 4.0
  • Loading branch information
felipeelia authored Jan 28, 2022
2 parents e051161 + c555372 commit 2b776d7
Show file tree
Hide file tree
Showing 21 changed files with 70 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { facets } from '../config';
/**
* Facet selector component.
*
* @param {Object} props Props.
* @param {Object} props Props.
* @param {string} props.defaultValue Default value.
* @return {WPElement} Element.
*/
Expand Down
34 changes: 17 additions & 17 deletions assets/js/instant-results/components/common/checkbox-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ import SmallButton from './small-button';
* Checkbox list component.
*
* @typedef {Object} Option
* @property {number} count Number associated with option.
* @property {string} id Option ID.
* @property {string} label Option label.
* @property {number} order Option order.
* @property {string} parent Parent option value.
* @property {any} value Option value.
* @property {number} count Number associated with option.
* @property {string} id Option ID.
* @property {string} label Option label.
* @property {number} order Option order.
* @property {string} parent Parent option value.
* @property {any} value Option value.
*
* @param {Object} props Component props.
* @param {boolean} props.disabled Whether the checkboxes should be disabled.
* @param {boolean} props.label List label.
* @param {Function} props.onChange Checkbox change event callback function.
* @param {Option[]} props.options Checkbox options.
* @param {string} props.selected Selected values.
* @param {string} props.sortBy How to sort options.
* @param {Object} props Component props.
* @param {boolean} props.disabled Whether the checkboxes should be disabled.
* @param {boolean} props.label List label.
* @param {Function} props.onChange Checkbox change event callback function.
* @param {Option[]} props.options Checkbox options.
* @param {string} props.selected Selected values.
* @param {string} props.sortBy How to sort options.
* @return {WPElement} A React element.
*/
export default ({ disabled, label, options, onChange, selected, sortBy }) => {
Expand All @@ -44,8 +44,8 @@ export default ({ disabled, label, options, onChange, selected, sortBy }) => {
/**
* Reducer to group options by parent.
*
* @param {Object} items Options grouped by parent.
* @param {Option} option Option details.
* @param {Object} items Options grouped by parent.
* @param {Option} option Option details.
* @param {string} option.parent Option parent value.
* @return {Object} Options grouped by parent.
*/
Expand All @@ -68,8 +68,8 @@ export default ({ disabled, label, options, onChange, selected, sortBy }) => {
* Reducer to group top level options. Top level options are options
* with a parent of '0' or without a parent.
*
* @param {Array} items Options without a parent.
* @param {Option} option Option details.
* @param {Array} items Options without a parent.
* @param {Option} option Option details.
* @param {string} option.parent Option parent value.
* @return {Object} Options without a parent.
*/
Expand Down
4 changes: 2 additions & 2 deletions assets/js/instant-results/components/common/checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { WPElement } from '@wordpress/element';
/**
* Checkbox component.
*
* @param {Option} props Component props.
* @param {string} props.id Checkbox ID.
* @param {Option} props Component props.
* @param {string} props.id Checkbox ID.
* @param {string} props.label Checkbox label.
*
* @return {WPElement} Component element.
Expand Down
8 changes: 4 additions & 4 deletions assets/js/instant-results/components/common/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import { __ } from '@wordpress/i18n';
/**
* Modal components.
*
* @param {Object} props Component props.
* @param {Object} props Component props.
* @param {WPElement} props.children Component children.
* @param {boolean} props.isOpen Whether the modal is open.
* @param {Function} props.onClose Callback to run when modal is closed.
* @param {Object} ref Ref.
* @param {boolean} props.isOpen Whether the modal is open.
* @param {Function} props.onClose Callback to run when modal is closed.
* @param {Object} ref Ref.
* @return {WPElement} React element.
*/
const Modal = ({ children, isOpen, onClose, ...props }, ref) => {
Expand Down
8 changes: 4 additions & 4 deletions assets/js/instant-results/components/common/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { chevronDown, chevronUp, Icon } from '@wordpress/icons';
/**
* Facet wrapper component.
*
* @param {Object} props Component props.
* @param {WPElement} props.children Component children.
* @param {boolean} props.defaultIsOpen Whether the panel is open by default.
* @param {string} props.label Facet label.
* @param {Object} props Component props.
* @param {WPElement} props.children Component children.
* @param {boolean} props.defaultIsOpen Whether the panel is open by default.
* @param {string} props.label Facet label.
* @return {WPElement} Component element.
*/
export default ({ children, defaultIsOpen, label }) => {
Expand Down
6 changes: 3 additions & 3 deletions assets/js/instant-results/components/common/small-button.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Small button component.
*
* @param {Object} props Props.
* @param {WPElement} props.children Children.
* @param {string} props.className Class attribute.
* @param {Object} props Props.
* @param {WPElement} props.children Children.
* @param {string} props.className Class attribute.
* @return {WPElement} Element.
*/
export default ({ children, className, ...props }) => {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/components/common/star-rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { __, sprintf } from '@wordpress/i18n';
/**
* Star rating component.
*
* @param {Option} props Component props.
* @param {Option} props Component props.
* @param {string} props.rating Rating.
*
* @return {WPElement} Component element.
Expand Down
12 changes: 6 additions & 6 deletions assets/js/instant-results/components/facets/facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import TaxonomyTermsFacet from './taxonomy-terms-facet';
/**
* Facet component.
*
* @param {Object} props Props.
* @param {number} props.index Facet index.
* @param {string} props.name Facet name.
* @param {string} props.label Facet label.
* @param {string} props.postTypes Facet post types.
* @param {'post_type'|'price_range'|'taxonomy'} props.type Facet type.
* @param {Object} props Props.
* @param {number} props.index Facet index.
* @param {string} props.name Facet name.
* @param {string} props.label Facet label.
* @param {string} props.postTypes Facet post types.
* @param {'post_type'|'price_range'|'taxonomy'} props.type Facet type.
* @return {WPElement} Component element.
*/
export default ({ index, label, name, postTypes, type }) => {
Expand Down
10 changes: 5 additions & 5 deletions assets/js/instant-results/components/facets/post-type-facet.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { ActiveContraint } from '../tools/active-constraints';
/**
* Post type facet component.
*
* @param {Object} props Props.
* @param {Object} props Props.
* @param {boolean} props.defaultIsOpen Whether the panel is open by default.
* @param {string} props.label Facet label.
* @param {string} props.label Facet label.
* @return {WPElement} Component element.
*/
export default ({ defaultIsOpen, label }) => {
Expand All @@ -34,10 +34,10 @@ export default ({ defaultIsOpen, label }) => {
/**
* Create list of filter options from aggregation buckets.
*
* @param {Array} options List of options.
* @param {Object} bucket Aggregation bucket.
* @param {Array} options List of options.
* @param {Object} bucket Aggregation bucket.
* @param {string} bucket.key Aggregation key.
* @param {number} index Bucket index.
* @param {number} index Bucket index.
* @return {Array} Array of options.
*/
const reduceOptions = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { ActiveContraint } from '../tools/active-constraints';
/**
* Price range facet.
*
* @param {Object} props Props.
* @param {Object} props Props.
* @param {boolean} props.defaultIsOpen Whether the panel is open by default.
* @param {string} props.label Facet label.
* @param {string} props.label Facet label.
* @return {WPElement} Component element.
*/
export default ({ defaultIsOpen, label }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { ActiveContraint } from '../tools/active-constraints';
/**
* Taxonomy filter component.
*
* @param {Object} props Components props.
* @param {Object} props Components props.
* @param {boolean} props.defaultIsOpen Whether the panel is open by default.
* @param {string} props.label Facet label.
* @param {Array} props.postTypes Facet post types.
* @param {string} props.taxonomy Facet taxonomy.
* @param {string} props.label Facet label.
* @param {Array} props.postTypes Facet post types.
* @param {string} props.taxonomy Facet taxonomy.
* @return {WPElement} Component element.
*/
export default ({ defaultIsOpen, label, postTypes, taxonomy }) => {
Expand Down Expand Up @@ -60,8 +60,8 @@ export default ({ defaultIsOpen, label, postTypes, taxonomy }) => {
/**
* Create list of filter options from aggregation buckets.
*
* @param {Array} options List of options.
* @param {Object} bucket Aggregation bucket.
* @param {Array} options List of options.
* @param {Object} bucket Aggregation bucket.
* @param {string} bucket.key Aggregation key.
* @return {Array} Array of options.
*/
Expand Down Expand Up @@ -91,8 +91,8 @@ export default ({ defaultIsOpen, label, postTypes, taxonomy }) => {
/**
* Reduce options to labels.
*
* @param {Object} labels List of options.
* @param {Object} bucket Aggregation bucket.
* @param {Object} labels List of options.
* @param {Object} bucket Aggregation bucket.
* @param {string} bucket.key Aggregation key.
* @return {Object} Options and their labels.
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/components/layout/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Context from '../../context';
/**
* Search field component.
*
* @param {Object} props Props.
* @param {Object} props Props.
* @param {WPElement} props.children Children.
* @return {WPElement} Element.
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/components/layout/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { WPElement } from '@wordpress/element';
/**
* Search field component.
*
* @param {Object} props Props.
* @param {Object} props Props.
* @param {WPElement} props.children Children.
* @return {WPElement} Element.
*/
Expand Down
10 changes: 5 additions & 5 deletions assets/js/instant-results/components/results/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { __, sprintf } from '@wordpress/i18n';
/**
* Search results component.
*
* @param {Object} props Props.
* @param {number} props.offset Current items offset.
* @param {Function} props.onNext Next button handler.
* @param {Object} props Props.
* @param {number} props.offset Current items offset.
* @param {Function} props.onNext Next button handler.
* @param {Function} props.onPrevious Previous button handler.
* @param {number} props.perPage Items per page.
* @param {number} props.total Total number of items.
* @param {number} props.perPage Items per page.
* @param {number} props.total Total number of items.
* @return {WPElement} Element.
*/
export default ({ offset, onNext, onPrevious, perPage, total }) => {
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/components/results/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { gmdateI18n } = wp.date;
/**
* Search result.
*
* @param {Object} props Component props.
* @param {Object} props Component props.
* @param {Object} props.hit Elasticsearch hit.
* @return {WPElement} Component element.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const { Fill, Slot } = createSlotFill('ActiveContraints');
/**
* Active filter component.
*
* @param {Object} props Props.
* @param {string} props.label Constraint label.
* @param {Object} props Props.
* @param {string} props.label Constraint label.
* @param {Function} props.onClick Click handler.
* @return {WPElement} Element.
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { currencyCode } from './config';
/**
* Format a number as a price.
*
* @param {number} number Number to format.
* @param {number} number Number to format.
* @param {Object} options Formatter options.
* @return {string} Formatted number.
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { apiEndpoint, apiHost } from './config';
* after the last time it was run.
*
* @param {Function} callback Function to debounce.
* @param {number} delay Milliseconds to delay.
* @param {number} delay Milliseconds to delay.
* @return {Function} Debounced function.
*/
export const useDebounce = (callback, delay) => {
Expand Down
6 changes: 3 additions & 3 deletions assets/js/instant-results/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export const initialArg = {
/**
* Reducer function for handling state changes.
*
* @param {Object} state The current state.
* @param {Object} action Action data.
* @param {string} action.type The action name.
* @param {Object} state The current state.
* @param {Object} action Action data.
* @param {string} action.type The action name.
* @param {Object} action.payload New state data from the action.
* @return {Object} Updated state.
*/
Expand Down
2 changes: 1 addition & 1 deletion assets/js/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ if (epDash.index_meta) {
* Change the disabled attribute of an element
*
* @param {HTMLElement} element Element to be updated
* @param {boolean} value The value used in disabled attribute
* @param {boolean} value The value used in disabled attribute
*/
function updateDisabledAttribute(element, value) {
element.disabled = value;
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ public function request( $args, $assoc_args ) {
add_filter(
'http_api_debug',
function ( $response, $context, $transport, $request_args, $url ) {
// phpcs:disab le WordPress.PHP.DevelopmentFunctions
// phpcs:disable WordPress.PHP.DevelopmentFunctions
WP_CLI::line(
sprintf(
/* translators: URL of the request */
Expand Down

0 comments on commit 2b776d7

Please sign in to comment.