Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build-types
build-wp
node_modules
packages/block-serialization-spec-parser/parser.js
packages/icons/src/library/*.tsx
packages/react-native-editor/bundle
vendor
!.*.js
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ module.exports = {
],
'@wordpress/no-unsafe-wp-apis': 'off',
'@wordpress/data-no-store-string-literals': 'error',
'eslint-comments/no-unused-disable': 'error',
'import/default': 'error',
'import/named': 'error',
'no-restricted-imports': [
Expand Down
1 change: 0 additions & 1 deletion bin/generate-php-sync-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,6 @@ async function fetchCommit( sha ) {
} );
}

// eslint-disable-next-line no-unused-vars
async function getPullRequestDataForCommit( commitSha ) {
const pullRequests = await octokitRequest(
'GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls',
Expand Down
2 changes: 0 additions & 2 deletions packages/autop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* The regular expression for an HTML element.
*/
const htmlSplitRegex: RegExp = ( () => {
/* eslint-disable no-multi-spaces */
const comments =
'!' + // Start of comment, after the <.
'(?:' + // Unroll the loop: Consume everything until --> is found.
Expand Down Expand Up @@ -43,7 +42,6 @@ const htmlSplitRegex: RegExp = ( () => {
')';

return new RegExp( regex );
/* eslint-enable no-multi-spaces */
} )();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import { store as blockDirectoryStore } from '../../store';

const getInstallMissing = ( OriginalComponent ) => ( props ) => {
const { originalName } = props.attributes;
// Disable reason: This is a valid component, but it's mistaken for a callback.
// eslint-disable-next-line react-hooks/rules-of-hooks
const { block, hasPermission } = useSelect(
( select ) => {
const { getDownloadableBlocks } = select( blockDirectoryStore );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ function BlockPopoverInbetween( {
return null;
}

/* eslint-disable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
// While ideally it would be enough to capture the
// bubbling focus event from the Inserter, due to the
// characteristics of click focusing of `button`s in
Expand Down Expand Up @@ -253,7 +252,6 @@ function BlockPopoverInbetween( {
</div>
</Popover>
);
/* eslint-enable jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */
}

export default BlockPopoverInbetween;
3 changes: 0 additions & 3 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,6 @@ function Iframe( {
>
{ iframeDocument &&
createPortal(
// We want to prevent React events from bubbling through the iframe
// we bubble these manually.
/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
<body
ref={ bodyRef }
className={ clsx(
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ import deprecated from '@wordpress/deprecated';
* providing a custom `settings` prop.
*/

/* eslint-disable jsdoc/valid-types */
/**
* Custom settings values associated with a link.
*
* @typedef {{[setting:string]:any}} WPLinkControlSettingsValue
*/
/* eslint-enable */

/**
* Custom settings values associated with a link.
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/components/list-view/expander.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export default function ListViewExpander( { onClick } ) {
//
// We've mimicked this by adding an icon with aria-hidden set to true to hide this from the accessibility tree.
// For the current tree grid implementation, please do not try to make this a button.
//
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
<span
className="block-editor-list-view__expander"
onClick={ ( event ) => onClick( event, { forceToggle: true } ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ const MediaReplaceFlow = ( {
: children }
</NavigableMenu>
{ onSelectURL && (
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
<form className="block-editor-media-flow__url-input">
<span className="block-editor-media-replace-flow__image-url-label">
{ __( 'Current media URL:' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,6 @@ export function RichTextWrapper(
preserveWhiteSpace,
} );

// Allows us to ask for this information when we get a report.
// eslint-disable-next-line no-console
window.console.log( 'Received items:\n\n', files );

if ( onReplace && isEmpty( value ) ) {
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/layouts/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ export default {
}

if ( rules.length ) {
// Reason to disable: the extra line breaks added by prettier mess with the unit tests.
// eslint-disable-next-line prettier/prettier
output = `${ appendSelectors( selector ) } { ${ rules.join(
'; '
) }; }`;
Expand Down
10 changes: 0 additions & 10 deletions packages/block-editor/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export const validateBlocksToTemplate =
* @property {WPBlockSelection} end The selection end.
*/

/* eslint-disable jsdoc/valid-types */
/**
* Returns an action object used in signalling that selection state should be
* reset to the specified selection.
Expand All @@ -120,7 +119,6 @@ export function resetSelection(
selectionEnd,
initialPosition
) {
/* eslint-enable jsdoc/valid-types */
return {
type: 'RESET_SELECTION',
selectionStart,
Expand Down Expand Up @@ -194,7 +192,6 @@ export function updateBlock( clientId, updates ) {
};
}

/* eslint-disable jsdoc/valid-types */
/**
* Returns an action object used in signalling that the block with the
* specified client ID has been selected, optionally accepting a position
Expand All @@ -208,7 +205,6 @@ export function updateBlock( clientId, updates ) {
* @return {Object} Action object.
*/
export function selectBlock( clientId, initialPosition = 0 ) {
/* eslint-enable jsdoc/valid-types */
return {
type: 'SELECT_BLOCK',
initialPosition,
Expand Down Expand Up @@ -355,7 +351,6 @@ export function toggleSelection( isSelectionEnabled = true ) {
};
}

/* eslint-disable jsdoc/valid-types */
/**
* Action that replaces given blocks with one or more replacement blocks.
*
Expand All @@ -370,7 +365,6 @@ export function toggleSelection( isSelectionEnabled = true ) {
export const replaceBlocks =
( clientIds, blocks, indexToSelect, initialPosition = 0, meta ) =>
( { select, dispatch, registry } ) => {
/* eslint-enable jsdoc/valid-types */
clientIds = castArray( clientIds );
blocks = castArray( blocks );
const rootClientId = select.getBlockRootClientId( clientIds[ 0 ] );
Expand Down Expand Up @@ -540,7 +534,6 @@ export function insertBlock(
);
}

/* eslint-disable jsdoc/valid-types */
/**
* Action that inserts an array of blocks, optionally at a specific index respective a root block list.
*
Expand All @@ -566,7 +559,6 @@ export const insertBlocks =
meta
) =>
( { select, dispatch } ) => {
/* eslint-enable jsdoc/valid-types */
if ( initialPosition !== null && typeof initialPosition === 'object' ) {
meta = initialPosition;
initialPosition = 0;
Expand Down Expand Up @@ -1400,7 +1392,6 @@ export function removeBlock( clientId, selectPrevious ) {
return removeBlocks( [ clientId ], selectPrevious );
}

/* eslint-disable jsdoc/valid-types */
/**
* Returns an action object used in signalling that the inner blocks with the
* specified client ID should be replaced.
Expand All @@ -1417,7 +1408,6 @@ export function replaceInnerBlocks(
updateSelection = false,
initialPosition = 0
) {
/* eslint-enable jsdoc/valid-types */
return {
type: 'REPLACE_INNER_BLOCKS',
rootClientId,
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ export function getNextBlockClientId( state, startClientId ) {
return getAdjacentBlockClientId( state, startClientId, 1 );
}

/* eslint-disable jsdoc/valid-types */
/**
* Returns the initial caret position for the selected block.
* This position is to used to position the caret properly when the selected block changes.
Expand All @@ -799,7 +798,6 @@ export function getNextBlockClientId( state, startClientId ) {
* @return {0|-1|null} Initial position.
*/
export function getSelectedBlocksInitialCaretPosition( state ) {
/* eslint-enable jsdoc/valid-types */
return state.initialPosition;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/comment-author-name/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Edit( {
const { getEntityRecord } = select( coreStore );

const comment = getEntityRecord( 'root', 'comment', commentId );
const authorName = comment?.author_name; // eslint-disable-line camelcase
const authorName = comment?.author_name;

if ( comment && ! authorName ) {
const user = getEntityRecord( 'root', 'user', comment.author );
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/comment-template/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ const CommentTemplatePreview = ( {
tabIndex={ 0 }
role="button"
style={ style }
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
onClick={ handleOnClick }
onKeyPress={ handleOnClick }
/>
Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/form/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ try {
);
} catch {}

// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable no-undef */
document.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {
// Bail If the form settings not provided or the form is not using the mailto: action.
if (
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/gallery/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function getHrefAndDestination( image, destination ) {
switch ( destination ) {
case DEPRECATED_LINK_DESTINATION_MEDIA:
return {
href: image?.source_url || image?.url, // eslint-disable-line camelcase
href: image?.source_url || image?.url,
linkDestination: LINK_DESTINATION_MEDIA,
};
case DEPRECATED_LINK_DESTINATION_ATTACHMENT:
Expand All @@ -66,7 +66,7 @@ export function getHrefAndDestination( image, destination ) {
};
case LINK_DESTINATION_MEDIA:
return {
href: image?.source_url || image?.url, // eslint-disable-line camelcase
href: image?.source_url || image?.url,
linkDestination: LINK_DESTINATION_MEDIA,
};
case LINK_DESTINATION_ATTACHMENT:
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function getHrefAndDestination(
case LINK_DESTINATION_MEDIA_WP_CORE:
case LINK_DESTINATION_MEDIA:
return {
href: image?.source_url || image?.url, // eslint-disable-line camelcase
href: image?.source_url || image?.url,
linkDestination: IMAGE_LINK_DESTINATION_MEDIA,
lightbox: lightboxSetting?.enabled
? { ...attributes?.lightbox, enabled: false }
Expand Down
4 changes: 0 additions & 4 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,6 @@ export default function Image( {
<Spinner />
</Placeholder>
) : (
// Disable reason: Image itself is not meant to be interactive, but
// should direct focus to block.
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
<>
<img
src={ temporaryURL || url }
Expand All @@ -940,7 +937,6 @@ export default function Image( {
/>
{ temporaryURL && <Spinner /> }
</>
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
);

if ( canEditImage && isEditingImage ) {
Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/media-text/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const applyWidthConstraints = ( width ) =>
);

function getImageSourceUrlBySizeSlug( image, slug ) {
// eslint-disable-next-line camelcase
return image?.media_details?.sizes?.[ slug ]?.source_url;
}

Expand Down Expand Up @@ -105,7 +104,6 @@ function attributesFromMedia( {
// Try the "large" size URL, falling back to the "full" size URL below.
src =
media.sizes?.large?.url ||
// eslint-disable-next-line camelcase
media.media_details?.sizes?.large?.source_url;
}

Expand Down
2 changes: 0 additions & 2 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,7 @@ export default function NavigationSubmenuEdit( {
/>
</InspectorControls>
<div { ...blockProps }>
{ /* eslint-disable jsx-a11y/anchor-is-valid */ }
<ParentElement className="wp-block-navigation-item__content">
{ /* eslint-enable */ }
<RichText
ref={ ref }
identifier="label"
Expand Down
5 changes: 0 additions & 5 deletions packages/block-library/src/site-logo/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,8 @@ const SiteLogo = ( {
);

let imgWrapper = img;

// Disable reason: Image itself is not meant to be interactive, but
// should direct focus to block.
if ( isLink ) {
imgWrapper = (
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
<a
href={ siteUrl }
className="custom-logo-link"
Expand All @@ -148,7 +144,6 @@ const SiteLogo = ( {
>
{ img }
</a>
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */
);
}

Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/table-of-contents/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function getLatestHeadings( select, clientId ) {
// declaring @wordpress/editor as a dependency, we must access its
// store by string. When the store is not available, editorSelectors
// will be null, and the block's saved markup will lack permalinks.
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const permalink = select( 'core/editor' ).getPermalink() ?? null;

const isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;
Expand Down
1 change: 0 additions & 1 deletion packages/blocks/src/api/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,6 @@ export const registerBlockBindingsSource = ( source ) => {

// Check the `getFieldsList` property is correct.
if ( getFieldsList && typeof getFieldsList !== 'function' ) {
// eslint-disable-next-line no-console
warning( 'Block bindings source getFieldsList must be a function.' );
return;
}
Expand Down
4 changes: 0 additions & 4 deletions packages/blocks/src/api/test/registration.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable react/forbid-elements */

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -1755,5 +1753,3 @@ describe( 'blocks', () => {
} );
} );
} );

/* eslint-enable react/forbid-elements */
1 change: 0 additions & 1 deletion packages/components/src/button/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ describe( 'Button', () => {
render(
<Button
// @ts-expect-error - a button should not have `href`
// eslint-disable-next-line no-restricted-syntax
href="https://wordpress.org/"
disabled
accessibleWhenDisabled
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/composite/legacy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export function useCompositeState(
loop: focusLoop = false,
wrap: focusWrap = false,
shift: focusShift = false,
// eslint-disable-next-line camelcase
unstable_virtual: virtualFocus,
} = legacyStateOptions;

Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/context/use-context-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ export function useContextSystem( props, namespace ) {

const contextProps = contextSystemProps?.[ namespace ] || {};

/* eslint-disable jsdoc/no-undefined-types */
/** @type {ConnectedProps<P>} */
// @ts-ignore We fill in the missing properties below
const finalComponentProps = {
...getConnectedNamespace(),
...getNamespace( namespace ),
};
/* eslint-enable jsdoc/no-undefined-types */

const { _overrides: overrideProps, ...otherContextProps } = contextProps;

Expand Down
Loading