Skip to content

Commit

Permalink
Add ESLint comma-dangle rule (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed May 11, 2017
1 parent c541c16 commit 8e20050
Show file tree
Hide file tree
Showing 49 changed files with 483 additions and 482 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"rules": {
"array-bracket-spacing": [ "error", "always" ],
"brace-style": [ "error", "1tbs" ],
"comma-dangle": [ "error", "always-multiline" ],
"comma-spacing": "error",
"comma-style": "error",
"computed-property-spacing": [ "error", "always" ],
Expand Down
2 changes: 1 addition & 1 deletion blocks/api/categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { __ } from 'i18n';
*/
const categories = [
{ slug: 'common', title: __( 'Common Blocks' ) },
{ slug: 'layout', title: __( 'Layout Blocks' ) }
{ slug: 'layout', title: __( 'Layout Blocks' ) },
];

/**
Expand Down
6 changes: 3 additions & 3 deletions blocks/api/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export function createBlock( blockType, attributes = {} ) {
blockType,
attributes: {
...defaultAttributes,
...attributes
}
...attributes,
},
};
}

Expand Down Expand Up @@ -89,7 +89,7 @@ export function switchToBlockType( block, blockType ) {
// type gets to keep the existing block's UID.
uid: index === firstSwitchedBlock ? block.uid : result.uid,
blockType: result.blockType,
attributes: result.attributes
attributes: result.attributes,
};
} );
}
2 changes: 1 addition & 1 deletion blocks/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ export {
setUnknownTypeHandler,
getUnknownTypeHandler,
getBlockSettings,
getBlocks
getBlocks,
} from './registration';
2 changes: 1 addition & 1 deletion blocks/api/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
prop as originalProp,
html as originalHtml,
text as originalText,
query as originalQuery
query as originalQuery,
} from 'hpq';

/**
Expand Down
2 changes: 1 addition & 1 deletion blocks/api/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function serialize( blocks ) {
const saveContent = getSaveContent( settings.save, block.attributes );
const beautifyOptions = {
indent_inner_html: true,
wrap_line_length: 0
wrap_line_length: 0,
};

return memo + (
Expand Down
148 changes: 74 additions & 74 deletions blocks/api/test/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ describe( 'block factory', () => {
it( 'should create a block given its blockType and attributes', () => {
registerBlock( 'core/test-block', {
defaultAttributes: {
includesDefault: true
}
includesDefault: true,
},
} );
const block = createBlock( 'core/test-block', {
align: 'left'
align: 'left',
} );

expect( block.blockType ).to.eql( 'core/test-block' );
expect( block.attributes ).to.eql( {
includesDefault: true,
align: 'left'
align: 'left',
} );
expect( block.uid ).to.be.a( 'string' );
} );
Expand All @@ -45,20 +45,20 @@ describe( 'block factory', () => {
blocks: [ 'core/text-block' ],
transform: ( { value } ) => {
return createBlock( 'core/updated-text-block', {
value: 'chicken ' + value
value: 'chicken ' + value,
} );
}
} ]
}
},
} ],
},
} );
registerBlock( 'core/text-block', {} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -67,8 +67,8 @@ describe( 'block factory', () => {
uid: 1,
blockType: 'core/updated-text-block',
attributes: {
value: 'chicken ribs'
}
value: 'chicken ribs',
},
} ] );
} );

Expand All @@ -80,19 +80,19 @@ describe( 'block factory', () => {
blocks: [ 'core/updated-text-block' ],
transform: ( { value } ) => {
return createBlock( 'core/updated-text-block', {
value: 'chicken ' + value
value: 'chicken ' + value,
} );
}
} ]
}
},
} ],
},
} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -101,8 +101,8 @@ describe( 'block factory', () => {
uid: 1,
blockType: 'core/updated-text-block',
attributes: {
value: 'chicken ribs'
}
value: 'chicken ribs',
},
} ] );
} );

Expand All @@ -114,8 +114,8 @@ describe( 'block factory', () => {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -128,18 +128,18 @@ describe( 'block factory', () => {
transforms: {
from: [ {
blocks: [ 'core/text-block' ],
transform: () => null
} ]
}
transform: () => null,
} ],
},
} );
registerBlock( 'core/text-block', {} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -152,18 +152,18 @@ describe( 'block factory', () => {
transforms: {
from: [ {
blocks: [ 'core/text-block' ],
transform: () => []
} ]
}
transform: () => [],
} ],
},
} );
registerBlock( 'core/text-block', {} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -179,21 +179,21 @@ describe( 'block factory', () => {
transform: ( { value } ) => {
return {
attributes: {
value: 'chicken ' + value
}
value: 'chicken ' + value,
},
};
}
} ]
}
},
} ],
},
} );
registerBlock( 'core/text-block', {} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -209,26 +209,26 @@ describe( 'block factory', () => {
transform: ( { value } ) => {
return [
createBlock( 'core/updated-text-block', {
value: 'chicken ' + value
value: 'chicken ' + value,
} ),
{
attributes: {
value: 'smoked ' + value
}
}
value: 'smoked ' + value,
},
},
];
}
} ]
}
},
} ],
},
} );
registerBlock( 'core/text-block', {} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -244,19 +244,19 @@ describe( 'block factory', () => {
blocks: [ 'core/updated-text-block' ],
transform: ( { value } ) => {
return createBlock( 'core/text-block', {
value: 'chicken ' + value
value: 'chicken ' + value,
} );
}
} ]
}
},
} ],
},
} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -273,23 +273,23 @@ describe( 'block factory', () => {
transform: ( { value } ) => {
return [
createBlock( 'core/text-block', {
value: 'chicken ' + value
value: 'chicken ' + value,
} ),
createBlock( 'core/text-block', {
value: 'smoked ' + value
} )
value: 'smoked ' + value,
} ),
];
}
} ]
}
},
} ],
},
} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -306,23 +306,23 @@ describe( 'block factory', () => {
transform: ( { value } ) => {
return [
createBlock( 'core/text-block', {
value: 'chicken ' + value
value: 'chicken ' + value,
} ),
createBlock( 'core/updated-text-block', {
value: 'smoked ' + value
} )
value: 'smoked ' + value,
} ),
];
}
} ]
}
},
} ],
},
} );

const block = {
uid: 1,
blockType: 'core/text-block',
attributes: {
value: 'ribs'
}
value: 'ribs',
},
};

const updatedBlock = switchToBlockType( block, 'core/updated-text-block' );
Expand All @@ -339,14 +339,14 @@ describe( 'block factory', () => {
uid: 2,
blockType: 'core/text-block',
attributes: {
value: 'chicken ribs'
}
value: 'chicken ribs',
},
}, {
uid: 1,
blockType: 'core/updated-text-block',
attributes: {
value: 'smoked ribs'
}
value: 'smoked ribs',
},
} ] );
} );
} );
Expand Down
Loading

0 comments on commit 8e20050

Please sign in to comment.