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

Upgrade wp-prettier to 2.6.2 #40542

Merged
merged 8 commits into from Jun 14, 2022
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.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions bin/check-latest-npm.js
Expand Up @@ -69,15 +69,16 @@ async function getLatestNPMVersion() {
/** @type {NodeJS.ErrnoException} */ ( error ).code ===
'ENOTFOUND'
) {
error = new Error( `Could not contact the npm registry to determine latest version.
error =
new Error( `Could not contact the npm registry to determine latest version.

This could be due to an intermittent outage of the service, or because you are not connected to the internet.

Because it is important that \`package-lock.json\` files only be committed while running the latest version of npm, this commit has been blocked.

If you are certain of your changes and desire to commit anyways, you should either connect to the internet or bypass commit verification using ${ yellow(
'git commit --no-verify'
) } .` );
'git commit --no-verify'
) } .` );
}

reject( error );
Expand Down
12 changes: 6 additions & 6 deletions bin/packages/build.js
Expand Up @@ -69,9 +69,8 @@ function isFileImportedInStyleEntry( file, importStatements ) {
function findStyleEntriesThatImportFile( file ) {
const entriesWithImport = stylesheetEntryPoints.reduce(
( acc, entryPoint ) => {
const styleEntryImportStatements = parseImportStatements(
entryPoint
);
const styleEntryImportStatements =
parseImportStatements( entryPoint );

if (
isFileImportedInStyleEntry( file, styleEntryImportStatements )
Expand Down Expand Up @@ -161,9 +160,10 @@ function createBlockJsonEntryTransform() {
return new Transform( {
objectMode: true,
async transform( file, encoding, callback ) {
const matches = /block-library[\/\\]src[\/\\](.*)[\/\\]block.json$/.exec(
file
);
const matches =
/block-library[\/\\]src[\/\\](.*)[\/\\]block.json$/.exec(
file
);
const blockName = matches ? matches[ 1 ] : undefined;

// Only block.json files in the block-library folder are subject to this transform.
Expand Down
4 changes: 2 additions & 2 deletions bin/packages/validate-typescript-version.js
Expand Up @@ -6,8 +6,8 @@ const tscDetectedVersion = require( 'typescript' ).version;
/**
* Internal dependencies
*/
const tscDependencyVersion = require( '../../package.json' ).devDependencies
.typescript;
const tscDependencyVersion =
require( '../../package.json' ).devDependencies.typescript;

if ( tscDependencyVersion !== tscDetectedVersion ) {
console.error(
Expand Down
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
Expand Up @@ -207,7 +207,7 @@
"patch-package": "6.2.2",
"postcss": "8.4.5",
"postcss-loader": "6.2.1",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"prettier": "npm:wp-prettier@2.6.2",
"progress": "2.0.3",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
9 changes: 4 additions & 5 deletions packages/a11y/src/test/index.test.js
Expand Up @@ -112,12 +112,11 @@ describe( 'speak', () => {

describe( 'setup when the elements already exist', () => {
it( 'should not create the aria live regions again', () => {
const before = document.getElementsByClassName(
'a11y-speak-region'
).length;
const before =
document.getElementsByClassName( 'a11y-speak-region' ).length;
setup();
const after = document.getElementsByClassName( 'a11y-speak-region' )
.length;
const after =
document.getElementsByClassName( 'a11y-speak-region' ).length;

expect( before ).toBe( after );
} );
Expand Down
7 changes: 4 additions & 3 deletions packages/annotations/src/block/index.js
Expand Up @@ -16,9 +16,10 @@ import { STORE_NAME } from '../store/constants';
*/
const addAnnotationClassName = ( OriginalComponent ) => {
return withSelect( ( select, { clientId, className } ) => {
const annotations = select(
STORE_NAME
).__experimentalGetAnnotationsForBlock( clientId );
const annotations =
select( STORE_NAME ).__experimentalGetAnnotationsForBlock(
clientId
);

return {
className: annotations
Expand Down
15 changes: 6 additions & 9 deletions packages/annotations/src/format/annotation.js
Expand Up @@ -168,20 +168,17 @@ export const annotation = {
},
__experimentalGetPropsForEditableTreeChangeHandler( dispatch ) {
return {
removeAnnotation: dispatch( STORE_NAME )
.__experimentalRemoveAnnotation,
updateAnnotationRange: dispatch( STORE_NAME )
.__experimentalUpdateAnnotationRange,
removeAnnotation:
dispatch( STORE_NAME ).__experimentalRemoveAnnotation,
updateAnnotationRange:
dispatch( STORE_NAME ).__experimentalUpdateAnnotationRange,
};
},
__experimentalCreateOnChangeEditableValue( props ) {
return ( formats ) => {
const positions = retrieveAnnotationPositions( formats );
const {
removeAnnotation,
updateAnnotationRange,
annotations,
} = props;
const { removeAnnotation, updateAnnotationRange, annotations } =
props;

updateAnnotationsWithPositions( annotations, positions, {
removeAnnotation,
Expand Down
12 changes: 6 additions & 6 deletions packages/api-fetch/src/index.js
Expand Up @@ -157,12 +157,12 @@ function apiFetch( options ) {
// ```
// opts1 => m1( opts1, opts2 => m2( opts2, opts3 => m3( opts3, fetchHandler ) ) );
// ```
const enhancedHandler = middlewares.reduceRight( (
/** @type {FetchHandler} */ next,
middleware
) => {
return ( workingOptions ) => middleware( workingOptions, next );
}, fetchHandler );
const enhancedHandler = middlewares.reduceRight(
( /** @type {FetchHandler} */ next, middleware ) => {
return ( workingOptions ) => middleware( workingOptions, next );
},
fetchHandler
);

