style(lint): improve lint issues

This commit is contained in:
KostyaDanovsky 2017-05-06 15:35:15 +03:00
parent 3ac268a096
commit f04763cecd
16 changed files with 19 additions and 78 deletions

View file

@ -15,6 +15,7 @@
"test": "ng test -sr", "test": "ng test -sr",
"test:coverage": "rimraf coverage && npm run test -- -cc", "test:coverage": "rimraf coverage && npm run test -- -cc",
"lint": "ng lint", "lint": "ng lint",
"lint:fix": "ng lint --fix",
"lint:styles": "stylelint ./src/**/*.scss", "lint:styles": "stylelint ./src/**/*.scss",
"lint:ci": "npm run lint && npm run lint:styles", "lint:ci": "npm run lint && npm run lint:styles",
"pree2e": "webdriver-manager update --standalone false --gecko false", "pree2e": "webdriver-manager update --standalone false --gecko false",

View file

@ -5,9 +5,9 @@ import { throwIfAlreadyLoaded } from './module-import-guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule CommonModule,
], ],
declarations: [] declarations: [],
}) })
export class CoreModule { export class CoreModule {
constructor(@Optional() @SkipSelf() parentModule: CoreModule) { constructor(@Optional() @SkipSelf() parentModule: CoreModule) {

View file

@ -20,8 +20,7 @@ export class TinyMCEComponent implements OnDestroy, AfterViewInit {
setup: editor => { setup: editor => {
this.editor = editor; this.editor = editor;
editor.on('keyup', () => { editor.on('keyup', () => {
let content = editor.getContent(); this.editorKeyup.emit(editor.getContent());
this.editorKeyup.emit(content);
}); });
}, },
}); });

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'one-column-layout', selector: 'ngx-one-column-layout',
template: ` template: `
<nga-layout> <nga-layout>
<nga-layout-header fixed> <nga-layout-header fixed>

View file

@ -17,7 +17,7 @@ import {
HeaderComponent, HeaderComponent,
FooterComponent, FooterComponent,
SearchInputComponent, SearchInputComponent,
TinyMCEComponent TinyMCEComponent,
} from './components'; } from './components';
import { OneColumnLayoutComponent } from './layouts'; import { OneColumnLayoutComponent } from './layouts';

View file

@ -6,7 +6,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app', selector: 'ngx-app',
template: '<router-outlet></router-outlet>', template: '<router-outlet></router-outlet>',
}) })
export class AppComponent { export class AppComponent {

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'components', selector: 'ngx-components',
template: ` template: `
<p> <p>
components works! components works!

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'dashboard', selector: 'ngx-dashboard',
template: ` template: `
<nga-card> <nga-card>
<nga-card-header>Test card</nga-card-header> <nga-card-header>Test card</nga-card-header>

View file

@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { EditorsComponent } from './editors.component'; import { EditorsComponent } from './editors.component';
import { TinyMCEComponent, TinyMCEEditorComponent } from './tinyMCE.component'; import { TinyMCEComponent } from './tiny-mce/tiny-mce.component';
import { CKEditorComponent } from './ckeditor.component'; import { CKEditorComponent } from './ckeditor.component';
const routes: Routes = [{ const routes: Routes = [{
@ -26,6 +26,5 @@ export class EditorsRoutingModule { }
export const routedComponents = [ export const routedComponents = [
EditorsComponent, EditorsComponent,
TinyMCEComponent, TinyMCEComponent,
TinyMCEEditorComponent,
CKEditorComponent, CKEditorComponent,
]; ];

View file

@ -1,56 +0,0 @@
import { Component, OnDestroy, AfterViewInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'ngx-tinymce-editor',
template: `
<textarea id="{{ elementId }}"></textarea>
`,
})
export class TinyMCEEditorComponent implements OnDestroy, AfterViewInit {
@Input() elementId: string;
@Output() editorKeyup = new EventEmitter<any>();
editor: any;
ngAfterViewInit() {
tinymce.init({
selector: '#' + this.elementId,
plugins: ['link', 'paste', 'table'],
skin_url: 'assets/skins/lightgray',
setup: editor => {
this.editor = editor;
editor.on('keyup', () => {
const content = editor.getContent();
this.editorKeyup.emit(content);
});
},
});
}
ngOnDestroy() {
tinymce.remove(this.editor);
}
}
@Component({
selector: 'ngx-tinymce',
template: `
<nga-card>
<nga-card-body>
<ngx-tinymce-editor elementId="tinymceEditor" (editorKeyup)="editorKeyupHandler($event)"></ngx-tinymce-editor>
</nga-card-body>
</nga-card>
`,
})
export class TinyMCEComponent {
editorKeyupHandler($event) {
console.info($event);
}
}

View file

@ -1,7 +1,7 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'maps', selector: 'ngx-maps',
template: ` template: `
<p> <p>
maps works! maps works!

View file

@ -4,12 +4,12 @@ import 'style-loader!../@theme/styles/gorgeous/gorgeous.theme.scss';
import 'style-loader!../@theme/styles/pure/pure.theme.scss'; import 'style-loader!../@theme/styles/pure/pure.theme.scss';
@Component({ @Component({
selector: 'pages', selector: 'ngx-pages',
template: ` template: `
<one-column-layout> <ngx-one-column-layout>
<nga-menu></nga-menu> <nga-menu></nga-menu>
<router-outlet></router-outlet> <router-outlet></router-outlet>
</one-column-layout> </ngx-one-column-layout>
`, `,
}) })
export class PagesComponent { export class PagesComponent {

View file

@ -9,6 +9,6 @@
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body> <body>
<app>Loading...</app> <ngx-app>Loading...</ngx-app>
</body> </body>
</html> </html>

View file

@ -54,14 +54,12 @@ import 'core-js/es7/reflect';
// import 'web-animations-js'; // Run `npm install --save web-animations-js`. // import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/*************************************************************************************************** /***************************************************************************************************
* Zone JS is required by Angular itself. * Zone JS is required by Angular itself.
*/ */
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
/*************************************************************************************************** /***************************************************************************************************
* APPLICATION IMPORTS * APPLICATION IMPORTS
*/ */

View file

@ -14,7 +14,7 @@ import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing'; import { getTestBed } from '@angular/core/testing';
import { import {
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
platformBrowserDynamicTesting platformBrowserDynamicTesting,
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
@ -27,7 +27,7 @@ __karma__.loaded = function () {};
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
platformBrowserDynamicTesting() platformBrowserDynamicTesting(),
); );
// Then we find all the tests. // Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/); const context = require.context('./', true, /\.spec\.ts$/);