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

Code quality: Fix typos #67304

Merged
merged 16 commits into from
Jan 6, 2025
Merged
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
4 changes: 2 additions & 2 deletions backport-changelog/readme.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ The filename is the Core PR number.

For example, if your Core PR number is `1234` and is slated to be part of the WordPress 6.9 release, the filename will be `1234.md`, and will be placed in the `/backport-changelog/6.9` directory.

The content of the markdown file should be the Github URL of the Core PR, followed by a list of Gutenberg PR Github URLs whose changes are backported in the Core PR.
The content of the markdown file should be the GitHub URL of the Core PR, followed by a list of Gutenberg PR GitHub URLs whose changes are backported in the Core PR.

A single Core PR may contain changes from one or multiple Gutenberg PRs.

@@ -51,7 +51,7 @@ For the backport changelog, Gutenberg uses individual files as opposed to a sing

Some Gutenberg PRs may be flagged as needing a core backport PR when they don't, for example when the PR contains minor comment changes, or the changes already exist in Core.

For individual PRs, there are two Github labels that can be used to exclude a PR from the backport changelog CI check:
For individual PRs, there are two GitHub labels that can be used to exclude a PR from the backport changelog CI check:

- `Backport from WordPress Core` - Indicates that the PR is a backport from WordPress Core and doesn't need a Core PR.
- `No Core Sync Required` - Indicates that any changes do not need to be synced to WordPress Core.
4 changes: 2 additions & 2 deletions bin/api-docs/gen-block-lib-list.js
Original file line number Diff line number Diff line change
@@ -108,12 +108,12 @@ function processObjWithInnerKeys( obj ) {
* not disabled. So adding { color: 'link' } support also brings along
* background and text.
*
* @param {Object} supports - keys supported by blokc
* @param {Object} supports - keys supported by block
* @return {Object} supports augmented with defaults
*/
function augmentSupports( supports ) {
if ( 'color' in supports ) {
// If backgroud or text is not specified (true or false)
// If background or text is not specified (true or false)
// then add it as true.a
if ( ! ( 'background' in supports.color ) ) {
supports.color.background = true;
8 changes: 4 additions & 4 deletions bin/plugin/commands/changelog.js
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ const LABEL_TYPE_MAPPING = {
};

/**
* Mapping of label names to arbitary features in the release notes.
* Mapping of label names to arbitrary features in the release notes.
*
* Mapping a given label to a feature will guarantee it will be categorised
* under that feature name in the changelog within each section.
@@ -274,7 +274,7 @@ function mapLabelsToFeatures( labels ) {
*
* @param {string[]} labels Label names.
*
* @return {boolean} whether or not the issue's is labbeled as block specific
* @return {boolean} whether or not the issue's is labeled as block specific
*/
function getIsBlockSpecificIssue( labels ) {
return !! labels.find( ( label ) => label.startsWith( '[Block] ' ) );
@@ -343,7 +343,7 @@ function getIssueFeature( issue ) {

// 1. Prefer explicit mapping of label to feature.
if ( featureCandidates.length ) {
// Get occurances of the feature labels.
// Get occurrences of the feature labels.
const featureCounts = featureCandidates.reduce(
/**
* @param {Record<string,number>} acc Accumulator
@@ -941,7 +941,7 @@ function skipCreatedByBots( pullRequests ) {
}

/**
* Produces the formatted markdown for the contributor props seciton.
* Produces the formatted markdown for the contributor props section.
*
* @param {IssuesListForRepoResponseItem[]} pullRequests List of pull requests.
*
2 changes: 1 addition & 1 deletion bin/plugin/commands/test/changelog.js
Original file line number Diff line number Diff line change
@@ -260,7 +260,7 @@ describe( 'getIssueFeature', () => {
name: '[Package] This package',
},
{
name: '[Feature] Cool Feature', // Should have priority despite prescence of block specific label.
name: '[Feature] Cool Feature', // Should have priority despite presence of block specific label.
},
{
name: '[Package] Another One',
2 changes: 1 addition & 1 deletion docs/contributors/code/release.md
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ It's important to check that:
- the plugin from the directory works as expected
- the ZIP contents (see [Downloads](https://plugins.trac.wordpress.org/browser/gutenberg/)) looks correct (doesn't have anything obvious missing)
- the [Gutenberg SVN repo](https://plugins.trac.wordpress.org/browser/gutenberg/) has two new commits (see [the log](https://plugins.trac.wordpress.org/browser/gutenberg/)):
- the `trunk` folder should have "Commiting version X.Y.Z"
- the `trunk` folder should have "Committing version X.Y.Z"
- there is a new `tags/X.Y.Z` folder with the same contents as `trunk` whose latest commit is "Tagging version X.Y.Z"

Most likely, the tag folder couldn't be created. This is a [known issue](https://plugins.trac.wordpress.org/browser/gutenberg/) that [can be fixed manually](https://github.com/WordPress/gutenberg/issues/55295#issuecomment-1759292978).
2 changes: 1 addition & 1 deletion docs/reference-guides/block-api/block-bindings.md
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ The function to register a custom source is `registerBlockBindingsSource( args )

- `args`: `object` with the following structure:
- `name`: `string` with the unique and machine-readable name.
- `label`: `string` with the human readable name of the custom source. In case it was defined already on the server, the server label will be overriden by this one, in that case, it is not recommended to be defined here. (optional)
- `label`: `string` with the human readable name of the custom source. In case it was defined already on the server, the server label will be overridden by this one, in that case, it is not recommended to be defined here. (optional)
- `usesContext`: `array` with the block context that the custom source may need. In case it was defined already on the server, it should not be defined here. (optional)
- `getValues`: `function` that retrieves the values from the source. (optional)
- `setValues`: `function` that allows updating the values connected to the source. (optional)
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
@@ -714,7 +714,7 @@ Returns the list of patterns based on their declared `blockTypes` and a block's
_Parameters_

- _state_ `Object`: Editor state.
- _blockNames_ `string|string[]`: Block's name or array of block names to find matching pattens.
- _blockNames_ `string|string[]`: Block's name or array of block names to find matching patterns.
- _rootClientId_ `?string`: Optional target root client ID.

_Returns_
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core.md
Original file line number Diff line number Diff line change
@@ -878,7 +878,7 @@ _Returns_

### redo

Action triggered to redo the last undoed edit to an entity record, if any.
Action triggered to redo the last undone edit to an entity record, if any.

### saveEditedEntityRecord

Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ These are the core principles of TypeScript's interaction with the Interactivity

- **Inferred client types**: When you create a store using the `store` function, TypeScript automatically infers the types of the store's properties (`state`, `actions`, etc.). This means that you can often get away with just writing plain JavaScript objects, and TypeScript will figure out the types for you.
- **Explicit server types**: When dealing with data defined on the server, like local context or the initial values of the global state, you can explicitly define its types to ensure that everything is correctly typed.
- **Mutiple store parts**: Even if your store is split into multiple parts, you can define or infer the types of each part of the store and then merge them into a single type that represents the entire store.
- **Multiple store parts**: Even if your store is split into multiple parts, you can define or infer the types of each part of the store and then merge them into a single type that represents the entire store.
- **Typed external stores**: You can import typed stores from external namespaces, allowing you to use other plugins' functionality with type safety.

## Installing `@wordpress/interactivity` locally
@@ -495,7 +495,7 @@ There's something to keep in mind when when using asynchronous actions. Just lik
counter: 0,
},
actions: {
*delayedReturn(): Generator< uknown, number, uknown > {
*delayedReturn(): Generator< unknown, number, unknown > {
yield new Promise( ( r ) => setTimeout( r, 1000 ) );
return state.counter; // Now this is correctly inferred.
},
2 changes: 1 addition & 1 deletion docs/reference-guides/interactivity-api/iapi-about.md
Original file line number Diff line number Diff line change
@@ -186,7 +186,7 @@ Additionally, with a standard, **WordPress can absorb the maximum amount of comp

_Complexities absorbed by the standard_

<img alt="Two columns table comparing some aspects with and without a standard. Without a standard, block developers have to take care of everything, while having a standard. Totally handled by the standard: Tooling, hydration, integrating it with WordPress, SSR of the interactive parts, inter-block communication, and frontend performance. Partially handled: Security, accessibility, and best practices. Developer responsibility: Block logic. In the without a standard column, everything is under the developer responsability." width=60% src="https://make.wordpress.org/core/files/2023/03/standard-graph.png">
<img alt="Two columns table comparing some aspects with and without a standard. Without a standard, block developers have to take care of everything, while having a standard. Totally handled by the standard: Tooling, hydration, integrating it with WordPress, SSR of the interactive parts, inter-block communication, and frontend performance. Partially handled: Security, accessibility, and best practices. Developer responsibility: Block logic. In the without a standard column, everything is under the developer responsibility." width=60% src="https://make.wordpress.org/core/files/2023/03/standard-graph.png">


With this absorption, less knowledge is required to create interactive blocks, and developers have fewer decisions to worry about.
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
@@ -3419,7 +3419,7 @@ protected static function should_override_preset( $theme_json, $path, $override

/**
* Returns the default slugs for all the presets in an associative array
* whose keys are the preset paths and the leafs is the list of slugs.
* whose keys are the preset paths and the leaves is the list of slugs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This typo is already fixed in the core, so a backport changelog should not be necessary.

https://github.com/WordPress/wordpress-develop/blob/07be2445e45066147105206da08acf31bcee974d/src/wp-includes/class-wp-theme-json.php#L3386

*
* For example:
*
8 changes: 4 additions & 4 deletions lib/experimental/media/load.php
Original file line number Diff line number Diff line change
@@ -302,24 +302,24 @@ function gutenberg_add_crossorigin_attributes( string $html ): string {

$processor->set_bookmark( 'resume' );

$seeked = false;
$sought = false;

$crossorigin = $processor->get_attribute( 'crossorigin' );

$url = $processor->get_attribute( $tags[ $tag ] );

if ( is_string( $url ) && ! str_starts_with( $url, $site_url ) && ! str_starts_with( $url, '/' ) && ! is_string( $crossorigin ) ) {
if ( 'SOURCE' === $tag ) {
$seeked = $processor->seek( 'audio-video-parent' );
$sought = $processor->seek( 'audio-video-parent' );

if ( $seeked ) {
if ( $sought ) {
$processor->set_attribute( 'crossorigin', 'anonymous' );
}
} else {
$processor->set_attribute( 'crossorigin', 'anonymous' );
}

if ( $seeked ) {
if ( $sought ) {
$processor->seek( 'resume' );
$processor->release_bookmark( 'audio-video-parent' );
}
2 changes: 1 addition & 1 deletion lib/experimental/sync/README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

The signaling server allows multiple clients to exchange messages with each other through various communication topics.

Topics are not defined upfront, but clients define them by subscribing to them. By subscribing to a given topic, the client tells the server to keep track of its unread messages in the given topic. By unsubscribing from a topic, the client tells the server to free the bookeeping it maintains for the given client and topic.
Topics are not defined upfront, but clients define them by subscribing to them. By subscribing to a given topic, the client tells the server to keep track of its unread messages in the given topic. By unsubscribing from a topic, the client tells the server to free the bookkeeping it maintains for the given client and topic.

Every client communicates with the server via `GET` or `POST`. Clients must have a unique identifier, which can be randomly generated. This identifier should be included as a parameter named `subscriber_id` in every request.

4 changes: 2 additions & 2 deletions packages/babel-plugin-makepot/index.js
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ const REGEXP_TRANSLATOR_COMMENT = /^\s*translators:\s*([\s\S]+)/im;

/**
* Given an argument node (or recursed node), attempts to return a string
* represenation of that node's value.
* representation of that node's value.
*
* @param {Object} node AST node.
*
@@ -265,7 +265,7 @@ module.exports = () => {
);
}

// Attempt to exract nplurals from header.
// Attempt to extract nplurals from header.
const pluralsMatch = (
baseData.headers[ 'plural-forms' ] || ''
).match( /nplurals\s*=\s*(\d+);/ );
2 changes: 1 addition & 1 deletion packages/base-styles/_variables.scss
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ $radio-input-size: 16px;
$radio-input-size-sm: 24px; // Width & height for small viewports.

// Deprecated, please avoid using these.
$block-padding: 14px; // Used to define space between block footprint and surrouding borders.
$block-padding: 14px; // Used to define space between block footprint and surrounding borders.
$radius-block-ui: $radius-small;
$shadow-popover: $elevation-x-small;
$shadow-modal: $elevation-large;
2 changes: 1 addition & 1 deletion packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@

### Enhancements

- Embed the `ObserveTyping` behavior within the `BlockList` component making to simplify instanciations of third-party block editors.
- Embed the `ObserveTyping` behavior within the `BlockList` component making to simplify instantiations of third-party block editors.

## 12.8.0 (2023-08-16)

Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
svg {
fill: currentColor;

// Optimizate for high contrast modes.
// Optimize for high contrast modes.
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
@media (forced-colors: active) {
fill: CanvasText;
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
svg {
fill: currentColor;

// Optimizate for high contrast modes.
// Optimize for high contrast modes.
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
@media (forced-colors: active) {
fill: CanvasText;
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ export function useFocusHandler( clientId ) {
return;
}

// If an inner block is focussed, that block is resposible for
// If an inner block is focussed, that block is responsible for
// setting the selected block.
if ( ! isInsideRootBlock( node, event.target ) ) {
return;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// These rules ensure the preview scales smoothly regardless of the container size.
.block-editor-block-preview__container {
// In the component, a top padding is provided as an inline style to provid an aspect-ratio.
// In the component, a top padding is provided as an inline style to provide an aspect-ratio.
// This positioning enables the content to sit on top of that padding to fit.
position: relative;

Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ function StylePreview( { onPress, isActive, style, url } ) {

function onLayout() {
const columnsNum =
// To indicate scroll availabilty, there is a need to display additional half the column.
// To indicate scroll availability, there is a need to display additional half the column.
Math.floor( BottomSheet.getWidth() / MAX_ITEM_WIDTH ) + HALF_COLUMN;
setItemWidth( BottomSheet.getWidth() / columnsNum );
}
Original file line number Diff line number Diff line change
@@ -27,20 +27,20 @@ import BlockVariationTransformations from './block-variation-transformations';
* @return {Record<string, Object[]>} The grouped block transformations.
*/
function useGroupedTransforms( possibleBlockTransformations ) {
const priorityContentTranformationBlocks = {
const priorityContentTransformationBlocks = {
'core/paragraph': 1,
'core/heading': 2,
'core/list': 3,
'core/quote': 4,
};
const transformations = useMemo( () => {
const priorityTextTranformsNames = Object.keys(
priorityContentTranformationBlocks
const priorityTextTransformsNames = Object.keys(
priorityContentTransformationBlocks
);
const groupedPossibleTransforms = possibleBlockTransformations.reduce(
( accumulator, item ) => {
const { name } = item;
if ( priorityTextTranformsNames.includes( name ) ) {
if ( priorityTextTransformsNames.includes( name ) ) {
accumulator.priorityTextTransformations.push( item );
} else {
accumulator.restTransformations.push( item );
@@ -71,8 +71,8 @@ function useGroupedTransforms( possibleBlockTransformations ) {
// Order the priority text transformations.
transformations.priorityTextTransformations.sort(
( { name: currentName }, { name: nextName } ) => {
return priorityContentTranformationBlocks[ currentName ] <
priorityContentTranformationBlocks[ nextName ]
return priorityContentTransformationBlocks[ currentName ] <
priorityContentTransformationBlocks[ nextName ]
? -1
: 1;
}
@@ -125,7 +125,7 @@ const BlockTransformationsMenu = ( {
/>
) }
{ priorityTextTransformations.map( ( item ) => (
<BlockTranformationItem
<BlockTransformationItem
key={ item.name }
item={ item }
onSelect={ onSelect }
@@ -151,7 +151,7 @@ function RestTransformationItems( {
setHoveredTransformItemName,
} ) {
return restTransformations.map( ( item ) => (
<BlockTranformationItem
<BlockTransformationItem
key={ item.name }
item={ item }
onSelect={ onSelect }
@@ -160,7 +160,7 @@ function RestTransformationItems( {
) );
}

function BlockTranformationItem( {
function BlockTransformationItem( {
item,
onSelect,
setHoveredTransformItemName,
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ const BlockVariationTransformations = ( {
/>
) }
{ transformations?.map( ( item ) => (
<BlockVariationTranformationItem
<BlockVariationTransformationItem
key={ item.name }
item={ item }
onSelect={ onSelect }
@@ -85,7 +85,7 @@ const BlockVariationTransformations = ( {
);
};

function BlockVariationTranformationItem( {
function BlockVariationTransformationItem( {
item,
onSelect,
setHoveredTransformItemName,
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ function BlockSwitcherDropdownMenuContents( {
);
}
}
// Simple block tranformation based on the `Block Transforms` API.
// Simple block transformation based on the `Block Transforms` API.
function onBlockTransform( name ) {
const newBlocks = switchToBlockType( blocks, name );
replaceBlocks( clientIds, newBlocks );
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ export const getPatternTransformedBlocks = (
// No need to loop through other pattern's blocks.
break;
}
// Bail eary if a selected block has not been matched.
// Bail early if a selected block has not been matched.
if ( ! isMatch ) {
return;
}
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import UngroupButton from '../ungroup-button';
import { BlockSettingsButton } from '../block-settings';
import { store as blockEditorStore } from '../../store';

const REMOVE_EMPY_PARENT_BLOCKS = [
const REMOVE_EMPTY_PARENT_BLOCKS = [
'core/buttons',
'core/columns',
'core/social-links',
@@ -69,7 +69,7 @@ export default function BlockToolbar( { anchorNodeRef } ) {
// have inner blocks, ideally we should match the behavior as in
// the Web editor and show a placeholder instead of removing the parent.
if (
REMOVE_EMPY_PARENT_BLOCKS.includes( parentBlockName ) &&
REMOVE_EMPTY_PARENT_BLOCKS.includes( parentBlockName ) &&
parentNumberOfInnerBlocks === 1
) {
removeBlock( rootClientId );
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import {
} from '@wordpress/components';

// So that we illustrate the different formats in the dropdown properly, show a date that is
// somwhat recent, has a day greater than 12, and a month with more than three letters.
// somewhat recent, has a day greater than 12, and a month with more than three letters.
const exampleDate = new Date();
exampleDate.setDate( 20 );
exampleDate.setMonth( exampleDate.getMonth() - 3 );
Loading