return enhancedHandler( options ).catch( ( error ) => {
if ( error.code !== 'rest_cookie_invalid_nonce' ) {
Expand Down
40 changes: 16 additions & 24 deletions packages/api-fetch/src/middlewares/test/preloading.js
Expand Up @@ -16,9 +16,8 @@ describe( 'Preloading Middleware', () => {
body,
},
};
const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );
const requestOptions = {
method: 'GET',
path: 'wp/v2/posts',
Expand All @@ -41,9 +40,8 @@ describe( 'Preloading Middleware', () => {
body,
},
};
const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );
const requestOptions = {
method: 'GET',
path: 'wp/v2/posts',
Expand Down Expand Up @@ -85,9 +83,8 @@ describe( 'Preloading Middleware', () => {
},
};

const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );

const requestOptions = {
method: 'OPTIONS',
Expand Down Expand Up @@ -120,9 +117,8 @@ describe( 'Preloading Middleware', () => {
},
};

const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );

const requestOptions = {
method: 'OPTIONS',
Expand All @@ -148,9 +144,8 @@ describe( 'Preloading Middleware', () => {
body,
},
};
const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );
const requestOptions = {
method: 'GET',
path: 'wp/v2/fake_resource',
Expand All @@ -169,9 +164,8 @@ describe( 'Preloading Middleware', () => {
'wp/v2/demo-reverse-alphabetical?foo=bar&baz=quux': { body },
'wp/v2/demo-alphabetical?baz=quux&foo=bar': { body },
};
const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );

let requestOptions = {
method: 'GET',
Expand Down Expand Up @@ -252,9 +246,8 @@ describe( 'Preloading Middleware', () => {
},
};

const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );

const requestOptions = {
method: 'OPTIONS',
Expand All @@ -278,9 +271,8 @@ describe( 'Preloading Middleware', () => {
[ 'method empty', { [ method ]: {} } ],
] )( '%s', ( label, preloadedData ) => {
it( 'should move to the next middleware if no preloaded data', () => {
const preloadingMiddleware = createPreloadingMiddleware(
preloadedData
);
const preloadingMiddleware =
createPreloadingMiddleware( preloadedData );
const requestOptions = {
method,
path: 'wp/v2/posts',
Expand Down
10 changes: 4 additions & 6 deletions packages/babel-plugin-import-jsx-pragma/index.js
Expand Up @@ -48,9 +48,8 @@ module.exports = ( babel ) => {
}

const { scopeVariable } = getOptions( state );
state.hasUndeclaredScopeVariable = ! path.scope.hasBinding(
scopeVariable
);
state.hasUndeclaredScopeVariable =
! path.scope.hasBinding( scopeVariable );
},
JSXFragment( path, state ) {
if ( state.hasUndeclaredScopeVariableFrag ) {
Expand All @@ -62,9 +61,8 @@ module.exports = ( babel ) => {
return;
}

state.hasUndeclaredScopeVariableFrag = ! path.scope.hasBinding(
scopeVariableFrag
);
state.hasUndeclaredScopeVariableFrag =
! path.scope.hasBinding( scopeVariableFrag );
},
Program: {
exit( path, state ) {
Expand Down
27 changes: 13 additions & 14 deletions packages/babel-plugin-makepot/index.js
Expand Up @@ -332,10 +332,8 @@ module.exports = () => {
forEach(
sortedTranslations,
( translation ) => {
const {
msgctxt = '',
msgid,
} = translation;
const { msgctxt = '', msgid } =
translation;
if (
! memo.hasOwnProperty( msgctxt )
) {
Expand All @@ -349,16 +347,17 @@ module.exports = () => {
memo[ msgctxt ][ msgid ]
)
) {
translation.comments.reference = uniq(
[
memo[ msgctxt ][ msgid ]
.comments.reference,
translation.comments
.reference,
]
.join( '\n' )
.split( '\n' )
).join( '\n' );
translation.comments.reference =
uniq(
[
memo[ msgctxt ][ msgid ]
.comments.reference,
translation.comments
.reference,
]
.join( '\n' )
.split( '\n' )
).join( '\n' );
}

memo[ msgctxt ][ msgid ] = translation;
Expand Down
Expand Up @@ -69,10 +69,8 @@ function DownloadableBlockListItem( { composite, item, onClick } ) {

const { hasNotice, isInstalling, isInstallable } = useSelect(
( select ) => {
const {
getErrorNoticeForBlock,
isInstalling: isBlockInstalling,
} = select( blockDirectoryStore );
const { getErrorNoticeForBlock, isInstalling: isBlockInstalling } =
select( blockDirectoryStore );
const notice = getErrorNoticeForBlock( item.id );
const hasFatal = notice && notice.isFatal;
return {
Expand Down
Expand Up @@ -71,10 +71,8 @@ function DownloadableBlocksPanel( {

export default compose( [
withSelect( ( select, { filterValue, rootClientId = null } ) => {
const {
getDownloadableBlocks,
isRequestingDownloadableBlocks,
} = select( blockDirectoryStore );
const { getDownloadableBlocks, isRequestingDownloadableBlocks } =
select( blockDirectoryStore );
const { canInsertBlockType } = select( blockEditorStore );

const hasPermission = select( coreStore ).canUser(
Expand Down