Skip to content

Commit 9027d10

Browse files
committed
Prettier, eslint, ts auto and manual fixes
1 parent 469c3fc commit 9027d10

File tree

199 files changed

+2292
-997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+2292
-997
lines changed

Diff for: Gruntfile.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ module.exports = function( grunt ) {
187187
// Register custom tasks.
188188
grunt.registerTask( 'icon_mapping', 'Turn codepoints into JSON', () => {
189189
const filePath = 'plugin/assets/fonts/icons.json';
190-
const iconFile = grunt.file.read( 'plugin/assets/fonts/icons.codepoints' );
190+
const iconFile = grunt.file.read(
191+
'plugin/assets/fonts/icons.codepoints'
192+
);
191193
const iconItems = iconFile.split( /\r?\n/g );
192194
const icons = {
193195
icons: {},

Diff for: plugin/assets/src/admin/index.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const initNotificationActions = () => {
3939
}
4040

4141
actionButton.addEventListener( 'click', event => {
42-
const className = event.target.className,
42+
const className = event?.target?.className,
4343
matches = ( className || '' ).match(
4444
/material-design-(install|activate)/
4545
);
@@ -77,10 +77,17 @@ const initNotificationActions = () => {
7777
apiFetch( requestArgs )
7878
.then( () => {
7979
if ( 'install' === action ) {
80-
requestArgs.path = `${ getConfig( 'restPath' ) }activate-theme`;
80+
requestArgs.path = `${ getConfig(
81+
'restPath'
82+
) }activate-theme`;
8183

8284
apiFetch( requestArgs )
83-
.then( () => ( window.location.href = getConfig( 'redirect' ) ) )
85+
.then(
86+
() =>
87+
( window.location.href = getConfig(
88+
'redirect'
89+
) )
90+
)
8491
.catch( error => console.error( error ) );
8592
} else {
8693
window.location.href = getConfig( 'redirect' );

Diff for: plugin/assets/src/block-editor/blocks/button/edit.js

+83-14
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,20 @@ import { name as ContactFormBlockName } from '../contact-form';
5656

5757
/**
5858
* Small component which either renders an icon button or a text button.
59+
*
60+
* @param {Object} props
61+
* @param {string} props.type
62+
* @param {string} props.backgroundColor
63+
* @param {string} props.style
64+
* @param {string} props.textColor
65+
* @param {string} props.cornerRadius
66+
* @param {string} props.icon
67+
* @param {string} props.iconPosition
68+
* @param {string} props.label
69+
* @param {Function} props.setter
70+
* @param {string} props.size
71+
*
72+
* @return {JSX.Element} JSX.
5973
*/
6074
const MdcButton = ( {
6175
type,
@@ -85,7 +99,9 @@ const MdcButton = ( {
8599
return (
86100
<div
87101
style={ {
88-
...( backgroundColor && hasBg( style ) ? { backgroundColor } : {} ),
102+
...( backgroundColor && hasBg( style )
103+
? { backgroundColor }
104+
: {} ),
89105
...( textColor ? { color: textColor } : {} ),
90106
...( cornerRadius !== undefined
91107
? { borderRadius: `${ cornerRadius }px` }
@@ -101,7 +117,7 @@ const MdcButton = ( {
101117
) }
102118
<RichText
103119
value={ label }
104-
placeholder={ __( 'Add text...', 'material-design' ) }
120+
placeholder={ __( 'Add text', 'material-design' ) }
105121
withoutInteractiveFormatting
106122
allowedFormats={ [] }
107123
onChange={ setter( 'label' ) }
@@ -117,6 +133,29 @@ const MdcButton = ( {
117133

118134
/**
119135
* Material button edit component.
136+
*
137+
* @param {Object} props
138+
* @param {Object} props.attributes
139+
* @param {string} props.attributes.url
140+
* @param {string} props.attributes.rel
141+
* @param {string} props.attributes.icon
142+
* @param {string} props.attributes.type
143+
* @param {string} props.attributes.label
144+
* @param {string} props.attributes.style
145+
* @param {string} props.attributes.textColor
146+
* @param {string} props.attributes.linkTarget
147+
* @param {string} props.attributes.cornerRadius
148+
* @param {string} props.attributes.iconPosition
149+
* @param {string} props.attributes.backgroundColor
150+
* @param {boolean} props.attributes.isSubmit
151+
* @param {string} props.attributes.tooltip
152+
* @param {string} props.attributes.size
153+
* @param {Function} props.setAttributes
154+
* @param {boolean} props.isSelected
155+
* @param {string} props.className
156+
* @param {boolean} props.isSubmitButton
157+
*
158+
* @return {JSX.Element} JSX.
120159
*/
121160
const ButtonEdit = ( {
122161
attributes: {
@@ -241,7 +280,9 @@ const ButtonEdit = ( {
241280

242281
{ type === 'text' && (
243282
<>
244-
<span>{ __( 'Variations', 'material-design' ) }</span>
283+
<span>
284+
{ __( 'Variations', 'material-design' ) }
285+
</span>
245286
<ButtonGroup
246287
buttons={ BUTTON_STYLES }
247288
current={ style }
@@ -253,7 +294,10 @@ const ButtonEdit = ( {
253294
{ type === 'icon' && (
254295
<>
255296
<TextControl
256-
label={ __( 'Tooltip Text', 'material-theme-builder' ) }
297+
label={ __(
298+
'Tooltip Text',
299+
'material-theme-builder'
300+
) }
257301
onChange={ setter( 'tooltip' ) }
258302
value={ tooltip }
259303
/>
@@ -273,7 +317,10 @@ const ButtonEdit = ( {
273317
) }
274318

275319
{ ( iconPosition !== 'none' || type === 'icon' ) && (
276-
<IconPicker currentIcon={ icon } onChange={ setter( 'icon' ) } />
320+
<IconPicker
321+
currentIcon={ icon }
322+
onChange={ setter( 'icon' ) }
323+
/>
277324
) }
278325
</PanelBody>
279326
<PanelBody
@@ -290,7 +337,10 @@ const ButtonEdit = ( {
290337
target="_blank"
291338
rel="noreferrer noopener"
292339
>
293-
{ __( 'Material Design Options', 'material-design' ) }
340+
{ __(
341+
'Material Design Options',
342+
'material-design'
343+
) }
294344
</a>
295345
{ __( ' to update all buttons.', 'material-design' ) }
296346
</div>
@@ -301,16 +351,23 @@ const ButtonEdit = ( {
301351
value={ backgroundColor }
302352
onChange={ setter( 'backgroundColor' ) }
303353
globalPropName={
304-
hasBg( style ) ? 'primary_color' : 'on_primary_color'
354+
hasBg( style )
355+
? 'primary_color'
356+
: 'on_primary_color'
305357
}
306358
/>
307359
) }
308360
<GlobalColor
309-
label={ __( 'Text and icons Color', 'material-design' ) }
361+
label={ __(
362+
'Text and icons Color',
363+
'material-design'
364+
) }
310365
value={ textColor }
311366
onChange={ setter( 'textColor' ) }
312367
globalPropName={
313-
hasBg( style ) ? 'on_primary_color' : 'primary_color'
368+
hasBg( style )
369+
? 'on_primary_color'
370+
: 'primary_color'
314371
}
315372
/>
316373

@@ -336,13 +393,21 @@ const ButtonEdit = ( {
336393
'material-design'
337394
) }
338395
<a
339-
href={ getConfig( 'customizerUrls' ).shape }
396+
href={
397+
getConfig( 'customizerUrls' ).shape
398+
}
340399
target="_blank"
341400
rel="noreferrer noopener"
342401
>
343-
{ __( 'Material Design Options', 'material-design' ) }
402+
{ __(
403+
'Material Design Options',
404+
'material-design'
405+
) }
344406
</a>
345-
{ __( ' to update all buttons.', 'material-design' ) }
407+
{ __(
408+
' to update all buttons.',
409+
'material-design'
410+
) }
346411
</div>
347412
<GlobalShapeSize
348413
value={ cornerRadius }
@@ -399,7 +464,10 @@ export default compose( [
399464
while ( parentId ) {
400465
const parentBlock = getBlock( clientId );
401466

402-
if ( parentBlock && parentBlock.name === ContactFormBlockName ) {
467+
if (
468+
parentBlock &&
469+
parentBlock.name === ContactFormBlockName
470+
) {
403471
isSubmitButton = true;
404472
break;
405473
}
@@ -408,7 +476,8 @@ export default compose( [
408476
}
409477
} else {
410478
isSubmitButton =
411-
getBlockParentsByBlockName( clientId, ContactFormBlockName ).length > 0;
479+
getBlockParentsByBlockName( clientId, ContactFormBlockName )
480+
.length > 0;
412481
}
413482

414483
return {

Diff for: plugin/assets/src/block-editor/blocks/button/save.js

+27-11
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ import hasBg from './utils/has-bg';
2727
/**
2828
* Button Children component.
2929
*
30-
* @param {Object} props - Component props.
31-
* @param {string} props.icon - Button icon name.
30+
* @param {Object} props - Component props.
31+
* @param {string} props.icon - Button icon name.
3232
* @param {string} props.iconPosition - Button icon position.
33-
* @param {string} props.label - Button label.
33+
* @param {string} props.label - Button label.
3434
*
35-
* @return {Function} Function returning the HTML markup for the component.
35+
* @return {JSX.Element} Function returning the HTML markup for the component.
3636
*/
3737
const ButtonChildren = ( { icon, iconPosition, label } ) => (
3838
<>
@@ -81,17 +81,29 @@ const ButtonSave = ( {
8181
<a
8282
href={ url }
8383
rel={ rel && ! isSubmit ? rel : undefined }
84-
target={ linkTarget && ! isSubmit ? linkTarget : undefined }
85-
className={ classNames( 'material-icons', 'mdc-icon-button' ) }
86-
style={ { ...( textColor ? { color: textColor } : {} ) } }
84+
target={
85+
linkTarget && ! isSubmit ? linkTarget : undefined
86+
}
87+
className={ classNames(
88+
'material-icons',
89+
'mdc-icon-button'
90+
) }
91+
style={ {
92+
...( textColor ? { color: textColor } : {} ),
93+
} }
8794
{ ...tooltipProps }
8895
>
8996
{ icon }
9097
</a>
9198
) : (
9299
<button
93-
className={ classNames( 'material-icons', 'mdc-icon-button' ) }
94-
style={ { ...( textColor ? { color: textColor } : {} ) } }
100+
className={ classNames(
101+
'material-icons',
102+
'mdc-icon-button'
103+
) }
104+
style={ {
105+
...( textColor ? { color: textColor } : {} ),
106+
} }
95107
type={ isSubmit ? 'submit' : undefined }
96108
{ ...tooltipProps }
97109
>
@@ -122,7 +134,9 @@ const ButtonSave = ( {
122134
rel={ rel && ! isSubmit ? rel : undefined }
123135
target={ linkTarget && ! isSubmit ? linkTarget : undefined }
124136
style={ {
125-
...( backgroundColor && hasBg( style ) ? { backgroundColor } : {} ),
137+
...( backgroundColor && hasBg( style )
138+
? { backgroundColor }
139+
: {} ),
126140
...( textColor ? { color: textColor } : {} ),
127141
...( cornerRadius !== undefined
128142
? { borderRadius: `${ cornerRadius }px` }
@@ -146,7 +160,9 @@ const ButtonSave = ( {
146160
[ `is-large` ]: size === 'large',
147161
} ) }
148162
style={ {
149-
...( backgroundColor && hasBg( style ) ? { backgroundColor } : {} ),
163+
...( backgroundColor && hasBg( style )
164+
? { backgroundColor }
165+
: {} ),
150166
...( textColor ? { color: textColor } : {} ),
151167
...( cornerRadius !== undefined
152168
? { borderRadius: `${ cornerRadius }px` }

Diff for: plugin/assets/src/block-editor/blocks/card/components/card-action-button.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,19 @@ import ToolbarUrlInputPopover from '../../../components/toolbar-url-input-popove
2424
/**
2525
* Card Action Button component.
2626
*
27-
* @param {Object} props - Component properties.
28-
* @param {string} props.label - Button label.
29-
* @param {Function} props.onChangeLabel - Button label change handler.
30-
* @param {string} props.url - Button url.
31-
* @param {Function} props.onChangeUrl - Button url change handler
32-
* @param {boolean} props.newTab - Whether or not the button url should open in a new tab.
33-
* @param {Function} props.onChangeNewTab - Button new tab toggle handler.
34-
* @param {boolean} props.noFollow - Whether or not the button url rel property should be noFollow.
35-
* @param {Function} props.onChangeNoFollow - Button no follow toggle handler.
36-
* @param {boolean} props.disableSuggestions. - Whether or not the url input suggestion is enabled or not.
37-
* @param {Function} props.onPopupClose. - Url input popup close handler.
38-
* @param {Function} props.onPopupFocusOutside. - Url input popup focus outside handler.
39-
* @param {boolean} props.isFocused. - Whether or not the button is focused.
40-
* @param {boolean} props.isEditMode - Whether or not the edit mode is enabled.
27+
* @param {Object} props - Component properties.
28+
* @param {string} props.label - Button label.
29+
* @param {Function} props.onChangeLabel - Button label change handler.
30+
* @param {string} props.url - Button url.
31+
* @param {Function} props.onChangeUrl - Button url change handler
32+
* @param {boolean} props.newTab - Whether or not the button url should open in a new tab.
33+
* @param {Function} props.onChangeNewTab - Button new tab toggle handler.
34+
* @param {boolean} props.noFollow - Whether or not the button url rel property should be noFollow.
35+
* @param {Function} props.onPopupFocusOutside - Url input popup focus outside handler.
36+
* @param {boolean} props.isFocused - Whether or not the button is focused.
37+
* @param {boolean} props.isEditMode - Whether or not the edit mode is enabled.
4138
*
42-
* @return {Function} Function returning the HTML markup for the component.
39+
* @return {JSX.Element} Function returning the HTML markup for the component.
4340
*/
4441
const CardActionButton = ( {
4542
label,
@@ -84,6 +81,7 @@ const CardActionButton = ( {
8481
/>
8582
</button>
8683
) : (
84+
// eslint-disable-next-line react/jsx-no-target-blank
8785
<a
8886
href={ url || '#' }
8987
rel={ rel }

0 commit comments

Comments
 (0)