Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint: Bump eslint-plugin-react-compiler to latest beta #67106

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"eslint-plugin-jest": "27.2.3",
"eslint-plugin-jest-dom": "5.0.2",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-react-compiler": "19.0.0-beta-8a03594-20241020",
"eslint-plugin-react-compiler": "19.0.0-beta-0dec889-20241115",
"eslint-plugin-ssr-friendly": "1.0.6",
"eslint-plugin-storybook": "0.6.13",
"eslint-plugin-testing-library": "6.0.2",
Expand Down
10 changes: 6 additions & 4 deletions packages/editor/src/components/document-outline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { useRef } from '@wordpress/element';
import { create, getTextContent } from '@wordpress/rich-text';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { store as coreStore } from '@wordpress/core-data';
Expand Down Expand Up @@ -127,6 +128,8 @@ export default function DocumentOutline( {
};
} );

const prevHeadingLevelRef = useRef( 1 );

const headings = computeOutlineHeadings( blocks );
if ( headings.length < 1 ) {
return (
Expand All @@ -141,8 +144,6 @@ export default function DocumentOutline( {
);
}

let prevHeadingLevel = 1;

// Not great but it's the simplest way to locate the title right now.
const titleNode = document.querySelector( '.editor-post-title__input' );
const hasTitle = isTitleSupported && title && titleNode;
Expand Down Expand Up @@ -172,15 +173,16 @@ export default function DocumentOutline( {
{ headings.map( ( item, index ) => {
// Headings remain the same, go up by one, or down by any amount.
// Otherwise there are missing levels.
const isIncorrectLevel = item.level > prevHeadingLevel + 1;
const isIncorrectLevel =
item.level > prevHeadingLevelRef.current + 1;

const isValid =
! item.isEmpty &&
! isIncorrectLevel &&
!! item.level &&
( item.level !== 1 ||
( ! hasMultipleH1 && ! hasTitle ) );
prevHeadingLevel = item.level;
prevHeadingLevelRef.current = item.level;

return (
<DocumentOutlineItem
Expand Down
Loading