Browse Source

Code style: Switched to ESLint.

Kamil Piechaczek 8 years ago
parent
commit
d4effd6b11

+ 3 - 3
packages/ckeditor5-heading/src/heading.js

@@ -50,7 +50,7 @@ export default class Heading extends Plugin {
 		const defaultTitle = t( 'Choose heading' );
 		const dropdownTooltip = t( 'Heading' );
 
-		for ( let option of options ) {
+		for ( const option of options ) {
 			const command = editor.commands.get( option.modelElement );
 			const itemModel = new Model( {
 				commandName: option.modelElement,
@@ -93,7 +93,7 @@ export default class Heading extends Plugin {
 		);
 
 		// Register UI component.
-		editor.ui.componentFactory.add( 'headings', ( locale ) => {
+		editor.ui.componentFactory.add( 'headings', locale => {
 			const dropdown = createListDropdown( dropdownModel, locale );
 
 			Template.extend( dropdown.template, {
@@ -105,7 +105,7 @@ export default class Heading extends Plugin {
 			} );
 
 			// Execute command when an item from the dropdown is selected.
-			this.listenTo( dropdown, 'execute', ( evt ) => {
+			this.listenTo( dropdown, 'execute', evt => {
 				editor.execute( evt.source.commandName );
 				editor.editing.view.focus();
 			} );

+ 1 - 1
packages/ckeditor5-heading/src/headingcommand.js

@@ -89,7 +89,7 @@ export default class HeadingCommand extends Command {
 		document.enqueueChanges( () => {
 			const batch = options.batch || document.batch();
 
-			for ( let block of document.selection.getSelectedBlocks() ) {
+			for ( const block of document.selection.getSelectedBlocks() ) {
 				// When removing applied option.
 				if ( shouldRemove ) {
 					if ( block.is( this.modelElement ) ) {

+ 1 - 1
packages/ckeditor5-heading/src/headingengine.js

@@ -57,7 +57,7 @@ export default class HeadingEngine extends Plugin {
 		const editing = editor.editing;
 		const options = editor.config.get( 'heading.options' );
 
-		for ( let option of options ) {
+		for ( const option of options ) {
 			// Skip paragraph - it is defined in required Paragraph feature.
 			if ( option.modelElement !== defaultModelElement ) {
 				// Schema.

+ 3 - 3
packages/ckeditor5-heading/tests/heading.js

@@ -106,7 +106,7 @@ describe( 'Heading', () => {
 			} );
 
 			it( 'isEnabled', () => {
-				for ( let name in commands ) {
+				for ( const name in commands ) {
 					commands[ name ].isEnabled = false;
 				}
 
@@ -117,7 +117,7 @@ describe( 'Heading', () => {
 			} );
 
 			it( 'label', () => {
-				for ( let name in commands ) {
+				for ( const name in commands ) {
 					commands[ name ].value = false;
 				}
 
@@ -209,7 +209,7 @@ describe( 'Heading', () => {
 					toolbar: [ 'heading' ],
 					lang: 'pl',
 					heading: {
-						options: options
+						options
 					}
 				} )
 				.then( newEditor => {

+ 9 - 9
packages/ckeditor5-heading/tests/headingcommand.js

@@ -28,7 +28,7 @@ describe( 'HeadingCommand', () => {
 			editor.commands.set( 'paragraph', new ParagraphCommand( editor ) );
 			schema.registerItem( 'paragraph', '$block' );
 
-			for ( let option of options ) {
+			for ( const option of options ) {
 				commands[ option.modelElement ] = new HeadingCommand( editor, option );
 				schema.registerItem( option.modelElement, '$block' );
 			}
@@ -42,13 +42,13 @@ describe( 'HeadingCommand', () => {
 	} );
 
 	afterEach( () => {
-		for ( let modelElement in commands ) {
+		for ( const modelElement in commands ) {
 			commands[ modelElement ].destroy();
 		}
 	} );
 
 	describe( 'basic properties', () => {
-		for ( let option of options ) {
+		for ( const option of options ) {
 			test( option );
 		}
 
@@ -62,7 +62,7 @@ describe( 'HeadingCommand', () => {
 	} );
 
 	describe( 'value', () => {
-		for ( let option of options ) {
+		for ( const option of options ) {
 			test( option );
 		}
 
@@ -75,8 +75,8 @@ describe( 'HeadingCommand', () => {
 				expect( commands[ modelElement ].value ).to.be.true;
 			} );
 
-			it( `equals false if inside to non-block element`, () => {
-				setData( document, `<notBlock>[foo]</notBlock>` );
+			it( 'equals false if inside to non-block element', () => {
+				setData( document, '<notBlock>[foo]</notBlock>' );
 
 				expect( commands[ modelElement ].value ).to.be.false;
 			} );
@@ -149,7 +149,7 @@ describe( 'HeadingCommand', () => {
 		describe( 'collapsed selection', () => {
 			let convertTo = options[ options.length - 1 ];
 
-			for ( let option of options ) {
+			for ( const option of options ) {
 				test( option, convertTo );
 				convertTo = option;
 			}
@@ -186,7 +186,7 @@ describe( 'HeadingCommand', () => {
 		describe( 'non-collapsed selection', () => {
 			let convertTo = options[ options.length - 1 ];
 
-			for ( let option of options ) {
+			for ( const option of options ) {
 				test( option, convertTo );
 				convertTo = option;
 			}
@@ -227,7 +227,7 @@ describe( 'HeadingCommand', () => {
 	} );
 
 	describe( 'isEnabled', () => {
-		for ( let option of options ) {
+		for ( const option of options ) {
 			test( option.modelElement );
 		}
 

+ 1 - 1
packages/ckeditor5-heading/tests/headingengine.js

@@ -122,7 +122,7 @@ describe( 'HeadingEngine', () => {
 				return VirtualTestEditor.create( {
 					plugins: [ Enter, HeadingEngine ],
 					heading: {
-						options: options
+						options
 					}
 				} )
 				.then( editor => {