Skip to content

Commit

Permalink
Upgrade wp-prettier to 2.2.1 (#27441)
Browse files Browse the repository at this point in the history
* Upgrade wp-prettier from 2.0.5 to 2.2.1

* Reformat codebase with wp-prettier 2.2.1
  • Loading branch information
jsnajdr committed Dec 3, 2020
1 parent 1541930 commit 9e7139a
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 54 deletions.
10 changes: 5 additions & 5 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 @@ -179,7 +179,7 @@
"patch-package": "6.2.2",
"postcss": "7.0.32",
"postcss-loader": "3.0.0",
"prettier": "npm:wp-prettier@2.0.5",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"progress": "2.0.3",
"puppeteer": "npm:puppeteer-core@3.0.0",
"react": "16.13.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/query/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe( 'Query block utils', () => {
expect( getTermsInfo( terms ) ).toEqual(
expect.objectContaining( {
mapById: expect.objectContaining( {
'4': expect.objectContaining( { name: 'nba' } ),
'11': expect.objectContaining( {
4: expect.objectContaining( { name: 'nba' } ),
11: expect.objectContaining( {
name: 'featured',
} ),
} ),
Expand Down
4 changes: 2 additions & 2 deletions packages/core-data/src/locks/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe( '__unstableIsLockAvailable', () => {
post: {
locks: [],
children: {
'16': {
16: {
locks: [
{
store: 'core',
Expand All @@ -145,7 +145,7 @@ describe( '__unstableIsLockAvailable', () => {
wp_template_part: {
locks: [],
children: {
'17': {
17: {
locks: [],
children: {},
},
Expand Down
40 changes: 20 additions & 20 deletions packages/data/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ export type WPDataFunctionOrGeneratorArray = Array< Function | Generator >;
export type WPDataFunctionArray = Array< Function >;

export interface WPDataAttachedStore {
getSelectors: () => WPDataFunctionArray,
getActions: () => WPDataFunctionArray,
subscribe: (listener: () => void) => (() => void)
};
getSelectors: () => WPDataFunctionArray;
getActions: () => WPDataFunctionArray;
subscribe: ( listener: () => void ) => () => void;
}

export interface WPDataStore {
/**
* Store Name
*/
name: string,
/**
* Store Name
*/
name: string;

/**
* Store configuration object.
*/
instantiate: (registry: WPDataRegistry) => WPDataAttachedStore,
};
/**
* Store configuration object.
*/
instantiate: ( registry: WPDataRegistry ) => WPDataAttachedStore;
}

export interface WPDataReduxStoreConfig {
reducer: ( state: any, action: any ) => any,
actions?: WPDataFunctionOrGeneratorArray,
resolvers?: WPDataFunctionOrGeneratorArray,
selectors?: WPDataFunctionArray,
controls?: WPDataFunctionArray,
reducer: ( state: any, action: any ) => any;
actions?: WPDataFunctionOrGeneratorArray;
resolvers?: WPDataFunctionOrGeneratorArray;
selectors?: WPDataFunctionArray;
controls?: WPDataFunctionArray;
}

export interface WPDataRegistry {
register: ( store: WPDataStore ) => void,
}
register: ( store: WPDataStore ) => void;
}
4 changes: 4 additions & 0 deletions packages/eslint-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Add `no-unsafe-wp-apis` rule to discourage usage of unsafe APIs ([#27301](https://github.com/WordPress/gutenberg/pull/27301)).

### Enhancements

- The bundled `wp-prettier` dependency has been upgraded from `2.0.5` to `2.2.1`.

### Documentation

- Include a note about the minimum version required for `node` (10.0.0) and `npm` (6.9.0).
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"globals": "^12.0.0",
"prettier": "npm:wp-prettier@2.0.5",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"requireindex": "^1.2.0"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Enhancements

- Autoformat TypeScript files (`*.ts` and `*.tsx`) in `format-js` script (#27138)[https://github.com/WordPress/gutenberg/pull/27138].
- The bundled `wp-prettier` dependency has been upgraded from `2.0.5` to `2.2.1`.

### Internal

Expand Down
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"minimist": "^1.2.0",
"npm-package-json-lint": "^5.0.0",
"postcss-loader": "^3.0.0",
"prettier": "npm:wp-prettier@2.0.5",
"prettier": "npm:wp-prettier@2.2.1-beta-1",
"puppeteer": "npm:puppeteer-core@3.0.0",
"read-pkg-up": "^1.0.1",
"resolve-bin": "^0.4.0",
Expand Down
36 changes: 15 additions & 21 deletions packages/shortcode/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,29 +90,23 @@ export function next( tag, text, index = 0 ) {
* @return {string} Text with shortcodes replaced.
*/
export function replace( tag, text, callback ) {
return text.replace( regexp( tag ), function (
match,
left,
$3,
attrs,
slash,
content,
closing,
right
) {
// If both extra brackets exist, the shortcode has been properly
// escaped.
if ( left === '[' && right === ']' ) {
return match;
}
return text.replace(
regexp( tag ),
function ( match, left, $3, attrs, slash, content, closing, right ) {
// If both extra brackets exist, the shortcode has been properly
// escaped.
if ( left === '[' && right === ']' ) {
return match;
}

// Create the match object and pass it through the callback.
const result = callback( fromMatch( arguments ) );
// Create the match object and pass it through the callback.
const result = callback( fromMatch( arguments ) );

// Make sure to return any of the extra brackets if they weren't used to
// escape the shortcode.
return result ? left + result + right : match;
} );
// Make sure to return any of the extra brackets if they weren't used to
// escape the shortcode.
return result ? left + result + right : match;
}
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/url/src/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ describe( 'getQueryArgs', () => {

expect( getQueryArgs( url ) ).toEqual( {
foo: {
'0': '0',
0: '0',
one: '1',
},
} );
Expand Down

0 comments on commit 9e7139a

Please sign in to comment.