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

Updated @wordpress/eslint-plugin to 5.0.1 #454

Merged
merged 2 commits into from
Apr 17, 2020
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
414 changes: 237 additions & 177 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"@wordpress/browserslist-config": "^2.6.0",
"@wordpress/eslint-plugin": "^3.4.1",
"@wordpress/eslint-plugin": "^5.0.1",
"eslint": "^6.8.0",
"eslint-plugin-compat": "^3.5.1",
"gulp": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/d.ts/GalleryResponse.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare interface GallerySuccessResponse extends PageSuccessResponse {
path: Array<PartialDirectory>;
path: Array< PartialDirectory >;
}

declare type GalleryResponse = GallerySuccessResponse | ErrorResponse;
2 changes: 1 addition & 1 deletion src/d.ts/ListGalleryDirResponse.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare interface ListGalleryDirSuccessResponse {
directories: Array<string>;
directories: Array< string >;
}

type ListGalleryDirResponse = ListGalleryDirSuccessResponse | ErrorResponse;
8 changes: 5 additions & 3 deletions src/d.ts/ListGdriveDirResponse.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
declare interface ListGdriveDirSuccessResponse {
directories: Array<PartialDirectory>;
path: Array<string>;
directories: Array< PartialDirectory >;
path: Array< string >;
resetWarn: string;
}

declare type ListGdriveDirResponse = ListGdriveDirSuccessResponse | ErrorResponse;
declare type ListGdriveDirResponse =
| ListGdriveDirSuccessResponse
| ErrorResponse;
6 changes: 3 additions & 3 deletions src/d.ts/PageResponse.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
declare interface PageSuccessResponse {
directories: Array<Directory>;
images: Array<Image>;
directories: Array< Directory >;
images: Array< Image >;
more: boolean;
videos: Array<Video>;
videos: Array< Video >;
}

