Skip to content
Permalink
Browse files
Update linting and formatting for test plugin files. (#28033)
* Remove test plugins folder from eslint ignore to ensure prettier formats plugin code correctly

* Fix formatting/linting errors
  • Loading branch information
talldan committed Jun 16, 2021
1 parent cff6131 commit a29bf44a14e3a806e3fa037c99bd69c05fb4d8a2
@@ -4,7 +4,6 @@ build-module
build-types
node_modules
packages/block-serialization-spec-parser/parser.js
packages/e2e-tests/plugins
packages/react-native-editor/bundle
vendor
!.*.js
@@ -1,23 +1,18 @@
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.blockEditor.InnerBlocks;
var __ = wp.i18n.__;
var TEMPLATE = [
[ 'core/paragraph', { fontSize: 'large', content: __( 'Content…' ) } ],
];
( function () {
const registerBlockType = wp.blocks.registerBlockType;
const el = wp.element.createElement;

var baseBlock = {
const baseBlock = {
icon: 'cart',
category: 'text',
edit: function( props ) {
edit() {
return el(
'div',
{ style: { outline: '1px solid gray', padding: 5 } },
'Test Align Hook'
);
},
save: function() {
save() {
return el(
'div',
{ style: { outline: '1px solid gray', padding: 5 } },
@@ -1,16 +1,16 @@
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var el = wp.element.createElement;
var InnerBlocks = wp.blockEditor.InnerBlocks;
var circle = el( 'circle', {
( function () {
const registerBlockType = wp.blocks.registerBlockType;
const el = wp.element.createElement;
const InnerBlocks = wp.blockEditor.InnerBlocks;
const circle = el( 'circle', {
cx: 10,
cy: 10,
r: 10,
fill: 'red',
stroke: 'blue',
strokeWidth: '10',
} );
var svg = el(
const svg = el(
'svg',
{ width: 20, height: 20, viewBox: '0 0 20 20' },
circle
@@ -21,7 +21,7 @@
icon: svg,
category: 'text',

edit: function() {
edit() {
return el(
'div',
{
@@ -42,7 +42,7 @@
);
},

save: function() {
save() {
return el(
'div',
{
@@ -59,7 +59,7 @@
icon: 'cart',
category: 'text',

edit: function() {
edit() {
return el(
'div',
{
@@ -80,7 +80,7 @@
);
},

save: function() {
save() {
return el(
'div',
{
@@ -94,12 +94,12 @@

registerBlockType( 'test/test-function-icon', {
title: 'TestFunctionIcon',
icon: function() {
icon() {
return svg;
},
category: 'text',

edit: function() {
edit() {
return el(
'div',
{
@@ -120,7 +120,7 @@
);
},

save: function() {
save() {
return el(
'div',
{
@@ -141,7 +141,7 @@
},
category: 'text',

edit: function() {
edit() {
return el(
'div',
{
@@ -162,7 +162,7 @@
);
},

save: function() {
save() {
return el(
'div',
{
@@ -182,7 +182,7 @@
},
category: 'text',

edit: function() {
edit() {
return el(
'div',
{
@@ -203,7 +203,7 @@
);
},

save: function() {
save() {
return el(
'div',
{
@@ -1,19 +1,20 @@
( function() {
var el = wp.element.createElement;
var registerBlockVariation = wp.blocks.registerBlockVariation;
var __ = wp.i18n.__;
var Circle = wp.primitives.Circle;
var SVG = wp.primitives.SVG;
( function () {
const el = wp.element.createElement;
const registerBlockVariation = wp.blocks.registerBlockVariation;
const __ = wp.i18n.__;
const Circle = wp.primitives.Circle;
const SVG = wp.primitives.SVG;

var redCircle = el( Circle, {
const redCircle = el( Circle, {
cx: 24,
cy: 24,
r: 15,
fill: 'red',
stroke: 'blue',
strokeWidth: '10',
} );
var redCircleIcon = el(

const redCircleIcon = el(
SVG,
{ width: 48, height: 48, viewBox: '0 0 48 48' },
redCircle
@@ -1,4 +1,4 @@
( function() {
( function () {
const { InnerBlocks } = wp.blockEditor;
const { createElement: el } = wp.element;
const { registerBlockType } = wp.blocks;
@@ -9,19 +9,11 @@
category: 'text',

edit() {
return el(
'div',
{},
el( InnerBlocks )
);
return el( 'div', {}, el( InnerBlocks ) );
},

save() {
return el(
'div',
{},
el( InnerBlocks.Content )
);
return el( 'div', {}, el( InnerBlocks.Content ) );
},
} );

@@ -34,19 +26,14 @@
return el(
'div',
{},
el(
InnerBlocks,
{ allowedBlocks: [ 'core/paragraph', 'core/image' ] }
)
el( InnerBlocks, {
allowedBlocks: [ 'core/paragraph', 'core/image' ],
} )
);
},

save() {
return el(
'div',
{},
el( InnerBlocks.Content )
);
return el( 'div', {}, el( InnerBlocks.Content ) );
},
} );

@@ -61,19 +48,11 @@
],

edit() {
return el(
'div',
{},
'Child'
);
return el( 'div', {}, 'Child' );
},

save() {
return el(
'div',
{},
'Child'
);
return el( 'div', {}, 'Child' );
},
} );
} )();
@@ -1,4 +1,4 @@
( function() {
( function () {
wp.blocks.registerBlockType( 'test/container-without-paragraph', {
title: 'Container without paragraph',
category: 'text',
@@ -1,4 +1,4 @@
( function() {
( function () {
wp.blocks.registerBlockType( 'test/alternative-group-block', {
title: 'Alternative Group Block',
category: 'design',
@@ -1,7 +1,7 @@
( function() {
var registerBlockType = wp.blocks.registerBlockType;
var RichText = wp.blockEditor.RichText;
var el = wp.element.createElement;
( function () {
const registerBlockType = wp.blocks.registerBlockType;
const RichText = wp.blockEditor.RichText;
const el = wp.element.createElement;

registerBlockType( 'core/deprecated-children-matcher', {
title: 'Deprecated Children Matcher',
@@ -13,16 +13,16 @@
},
},
category: 'text',
edit: function( { attributes, setAttributes } ) {
edit( { attributes, setAttributes } ) {
return el( RichText, {
tagName: 'p',
value: attributes.value,
onChange: function( nextValue ) {
onChange( nextValue ) {
setAttributes( { value: nextValue } );
},
} );
},
save: function( { attributes } ) {
save( { attributes } ) {
return el( RichText.Content, {
tagName: 'p',
value: attributes.value,
@@ -31,13 +31,15 @@
} );

function toRichTextValue( value ) {
return _.map( value, function( subValue ) {
// eslint-disable-next-line no-undef
return _.map( value, function ( subValue ) {
return subValue.children;
} );
}

function fromRichTextValue( value ) {
return _.map( value, function( subValue ) {
// eslint-disable-next-line no-undef
return _.map( value, function ( subValue ) {
return {
children: subValue,
};
@@ -59,22 +61,22 @@
},
},
category: 'text',
edit: function( { attributes, setAttributes } ) {
edit( { attributes, setAttributes } ) {
return el(
'blockquote',
{},
el( RichText, {
multiline: 'p',
value: toRichTextValue( attributes.value ),
onChange: function( nextValue ) {
onChange( nextValue ) {
setAttributes( {
value: fromRichTextValue( nextValue ),
} );
},
} )
);
},
save: function( { attributes } ) {
save( { attributes } ) {
return el(
'blockquote',
{},
Loading

0 comments on commit a29bf44

Please sign in to comment.