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]?:\/\/|\