build(aio): lint examples

This commit is contained in:
Jesús Rodríguez 2017-05-03 19:31:02 +02:00 committed by Matias Niemelä
parent eb56ab38dc
commit 55b8de9fdd
35 changed files with 131 additions and 36 deletions

View File

@ -19,7 +19,7 @@ export class AppComponent {
movie: IMovie = null;
movies: IMovie[] = [];
showImage = true;
title: string = 'AngularJS to Angular Quick Ref Cookbook';
title = 'AngularJS to Angular Quick Ref Cookbook';
toggleImage(event: UIEvent) {
this.showImage = !this.showImage;
this.eventType = (event && event.type) || 'not provided';

View File

@ -19,7 +19,7 @@ import { MovieService } from './movie.service';
export class MovieListComponent {
// #enddocregion class
favoriteHero: string;
showImage: boolean = false;
showImage = false;
movies: IMovie[];
// #docregion di

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { protractor, browser, element, by, ElementFinder } from 'protractor';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -28,7 +28,7 @@ export class HighlightDirective {
private highlight(color: string) {
this.el.nativeElement.style.backgroundColor = color;
}
// #enddocregion mouse-methods,
// #enddocregion mouse-methods,
// #docregion color
@Input() highlightColor: string;

View File

@ -1,5 +1,5 @@
/* tslint:disable:member-ordering */
// #docregion imports,
// #docregion imports,
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
// #enddocregion imports

View File

@ -15,6 +15,6 @@ import { HEROES } from './hero';
})
export class HeroParentComponent {
heroes = HEROES;
master: string = 'Master';
master = 'Master';
}
// #enddocregion

View File

@ -11,8 +11,8 @@ import { Component } from '@angular/core';
`
})
export class VersionParentComponent {
major: number = 1;
minor: number = 23;
major = 1;
minor = 23;
newMinor() {
this.minor++;

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -16,7 +16,7 @@ import { UserService } from './user.service';
export class AppComponent {
// #enddocregion import-services
private userId: number = 1;
private userId = 1;
// #docregion ctor
constructor(logger: LoggerService, public userContext: UserContextService) {

View File

@ -1,4 +1,4 @@
/* tslint:disable:one-line:check-open-brace*/
/* tslint:disable:one-line*/
// #docregion
import { Injectable } from '@angular/core';

View File

@ -1,4 +1,4 @@
/* tslint:disable:one-line:check-open-brace*/
/* tslint:disable:one-line*/
// #docplaster
// #docregion injection-token
import { InjectionToken } from '@angular/core';

View File

@ -1,7 +1,7 @@
// #docregion
import { Hero } from './hero';
export var HEROES: Hero[] = [
export const HEROES: Hero[] = [
{ id: 11, isSecret: false, name: 'Mr. Nice' },
{ id: 12, isSecret: false, name: 'Narco' },
{ id: 13, isSecret: false, name: 'Bombasto' },

View File

@ -117,7 +117,7 @@ class OldLogger {
export class Provider6aComponent {
log: string;
constructor(newLogger: NewLogger, oldLogger: OldLogger) {
if (newLogger === oldLogger){
if (newLogger === oldLogger) {
throw new Error('expected the two loggers to be different instances');
}
oldLogger.log('Hello OldLogger (but we want NewLogger)');
@ -140,7 +140,7 @@ export class Provider6aComponent {
export class Provider6bComponent {
log: string;
constructor(newLogger: NewLogger, oldLogger: OldLogger) {
if (newLogger !== oldLogger){
if (newLogger !== oldLogger) {
throw new Error('expected the two loggers to be the same instance');
}
oldLogger.log('Hello from NewLogger (via aliased OldLogger)');

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -8,7 +8,7 @@ import 'rxjs/add/operator/delay';
@Injectable()
export class AuthService {
isLoggedIn: boolean = false;
isLoggedIn = false;
// store the URL so we can redirect after logging in
redirectUrl: string;

View File

@ -15,7 +15,7 @@ export class ComposeMessageComponent {
@HostBinding('style.position') position = 'absolute';
details: string;
sending: boolean = false;
sending = false;
constructor(private router: Router) {}

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, By } from 'protractor';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -1,4 +1,4 @@
/* tslint:disable use-output-property-decorator */
/* tslint:disable use-output-property-decorator directive-class-suffix */
// #docplaster
import { Directive, ElementRef, EventEmitter, Output } from '@angular/core';

View File

@ -3,7 +3,7 @@ import { DependentService, FancyService } from './bag';
///////// Fakes /////////
export class FakeFancyService extends FancyService {
value: string = 'faked value';
value = 'faked value';
}
////////////////////////
// #docregion FancyService

View File

@ -677,5 +677,5 @@ class FakeGrandchildComponent { }
@Injectable()
class FakeFancyService extends FancyService {
value: string = 'faked value';
value = 'faked value';
}

View File

@ -20,7 +20,7 @@ export class Hero {
// #docregion FancyService
@Injectable()
export class FancyService {
protected value: string = 'real value';
protected value = 'real value';
getValue() { return this.value; }
setValue(value: string) { this.value = value; }

View File

@ -1,7 +1,7 @@
// #docregion
import { Hero } from './hero';
export var HEROES: Hero[] = [
export const HEROES: Hero[] = [
new Hero(11, 'Mr. Nice'),
new Hero(12, 'Narco'),
new Hero(13, 'Bombasto'),

View File

@ -5,7 +5,7 @@ export { HeroService } from '../hero.service';
import { Hero } from '../hero';
import { HeroService } from '../hero.service';
export var HEROES: Hero[] = [
export const HEROES: Hero[] = [
new Hero(41, 'Bob'),
new Hero(42, 'Carol'),
new Hero(43, 'Ted'),

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { promise } from 'selenium-webdriver';

View File

@ -8,7 +8,7 @@ import { Attribute, Component, Inject, Optional } from '@angular/core';
})
// #enddocregion templateUrl
export class HeroTitleComponent {
msg: string = '';
msg = '';
constructor(
@Inject('titlePrefix') @Optional() private titlePrefix: string,
@Attribute('title') private title: string

View File

@ -0,0 +1,94 @@
{
"rulesDirectory": [
"../../node_modules/codelyzer"
],
"rules": {
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"indent": [
true,
"spaces"
],
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
"no-inferrable-types": true,
"no-string-literal": false,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"import-destructuring-spacing": true
}
}

View File

@ -1,4 +1,4 @@
'use strict'; // necessary for es6 output in node
'use strict'; // necessary for es6 output in node
import { browser, element, by } from 'protractor';

View File

@ -9,7 +9,7 @@
"ng": "yarn check-env && ng",
"start": "yarn check-env && ng serve",
"build": "yarn check-env && yarn setup && ng build -prod -sm",
"lint": "yarn check-env && yarn docs-lint && ng lint",
"lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint",
"test": "yarn check-env && ng test",
"pree2e": "yarn ~~update-webdriver",
"e2e": "yarn check-env && ng e2e --no-webdriver-update",
@ -18,6 +18,7 @@
"test-pwa-score-local": "concurrently --kill-others --success first \"http-server dist -p 4200 --silent\" \"yarn test-pwa-score -- http://localhost:4200 90\"",
"test-pwa-score": "node scripts/test-pwa-score",
"example-e2e": "node ./tools/examples/run-example-e2e",
"example-lint": "tslint -c \"content/examples/tslint.json\" \"content/examples/**/*.ts\" -e \"content/examples/styleguide/**/*.avoid.ts\"",
"deploy-preview": "scripts/deploy-preview.sh",
"deploy-staging": "scripts/deploy-staging.sh",
"check-env": "node ../tools/check-environment.js",