type PageResponse = PageSuccessResponse | ErrorResponse;
4 changes: 2 additions & 2 deletions src/d.ts/ShortcodeToBlockTransformAttributes.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare interface ShortcodeToBlockTransformAttributes {
named: Record<string, string>;
numeric: Array<string>;
named: Record< string, string >;
numeric: Array< string >;
}
17 changes: 10 additions & 7 deletions src/d.ts/justified-layout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ declare module 'justified-layout' {

interface Config {
containerWidth: number;
containerPadding: number|ContainerPadding;
boxSpacing: number|BoxSpacing;
containerPadding: number | ContainerPadding;
boxSpacing: number | BoxSpacing;
targetRowHeight: number;
targetRowHeightTolerance: number;
maxNumRows: number;
forceAspectRatio: boolean|number;
forceAspectRatio: boolean | number;
showWidows: boolean;
fullWidthBreakoutRowCadence: boolean|number;
widowLayoutStyle: 'left'|'justify'|'center';
fullWidthBreakoutRowCadence: boolean | number;
widowLayoutStyle: 'left' | 'justify' | 'center';
edgeCaseMinRowHeight: number;
edgeCaseMaxRowHeight: number;
}
Expand All @@ -42,10 +42,13 @@ declare module 'justified-layout' {
interface Result {
containerHeight: number;
widowCount: number;
boxes: Array<Box>;
boxes: Array< Box >;
}

function convertSizesToAspectRatios( input: Array<number>|Array<SizeObject>, config: Partial<Config> ): Result;
function convertSizesToAspectRatios(
input: Array< number > | Array< SizeObject >,
config: Partial< Config >
): Result;

export = convertSizesToAspectRatios;
}
15 changes: 12 additions & 3 deletions src/d.ts/sgdgBlockLocalize.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
type BlockOptions = 'grid_height'|'grid_spacing'|'dir_counts'|'page_size'|'page_autoload'|'preview_size'|'preview_loop';
type BlockOptions =
| 'grid_height'
| 'grid_spacing'
| 'dir_counts'
| 'page_size'
| 'page_autoload'
| 'preview_size'
| 'preview_loop';

type BlockOrderingOptions = 'image_ordering'|'dir_ordering';
type BlockOrderingOptions = 'image_ordering' | 'dir_ordering';

declare interface BlockOption {
default: string;
Expand Down Expand Up @@ -28,4 +35,6 @@ interface SgdgBlockLocalize {
ordering_option_by_name: string;
}

declare const sgdgBlockLocalize: SgdgBlockLocalize & Record<BlockOptions, BlockOption> & Record<BlockOrderingOptions, BlockOrderingOption>;
declare const sgdgBlockLocalize: SgdgBlockLocalize &
Record< BlockOptions, BlockOption > &
Record< BlockOrderingOptions, BlockOrderingOption >;
2 changes: 1 addition & 1 deletion src/d.ts/sgdgRootpathLocalize.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare const sgdgRootpathLocalize: {
ajax_url: string;
nonce: string;
root_dir: Array<string>;
root_dir: Array< string >;
drive_list: string;
};
8 changes: 6 additions & 2 deletions src/d.ts/thickbox.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
declare function tb_show( caption: string, url: string, imageGroup?: string ): void // eslint-disable-line @typescript-eslint/camelcase
declare function tb_show( // eslint-disable-line @typescript-eslint/camelcase
caption: string,
url: string,
imageGroup?: string
): void;

declare function tb_remove(): false // eslint-disable-line @typescript-eslint/camelcase
declare function tb_remove(): false; // eslint-disable-line @typescript-eslint/camelcase
2 changes: 1 addition & 1 deletion src/d.ts/tinymce.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
declare const tinymce: import( 'tinymce' ).EditorManager;
declare const tinymce: import('tinymce').EditorManager;
8 changes: 4 additions & 4 deletions src/d.ts/wp.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare const wp: {
blocks: typeof import( 'wordpress__blocks' );
components: typeof import( 'wordpress__components' );
editor: typeof import( 'wordpress__editor' );
element: typeof import( 'wordpress__element' );
blocks: typeof import('wordpress__blocks');
components: typeof import('wordpress__components');
editor: typeof import('wordpress__editor');
element: typeof import('wordpress__element');
};
79 changes: 51 additions & 28 deletions src/ts/admin/root_selection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
jQuery( document ).ready( function( $ ) {
let path: Array<string> = sgdgRootpathLocalize.root_dir;
let path: Array< string > = sgdgRootpathLocalize.root_dir;

function resetWarn( message: string ): void {
const html = '<div class="notice notice-warning">' +
'<p>' + message + '</p>' +
'</div>';
const html =
'<div class="notice notice-warning">' +
'<p>' +
message +
'</p>' +
'</div>';
$( html ).insertBefore( '.sgdg_root_selection' );
}

Expand All @@ -27,22 +30,33 @@ jQuery( document ).ready( function( $ ) {
function success( data: ListGdriveDirSuccessResponse ): void {
let html = '';
if ( 0 < path.length ) {
html += '<tr>' +
html +=
'<tr>' +
'<td class="row-title">' +
'<label>..</label>' +
'<label>' +
'..' +
'</label>' +
'</td>' +
'</tr>';
'</tr>';
}
for ( let i = 0; i < data.directories.length; i++ ) {
html += '<tr class="';
if ( ( 0 === path.length && 1 === i % 2 ) || ( 0 < path.length && 0 === i % 2 ) ) {
if (
( 0 === path.length && 1 === i % 2 ) ||
( 0 < path.length && 0 === i % 2 )
) {
html += 'alternate';
}
html += '">' +
html +=
'">' +
'<td class="row-title">' +
'<label data-id="' + data.directories[ i ].id + '">' + data.directories[ i ].name + '</label>' +
'<label data-id="' +
data.directories[ i ].id +
'">' +
data.directories[ i ].name +
'</label>' +
'</td>' +
'</tr>';
'</tr>';
}
$( '#sgdg_root_selection_body' ).html( html );

Expand All @@ -69,30 +83,39 @@ jQuery( document ).ready( function( $ ) {
}

function error( message: string ): void {
const html = '<div class="notice notice-error"><p>' + message + '</p></div>';
const html =
'<div class="notice notice-error">' +
'<p>' +
message +
'</p>' +
'</div>';
$( '.sgdg_root_selection' ).replaceWith( html );
}

function listGdriveDir(): void {
$( '#sgdg_root_selection_body' ).html( '' );
$( '#submit' ).attr( 'disabled', 'disabled' );
$.get( sgdgRootpathLocalize.ajax_url, {
_ajax_nonce: sgdgRootpathLocalize.nonce, // eslint-disable-line @typescript-eslint/camelcase
action: 'list_gdrive_dir',
path,
}, function( data: ListGdriveDirResponse ) {
if ( isError( data ) ) {
error( data.error );
return;
$.get(
sgdgRootpathLocalize.ajax_url,
{
_ajax_nonce: sgdgRootpathLocalize.nonce, // eslint-disable-line @typescript-eslint/camelcase
action: 'list_gdrive_dir',
path,
},
function( data: ListGdriveDirResponse ) {
if ( isError( data ) ) {
error( data.error );
return;
}
if ( data.resetWarn ) {
path = [];
resetWarn( data.resetWarn );
}
if ( data.directories ) {
success( data );
}
}
if ( data.resetWarn ) {
path = [];
resetWarn( data.resetWarn );
}
if ( data.directories ) {
success( data );
}
} );
);
}

listGdriveDir();
Expand Down
Loading