diff --git a/projects/plugins/jetpack/_inc/client/components/module-settings/with-module-settings-form-helpers.jsx b/projects/plugins/jetpack/_inc/client/components/module-settings/with-module-settings-form-helpers.jsx index 50a5b9353a461..90571b74a25ed 100644 --- a/projects/plugins/jetpack/_inc/client/components/module-settings/with-module-settings-form-helpers.jsx +++ b/projects/plugins/jetpack/_inc/client/components/module-settings/with-module-settings-form-helpers.jsx @@ -124,7 +124,7 @@ export function withModuleSettingsFormHelpers( InnerComponent ) { const saneOptions = {}; each( this.state.options, ( value, key ) => { - key = key.replace( /\-/, '_' ); + key = key.replace( /-/, '_' ); saneOptions[ key ] = value; } ); diff --git a/projects/plugins/jetpack/_inc/client/components/popover/util.js b/projects/plugins/jetpack/_inc/client/components/popover/util.js index dc1d70473ffcd..9ee46675a4b36 100644 --- a/projects/plugins/jetpack/_inc/client/components/popover/util.js +++ b/projects/plugins/jetpack/_inc/client/components/popover/util.js @@ -117,7 +117,8 @@ function choosePrimary( prefered, room ) { // less chopped of than other sides if ( space > best ) { - ( best = space ), ( bestPos = prefered ); + best = space; + bestPos = prefered; } } @@ -161,7 +162,8 @@ function chooseSecondary( primary, prefered, el, target, w, h ) { // shows more of the tip than the other positions if ( area > best ) { - ( best = area ), ( bestPos = pos ); + best = area; + bestPos = pos; } } diff --git a/projects/plugins/jetpack/_inc/client/components/section-nav/tabs.jsx b/projects/plugins/jetpack/_inc/client/components/section-nav/tabs.jsx index 7561cc6c1500e..e3c7b196ee45a 100644 --- a/projects/plugins/jetpack/_inc/client/components/section-nav/tabs.jsx +++ b/projects/plugins/jetpack/_inc/client/components/section-nav/tabs.jsx @@ -155,7 +155,7 @@ class NavTabs extends React.Component { case 32: // space case 13: // enter event.preventDefault(); - document.activeElement.click(); + event.target.ownerDocument.activeElement.click(); break; } }; diff --git a/projects/plugins/jetpack/_inc/client/components/select-dropdown/index.jsx b/projects/plugins/jetpack/_inc/client/components/select-dropdown/index.jsx index 0823472917e90..cc5f27ea3f3bc 100644 --- a/projects/plugins/jetpack/_inc/client/components/select-dropdown/index.jsx +++ b/projects/plugins/jetpack/_inc/client/components/select-dropdown/index.jsx @@ -312,7 +312,7 @@ class SelectDropdown extends Component { if ( ! this.state.isOpen ) { return this.openDropdown(); } - document.activeElement.click(); + this.dropdownContainerRef.current.ownerDocument.activeElement.click(); } focusSibling( direction ) { diff --git a/projects/plugins/jetpack/_inc/client/pro-status/index.jsx b/projects/plugins/jetpack/_inc/client/pro-status/index.jsx index 8afa74cd5381e..8966c2d5fb9af 100644 --- a/projects/plugins/jetpack/_inc/client/pro-status/index.jsx +++ b/projects/plugins/jetpack/_inc/client/pro-status/index.jsx @@ -109,9 +109,10 @@ class ProStatus extends React.Component { break; case 'invalid_key': return; - case 'rewind_connected': + case 'rewind_connected': { const rewindMessage = this.getRewindMessage(); return ; + } case 'active': return ; } diff --git a/projects/plugins/jetpack/_inc/client/state/connection/reducer.js b/projects/plugins/jetpack/_inc/client/state/connection/reducer.js index 3062aaff5c056..4550f2180f236 100644 --- a/projects/plugins/jetpack/_inc/client/state/connection/reducer.js +++ b/projects/plugins/jetpack/_inc/client/state/connection/reducer.js @@ -73,9 +73,10 @@ export const user = ( state = window.Initial_State.userData || {}, action ) => { case USER_CONNECTION_DATA_FETCH_SUCCESS: return assign( {}, state, action.userConnectionData ); - case UNLINK_USER_SUCCESS: + case UNLINK_USER_SUCCESS: { const currentUser = assign( {}, state.currentUser, { isConnected: false } ); return assign( {}, state, { currentUser } ); + } case MOCK_SWITCH_USER_PERMISSIONS: return merge( {}, state, action.initialState ); diff --git a/projects/plugins/jetpack/_inc/client/state/modules/reducer.js b/projects/plugins/jetpack/_inc/client/state/modules/reducer.js index 5599dc44292ba..70de9bc934250 100644 --- a/projects/plugins/jetpack/_inc/client/state/modules/reducer.js +++ b/projects/plugins/jetpack/_inc/client/state/modules/reducer.js @@ -31,7 +31,7 @@ export const items = ( state = {}, action ) => { return assign( {}, state, { [ action.module ]: assign( {}, state[ action.module ], { activated: false } ), } ); - case JETPACK_MODULE_UPDATE_OPTIONS_SUCCESS: + case JETPACK_MODULE_UPDATE_OPTIONS_SUCCESS: { const updatedModule = assign( {}, state[ action.module ] ); Object.keys( action.newOptionValues ).forEach( key => { updatedModule.options[ key ].current_value = action.newOptionValues[ key ]; @@ -39,6 +39,7 @@ export const items = ( state = {}, action ) => { return assign( {}, state, { [ action.module ]: updatedModule, } ); + } default: return state; } @@ -84,7 +85,7 @@ export const requests = ( state = initialRequestsState, action ) => { [ action.module ]: false, } ), } ); - case JETPACK_MODULE_UPDATE_OPTIONS: + case JETPACK_MODULE_UPDATE_OPTIONS: { const updatingOption = assign( {}, state.updatingOption ); updatingOption[ action.module ] = assign( {}, updatingOption[ action.module ] ); Object.keys( action.newOptionValues ).forEach( key => { @@ -93,8 +94,9 @@ export const requests = ( state = initialRequestsState, action ) => { return assign( {}, state, { updatingOption: assign( {}, state.updatingOption, updatingOption ), } ); + } case JETPACK_MODULE_UPDATE_OPTIONS_FAIL: - case JETPACK_MODULE_UPDATE_OPTIONS_SUCCESS: + case JETPACK_MODULE_UPDATE_OPTIONS_SUCCESS: { const _updatingOption = assign( {}, state.updatingOption ); _updatingOption[ action.module ] = assign( {}, _updatingOption[ action.module ] ); Object.keys( action.newOptionValues ).forEach( key => { @@ -103,6 +105,7 @@ export const requests = ( state = initialRequestsState, action ) => { return assign( {}, state, { updatingOption: assign( {}, state.updatingOption, _updatingOption ), } ); + } default: return state; } diff --git a/projects/plugins/jetpack/_inc/client/state/settings/reducer.js b/projects/plugins/jetpack/_inc/client/state/settings/reducer.js index bb6f2d05225f6..ed91a0c41fcf0 100644 --- a/projects/plugins/jetpack/_inc/client/state/settings/reducer.js +++ b/projects/plugins/jetpack/_inc/client/state/settings/reducer.js @@ -21,11 +21,12 @@ export const items = ( state = {}, action ) => { return assign( {}, state, action.initialState.settings ); case JETPACK_SETTINGS_FETCH_RECEIVE: return assign( {}, action.settings ); - case JETPACK_SETTING_UPDATE_SUCCESS: + case JETPACK_SETTING_UPDATE_SUCCESS: { const key = Object.keys( action.updatedOption )[ 0 ]; return assign( {}, state, { [ key ]: action.updatedOption[ key ], } ); + } case JETPACK_SETTINGS_UPDATE_SUCCESS: return assign( {}, state, action.updatedOptions ); default: diff --git a/projects/plugins/jetpack/_inc/client/writing/composing.jsx b/projects/plugins/jetpack/_inc/client/writing/composing.jsx index 90b5b46d5e535..955bc07d37f7d 100644 --- a/projects/plugins/jetpack/_inc/client/writing/composing.jsx +++ b/projects/plugins/jetpack/_inc/client/writing/composing.jsx @@ -21,7 +21,7 @@ export class Composing extends React.Component { * @return {*} the updated value */ updateFormStateByMarkdown = module => { - if ( !! this.props.getSettingCurrentValue( 'wpcom_publish_comments_with_markdown', module ) ) { + if ( this.props.getSettingCurrentValue( 'wpcom_publish_comments_with_markdown', module ) ) { return this.props.updateFormStateModuleOption( module, 'wpcom_publish_posts_with_markdown' ); } return this.props.updateFormStateModuleOption( diff --git a/projects/plugins/jetpack/_inc/jetpack-deactivate-dialog.js b/projects/plugins/jetpack/_inc/jetpack-deactivate-dialog.js index 294ffae1e3338..9c89b0bdba2cd 100644 --- a/projects/plugins/jetpack/_inc/jetpack-deactivate-dialog.js +++ b/projects/plugins/jetpack/_inc/jetpack-deactivate-dialog.js @@ -30,11 +30,12 @@ $( '#TB_window' ).addClass( 'jetpack-disconnect-modal' ); deactivationModalCentralize(); - $( '#TB_closeWindowButton, #TB_overlay' ).on( 'click', function ( e ) { + $( '#TB_closeWindowButton, #TB_overlay' ).on( 'click', function () { deactivationModalTrackCloseEvent(); } ); document.onkeyup = function ( e ) { + var keycode; if ( e === null ) { // ie keycode = event.keyCode; @@ -42,7 +43,7 @@ // mozilla keycode = e.which; } - if ( keycode == 27 ) { + if ( keycode === 27 ) { // close deactivationModalTrackCloseEvent(); } @@ -77,12 +78,12 @@ deactivateLinkElem.attr( 'title', deactivate_dialog.title ); deactivateLinkElem.addClass( 'thickbox' ); deactivateLinkElem.html( deactivate_dialog.deactivate_label ); - deactivateLinkElem.on( 'click', function ( e ) { + deactivateLinkElem.on( 'click', function () { observer.observe( body, { childList: true } ); analytics.tracks.recordEvent( 'jetpack_termination_dialog_open', tracksProps ); } ); - $( '#jetpack_deactivation_dialog_content__button-cancel' ).on( 'click', function ( e ) { + $( '#jetpack_deactivation_dialog_content__button-cancel' ).on( 'click', function () { tb_remove(); deactivationModalTrackCloseEvent(); } ); diff --git a/projects/plugins/jetpack/_inc/jetpack-modules.js b/projects/plugins/jetpack/_inc/jetpack-modules.js index 18c90b9e3ab81..dbb654d44ec66 100644 --- a/projects/plugins/jetpack/_inc/jetpack-modules.js +++ b/projects/plugins/jetpack/_inc/jetpack-modules.js @@ -1,19 +1,10 @@ ( function ( window, $, items, models, views, i18n, modalinfo, nonces ) { 'use strict'; - var modules, - list_table, - handle_module_tag_click, - $the_table, - $the_filters, - $the_search, - $jp_frame, - $bulk_button; - - $the_table = $( '.wp-list-table.jetpack-modules' ); + var modules, list_table, handle_module_tag_click, $the_filters, $the_search, $bulk_button; + $the_filters = $( '.navbar-form' ); $the_search = $( '#srch-term-search-input' ); - $jp_frame = $( '.jp-frame' ); $bulk_button = $( '#doaction' ); modules = new models.Modules( { diff --git a/projects/plugins/jetpack/changelog/fix-various-eslint-lints b/projects/plugins/jetpack/changelog/fix-various-eslint-lints new file mode 100644 index 0000000000000..85fe0d31b9f57 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-various-eslint-lints @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Fix various eslint lints. Should be no change to functionality, although it's possible some obscure React bugs got fixed. + + diff --git a/projects/plugins/jetpack/extensions/blocks/eventbrite/utils.js b/projects/plugins/jetpack/extensions/blocks/eventbrite/utils.js index 41c497f8cb9b8..71ddc4b55ad4e 100644 --- a/projects/plugins/jetpack/extensions/blocks/eventbrite/utils.js +++ b/projects/plugins/jetpack/extensions/blocks/eventbrite/utils.js @@ -24,7 +24,7 @@ export function eventIdFromUrl( url ) { return null; } - const match = url.match( /(\d+)\/?(?:\?[^\/]*)?\s*$/ ); + const match = url.match( /(\d+)\/?(?:\?[^/]*)?\s*$/ ); return match && match[ 1 ] ? parseInt( match[ 1 ], 10 ) : null; } diff --git a/projects/plugins/jetpack/extensions/blocks/image-compare/edit.js b/projects/plugins/jetpack/extensions/blocks/image-compare/edit.js index 8f564c170dd4c..82b90463813a2 100644 --- a/projects/plugins/jetpack/extensions/blocks/image-compare/edit.js +++ b/projects/plugins/jetpack/extensions/blocks/image-compare/edit.js @@ -14,34 +14,30 @@ import './view.js'; const Edit = ( { attributes, clientId, isSelected, setAttributes } ) => { const { align, imageBefore, imageAfter, caption, orientation } = attributes; - // Check for useResizeObserver, not available in older Gutenberg. - let resizeListener = null; - let sizes = null; const blockProps = useBlockProps(); const juxtaposeRef = useRef( undefined ); - if ( useResizeObserver ) { - // Let's look for resize so we can trigger the thing. - [ resizeListener, sizes ] = useResizeObserver(); - useDebounce( - sz => { - if ( sz > 0 ) { - if ( typeof juxtapose !== 'undefined' && juxtapose.sliders ) { - // only update for *this* slide - juxtapose.sliders.forEach( elem => { - const parentElem = elem.wrapper.parentElement; - if ( parentElem.id === clientId ) { - elem.optimizeWrapper( sz ); - } - } ); - } + // Let's look for resize so we can trigger the thing. + const [ resizeListener, sizes ] = useResizeObserver(); + + useDebounce( + sz => { + if ( sz > 0 ) { + if ( typeof juxtapose !== 'undefined' && juxtapose.sliders ) { + // only update for *this* slide + juxtapose.sliders.forEach( elem => { + const parentElem = elem.wrapper.parentElement; + if ( parentElem.id === clientId ) { + elem.optimizeWrapper( sz ); + } + } ); } - }, - 200, - sizes.width - ); - } + } + }, + 200, + sizes.width + ); // Initial state if attributes already set or not. // If both images are set, add juxtapose class, which is picked up by the library. diff --git a/projects/plugins/jetpack/extensions/blocks/opentable/edit.js b/projects/plugins/jetpack/extensions/blocks/opentable/edit.js index 1ca50c37925c0..4ac453c675c73 100644 --- a/projects/plugins/jetpack/extensions/blocks/opentable/edit.js +++ b/projects/plugins/jetpack/extensions/blocks/opentable/edit.js @@ -119,7 +119,7 @@ function OpenTableEdit( { // Need to force attribute to be updated after switch to using block styles // so it still meets frontend rendering expectations. setAttributes( { style } ); - }, [ style ] ); + }, [ align, style, prevStyle, setAttributes ] ); const parseEmbedCode = embedCode => { const newAttributes = getAttributesFromEmbedCode( embedCode ); diff --git a/projects/plugins/jetpack/extensions/blocks/opentable/restaurant-picker.js b/projects/plugins/jetpack/extensions/blocks/opentable/restaurant-picker.js index dd57dcce1c536..4d157ff17fcda 100644 --- a/projects/plugins/jetpack/extensions/blocks/opentable/restaurant-picker.js +++ b/projects/plugins/jetpack/extensions/blocks/opentable/restaurant-picker.js @@ -11,7 +11,7 @@ export default function RestaurantPicker( props ) { const { restaurants, hasRequestFailed } = useRestaurantSearch( input, MAX_SUGGESTIONS ); const [ selectedRestaurants, setSelectedRestaurants ] = useState( props.rids || [] ); - const idRegex = /^(\d+)$|\(\#(\d+)\)$/; + const idRegex = /^(\d+)$|\(#(\d+)\)$/; const onChange = selected => { const selectedIds = selected.map( restaurant => { diff --git a/projects/plugins/jetpack/extensions/blocks/opentable/use-restaurant-search.js b/projects/plugins/jetpack/extensions/blocks/opentable/use-restaurant-search.js index 38896d0765e44..9b1ff32638d1d 100644 --- a/projects/plugins/jetpack/extensions/blocks/opentable/use-restaurant-search.js +++ b/projects/plugins/jetpack/extensions/blocks/opentable/use-restaurant-search.js @@ -1,38 +1,42 @@ -import { useState, useEffect, useCallback } from '@wordpress/element'; +import { useState, useEffect, useCallback, useMemo } from '@wordpress/element'; import { unionBy, throttle, isEmpty } from 'lodash'; -export const possibleEmbed = /^\s*(http[s]?:\/\/|\ { - setHasRequestFailed( false ); + const searchRestaurants = useCallback( + ( input = '' ) => { + setHasRequestFailed( false ); - fetch( - 'https://www.opentable.com/widget/reservation/restaurant-search?pageSize=' + - maxResults + - '&query=' + - encodeURIComponent( input ) - ) - .then( result => result.json() ) - .then( restaurantResponse => { - setHasRequestFailed( false ); - setRestaurants( unionBy( restaurants, restaurantResponse.items, 'rid' ) ); - } ) - .catch( () => setHasRequestFailed( true ) ); - }; + fetch( + 'https://www.opentable.com/widget/reservation/restaurant-search?pageSize=' + + maxResults + + '&query=' + + encodeURIComponent( input ) + ) + .then( result => result.json() ) + .then( restaurantResponse => { + setHasRequestFailed( false ); + setRestaurants( unionBy( restaurants, restaurantResponse.items, 'rid' ) ); + } ) + .catch( () => setHasRequestFailed( true ) ); + }, + [ restaurants, maxResults ] + ); - const throttledSearchRestaurants = useCallback( throttle( searchRestaurants, 500 ), [ - restaurants, - ] ); + const throttledSearchRestaurants = useMemo( + () => throttle( searchRestaurants, 500 ), + [ searchRestaurants ] + ); useEffect( () => { if ( ! isEmpty( searchTerm ) && ! possibleEmbed.test( searchTerm ) ) { throttledSearchRestaurants( searchTerm ); } - }, [ searchTerm ] ); + }, [ searchTerm, throttledSearchRestaurants ] ); return { restaurants, hasRequestFailed }; } diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/edit.js b/projects/plugins/jetpack/extensions/blocks/subscriptions/edit.js index a80575a492478..73d732bf87bc0 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/edit.js +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/edit.js @@ -39,6 +39,7 @@ import SubscriptionSkeletonLoader from './subscription-skeleton-loader'; const { getComputedStyle } = window; const isGradientAvailable = !! useGradient; +const useGradientIfAvailable = isGradientAvailable ? useGradient : () => ( {} ); const name = metadata.name.replace( 'jetpack/', '' ); const applyFallbackStyles = withFallbackStyles( ( node, ownProps ) => { @@ -125,18 +126,14 @@ export function SubscriptionEdit( props ) { }; } ); - const emailFieldGradient = isGradientAvailable - ? useGradient( { - gradientAttribute: 'emailFieldGradient', - customGradientAttribute: 'customEmailFieldGradient', - } ) - : {}; - const buttonGradient = isGradientAvailable - ? useGradient( { - gradientAttribute: 'buttonGradient', - customGradientAttribute: 'customButtonGradient', - } ) - : {}; + const emailFieldGradient = useGradientIfAvailable( { + gradientAttribute: 'emailFieldGradient', + customGradientAttribute: 'customEmailFieldGradient', + } ); + const buttonGradient = useGradientIfAvailable( { + gradientAttribute: 'buttonGradient', + customGradientAttribute: 'customButtonGradient', + } ); const sharedClasses = { 'no-border-radius': borderRadius === 0, diff --git a/projects/plugins/jetpack/extensions/shared/components/block-styles-selector/index.js b/projects/plugins/jetpack/extensions/shared/components/block-styles-selector/index.js index 65d34b7dedd98..2de9e7a75a05e 100644 --- a/projects/plugins/jetpack/extensions/shared/components/block-styles-selector/index.js +++ b/projects/plugins/jetpack/extensions/shared/components/block-styles-selector/index.js @@ -51,13 +51,10 @@ export default function BlockStylesSelector( { viewportWidth, title, } ) { - let block; - if ( useSelect ) { - block = useSelect( select => { - const { getBlock } = select( 'core/block-editor' ); - return getBlock( clientId ); - } ); - } + const block = useSelect( select => { + const { getBlock } = select( 'core/block-editor' ); + return getBlock( clientId ); + } ); return ( <> @@ -105,8 +102,7 @@ export default function BlockStylesSelector( {
{ styleOption.preview ? styleOption.preview - : useSelect && - block && ( + : block && ( { - if ( undefined !== typeof window && window.location ) { + if ( window?.location ) { const queryParams = new URLSearchParams( window.location.search ); if ( queryParams.get( 'plan_upgraded' ) ) { diff --git a/projects/plugins/jetpack/modules/.eslintrc.js b/projects/plugins/jetpack/modules/.eslintrc.js index 25a20196d8d6e..ed838f1bb2eec 100644 --- a/projects/plugins/jetpack/modules/.eslintrc.js +++ b/projects/plugins/jetpack/modules/.eslintrc.js @@ -26,7 +26,7 @@ module.exports = { 'no-unused-vars': 'warn', 'no-useless-escape': 0, 'no-control-regex': 0, - 'no-unused-expressions': 'warn', + 'no-unused-expressions': [ 'warn', { allowShortCircuit: true, allowTernary: true } ], 'no-caller': 'error', 'no-cond-assign': [ 'error', 'except-parens' ], diff --git a/projects/plugins/jetpack/modules/infinite-scroll/infinity.js b/projects/plugins/jetpack/modules/infinite-scroll/infinity.js index e880c15bfc9c4..10ee02978bed9 100644 --- a/projects/plugins/jetpack/modules/infinite-scroll/infinity.js +++ b/projects/plugins/jetpack/modules/infinite-scroll/infinity.js @@ -2,17 +2,17 @@ ( function () { // Open closure. // Local vars. - var Scroller, ajaxurl, stats, type, text, totop, loading_text; + var Scroller, stats, type, text, totop, loading_text; // IE requires special handling - var isIE = -1 != navigator.userAgent.search( 'MSIE' ); + var isIE = -1 !== navigator.userAgent.search( 'MSIE' ); if ( isIE ) { var IEVersion = navigator.userAgent.match( /MSIE\s?(\d+)\.?\d*;/ ); IEVersion = parseInt( IEVersion[ 1 ] ); } // HTTP ajaxurl when site is HTTPS causes Access-Control-Allow-Origin failure in Desktop and iOS Safari - if ( 'https:' == document.location.protocol ) { + if ( 'https:' === document.location.protocol ) { infiniteScroll.settings.ajaxurl = infiniteScroll.settings.ajaxurl.replace( 'http://', 'https://' @@ -63,7 +63,7 @@ // We have two type of infinite scroll // cases 'scroll' and 'click' - if ( type == 'scroll' ) { + if ( type === 'scroll' ) { // Bind refresh to the scroll event // Throttle to check for such case every 300ms @@ -90,7 +90,7 @@ // Ensure that enough posts are loaded to fill the initial viewport, to compensate for short posts and large displays. self.ensureFilledViewport(); this.body.addEventListener( 'is.post-load', self.checkViewportOnLoadBound ); - } else if ( type == 'click' ) { + } else if ( type === 'click' ) { if ( this.click_handle ) { this.element.appendChild( this.handle ); } @@ -488,7 +488,7 @@ self.render.call( self, response ); // If 'click' type and there are still posts to fetch, add back the handle - if ( type == 'click' ) { + if ( type === 'click' ) { // add focus to new posts, only in button mode as we know where page focus currently is and only if we have a wrapper if ( infiniteScroll.settings.wrapper ) { document @@ -805,7 +805,7 @@ self.history.parameters; } - if ( window.location.href != pageSlug ) { + if ( window.location.href !== pageSlug ) { history.pushState( null, null, pageSlug ); } }; @@ -875,9 +875,6 @@ } } ); - // Set ajaxurl (for brevity) - ajaxurl = infiniteScroll.settings.ajaxurl; - // Set stats, used for tracking stats stats = infiniteScroll.settings.stats; @@ -895,7 +892,7 @@ /** * Monitor user scroll activity to update URL to correspond to archive page for current set of IS posts */ - if ( type == 'click' ) { + if ( type === 'click' ) { var timer = null; window.addEventListener( 'scroll', function () { // run the real scroll handler once every 250 ms. diff --git a/projects/plugins/jetpack/modules/plugin-search/plugin-search.js b/projects/plugins/jetpack/modules/plugin-search/plugin-search.js index a306b1e44cc85..87eda471adc1b 100644 --- a/projects/plugins/jetpack/modules/plugin-search/plugin-search.js +++ b/projects/plugins/jetpack/modules/plugin-search/plugin-search.js @@ -3,7 +3,7 @@ * of the card with customized content. */ -/* global jetpackPluginSearch, JSON, jpTracksAJAX */ +/* global jetpackPluginSearch, jpTracksAJAX */ var JetpackPSH = {}; diff --git a/projects/plugins/jetpack/modules/scan/admin-bar-notice.js b/projects/plugins/jetpack/modules/scan/admin-bar-notice.js index 4a226bc4d9309..1580169806a53 100644 --- a/projects/plugins/jetpack/modules/scan/admin-bar-notice.js +++ b/projects/plugins/jetpack/modules/scan/admin-bar-notice.js @@ -1,6 +1,6 @@ ( function ( localized ) { function ready( fn ) { - if ( document.readyState != 'loading' ) { + if ( document.readyState !== 'loading' ) { fn(); } else { document.addEventListener( 'DOMContentLoaded', fn ); @@ -11,7 +11,7 @@ var xhrRequest = new XMLHttpRequest(); xhrRequest.open( 'GET', localized.scan_endpoint, true ); xhrRequest.onload = function () { - if ( this.status == 200 ) { + if ( this.status === 200 ) { // Success! var body = JSON.parse( this.response ); if ( body && body.data ) { @@ -45,7 +45,7 @@ return; } - var textLabel = numberOfThreats == 1 ? localized.singular : localized.multiple; + var textLabel = numberOfThreats === 1 ? localized.singular : localized.multiple; element.innerHTML = '' + textLabel + ''; } diff --git a/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js b/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js index 1418b16c57ea1..4ccb5ddf50789 100644 --- a/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js +++ b/projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js @@ -1,4 +1,4 @@ -/* global pluploadL10n, plupload, _wpPluploadSettings, JSON */ +/* global pluploadL10n, plupload, _wpPluploadSettings */ window.wp = window.wp || {}; diff --git a/projects/plugins/jetpack/modules/wpgroho.js b/projects/plugins/jetpack/modules/wpgroho.js index 33c79d5afc90f..ae683793d1e51 100644 --- a/projects/plugins/jetpack/modules/wpgroho.js +++ b/projects/plugins/jetpack/modules/wpgroho.js @@ -4,10 +4,14 @@ out = out || {}; for ( var i = 1; i < arguments.length; i++ ) { - if ( ! arguments[ i ] ) continue; + if ( ! arguments[ i ] ) { + continue; + } for ( var key in arguments[ i ] ) { - if ( Object.hasOwn( arguments[ i ], key ) ) out[ key ] = arguments[ i ][ key ]; + if ( Object.hasOwn( arguments[ i ], key ) ) { + out[ key ] = arguments[ i ][ key ]; + } } } diff --git a/tools/eslint-excludelist.json b/tools/eslint-excludelist.json index e89841313592a..fda4bf3612853 100644 --- a/tools/eslint-excludelist.json +++ b/tools/eslint-excludelist.json @@ -24,7 +24,6 @@ "projects/plugins/jetpack/_inc/client/mixins/emitter/index.js", "projects/plugins/jetpack/_inc/client/my-plan/index.jsx", "projects/plugins/jetpack/_inc/client/notices/index.js", - "projects/plugins/jetpack/_inc/client/pro-status/index.jsx", "projects/plugins/jetpack/_inc/client/state/connection/reducer.js", "projects/plugins/jetpack/_inc/client/state/dev-version/reducer.js", "projects/plugins/jetpack/_inc/client/state/disconnect-survey/reducer.js", @@ -47,30 +46,15 @@ "projects/plugins/jetpack/_inc/jetpack-deactivate-dialog.js", "projects/plugins/jetpack/_inc/jetpack-modules.js", "projects/plugins/jetpack/_inc/twitter-timeline.js", - "projects/plugins/jetpack/extensions/blocks/eventbrite/utils.js", - "projects/plugins/jetpack/extensions/blocks/image-compare/edit.js", "projects/plugins/jetpack/extensions/blocks/image-compare/use-debounce.js", - "projects/plugins/jetpack/extensions/blocks/opentable/edit.js", - "projects/plugins/jetpack/extensions/blocks/opentable/restaurant-picker.js", - "projects/plugins/jetpack/extensions/blocks/opentable/use-restaurant-search.js", "projects/plugins/jetpack/extensions/blocks/pinterest/utils.js", "projects/plugins/jetpack/extensions/blocks/podcast-player/utils.js", "projects/plugins/jetpack/extensions/blocks/slideshow/transforms.js", - "projects/plugins/jetpack/extensions/blocks/subscriptions/edit.js", "projects/plugins/jetpack/extensions/shared/block-styles.js", - "projects/plugins/jetpack/extensions/shared/components/block-styles-selector/index.js", "projects/plugins/jetpack/extensions/shared/currencies.js", - "projects/plugins/jetpack/extensions/shared/external-media/sources/google-photos/filter-request.js", "projects/plugins/jetpack/extensions/shared/get-validated-attributes.js", - "projects/plugins/jetpack/extensions/shared/plan-upgrade-notification.js", "projects/plugins/jetpack/modules/infinite-scroll/infinity-customizer.js", - "projects/plugins/jetpack/modules/infinite-scroll/infinity.js", - "projects/plugins/jetpack/modules/plugin-search/plugin-search.js", - "projects/plugins/jetpack/modules/scan/admin-bar-notice.js", "projects/plugins/jetpack/modules/videopress/js/gutenberg-video-upload.js", - "projects/plugins/jetpack/modules/videopress/js/videopress-plupload.js", "projects/plugins/jetpack/modules/widgets/customizer-utils.js", - "projects/plugins/jetpack/modules/widgets/milestone/admin.js", - "projects/plugins/jetpack/modules/widgets/simple-payments/customizer.js", - "projects/plugins/jetpack/modules/wpgroho.js" + "projects/plugins/jetpack/modules/widgets/simple-payments/customizer.js" ]