build(aio): lint examples
This commit is contained in:
parent
eb56ab38dc
commit
55b8de9fdd
|
@ -19,7 +19,7 @@ export class AppComponent {
|
||||||
movie: IMovie = null;
|
movie: IMovie = null;
|
||||||
movies: IMovie[] = [];
|
movies: IMovie[] = [];
|
||||||
showImage = true;
|
showImage = true;
|
||||||
title: string = 'AngularJS to Angular Quick Ref Cookbook';
|
title = 'AngularJS to Angular Quick Ref Cookbook';
|
||||||
toggleImage(event: UIEvent) {
|
toggleImage(event: UIEvent) {
|
||||||
this.showImage = !this.showImage;
|
this.showImage = !this.showImage;
|
||||||
this.eventType = (event && event.type) || 'not provided';
|
this.eventType = (event && event.type) || 'not provided';
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { MovieService } from './movie.service';
|
||||||
export class MovieListComponent {
|
export class MovieListComponent {
|
||||||
// #enddocregion class
|
// #enddocregion class
|
||||||
favoriteHero: string;
|
favoriteHero: string;
|
||||||
showImage: boolean = false;
|
showImage = false;
|
||||||
movies: IMovie[];
|
movies: IMovie[];
|
||||||
|
|
||||||
// #docregion di
|
// #docregion di
|
||||||
|
|
|
@ -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';
|
import { protractor, browser, element, by, ElementFinder } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class HighlightDirective {
|
||||||
private highlight(color: string) {
|
private highlight(color: string) {
|
||||||
this.el.nativeElement.style.backgroundColor = color;
|
this.el.nativeElement.style.backgroundColor = color;
|
||||||
}
|
}
|
||||||
// #enddocregion mouse-methods,
|
// #enddocregion mouse-methods,
|
||||||
|
|
||||||
// #docregion color
|
// #docregion color
|
||||||
@Input() highlightColor: string;
|
@Input() highlightColor: string;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* tslint:disable:member-ordering */
|
/* tslint:disable:member-ordering */
|
||||||
// #docregion imports,
|
// #docregion imports,
|
||||||
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
|
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
|
||||||
// #enddocregion imports
|
// #enddocregion imports
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,6 @@ import { HEROES } from './hero';
|
||||||
})
|
})
|
||||||
export class HeroParentComponent {
|
export class HeroParentComponent {
|
||||||
heroes = HEROES;
|
heroes = HEROES;
|
||||||
master: string = 'Master';
|
master = 'Master';
|
||||||
}
|
}
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
|
@ -11,8 +11,8 @@ import { Component } from '@angular/core';
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class VersionParentComponent {
|
export class VersionParentComponent {
|
||||||
major: number = 1;
|
major = 1;
|
||||||
minor: number = 23;
|
minor = 23;
|
||||||
|
|
||||||
newMinor() {
|
newMinor() {
|
||||||
this.minor++;
|
this.minor++;
|
||||||
|
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { UserService } from './user.service';
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
// #enddocregion import-services
|
// #enddocregion import-services
|
||||||
|
|
||||||
private userId: number = 1;
|
private userId = 1;
|
||||||
|
|
||||||
// #docregion ctor
|
// #docregion ctor
|
||||||
constructor(logger: LoggerService, public userContext: UserContextService) {
|
constructor(logger: LoggerService, public userContext: UserContextService) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* tslint:disable:one-line:check-open-brace*/
|
/* tslint:disable:one-line*/
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* tslint:disable:one-line:check-open-brace*/
|
/* tslint:disable:one-line*/
|
||||||
// #docplaster
|
// #docplaster
|
||||||
// #docregion injection-token
|
// #docregion injection-token
|
||||||
import { InjectionToken } from '@angular/core';
|
import { InjectionToken } from '@angular/core';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
|
|
||||||
export var HEROES: Hero[] = [
|
export const HEROES: Hero[] = [
|
||||||
{ id: 11, isSecret: false, name: 'Mr. Nice' },
|
{ id: 11, isSecret: false, name: 'Mr. Nice' },
|
||||||
{ id: 12, isSecret: false, name: 'Narco' },
|
{ id: 12, isSecret: false, name: 'Narco' },
|
||||||
{ id: 13, isSecret: false, name: 'Bombasto' },
|
{ id: 13, isSecret: false, name: 'Bombasto' },
|
||||||
|
|
|
@ -117,7 +117,7 @@ class OldLogger {
|
||||||
export class Provider6aComponent {
|
export class Provider6aComponent {
|
||||||
log: string;
|
log: string;
|
||||||
constructor(newLogger: NewLogger, oldLogger: OldLogger) {
|
constructor(newLogger: NewLogger, oldLogger: OldLogger) {
|
||||||
if (newLogger === oldLogger){
|
if (newLogger === oldLogger) {
|
||||||
throw new Error('expected the two loggers to be different instances');
|
throw new Error('expected the two loggers to be different instances');
|
||||||
}
|
}
|
||||||
oldLogger.log('Hello OldLogger (but we want NewLogger)');
|
oldLogger.log('Hello OldLogger (but we want NewLogger)');
|
||||||
|
@ -140,7 +140,7 @@ export class Provider6aComponent {
|
||||||
export class Provider6bComponent {
|
export class Provider6bComponent {
|
||||||
log: string;
|
log: string;
|
||||||
constructor(newLogger: NewLogger, oldLogger: OldLogger) {
|
constructor(newLogger: NewLogger, oldLogger: OldLogger) {
|
||||||
if (newLogger !== oldLogger){
|
if (newLogger !== oldLogger) {
|
||||||
throw new Error('expected the two loggers to be the same instance');
|
throw new Error('expected the two loggers to be the same instance');
|
||||||
}
|
}
|
||||||
oldLogger.log('Hello from NewLogger (via aliased OldLogger)');
|
oldLogger.log('Hello from NewLogger (via aliased OldLogger)');
|
||||||
|
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'rxjs/add/operator/delay';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
isLoggedIn: boolean = false;
|
isLoggedIn = false;
|
||||||
|
|
||||||
// store the URL so we can redirect after logging in
|
// store the URL so we can redirect after logging in
|
||||||
redirectUrl: string;
|
redirectUrl: string;
|
||||||
|
|
|
@ -15,7 +15,7 @@ export class ComposeMessageComponent {
|
||||||
@HostBinding('style.position') position = 'absolute';
|
@HostBinding('style.position') position = 'absolute';
|
||||||
|
|
||||||
details: string;
|
details: string;
|
||||||
sending: boolean = false;
|
sending = false;
|
||||||
|
|
||||||
constructor(private router: Router) {}
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
|
|
|
@ -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';
|
import { browser, element, By } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* tslint:disable use-output-property-decorator */
|
/* tslint:disable use-output-property-decorator directive-class-suffix */
|
||||||
// #docplaster
|
// #docplaster
|
||||||
import { Directive, ElementRef, EventEmitter, Output } from '@angular/core';
|
import { Directive, ElementRef, EventEmitter, Output } from '@angular/core';
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { DependentService, FancyService } from './bag';
|
||||||
|
|
||||||
///////// Fakes /////////
|
///////// Fakes /////////
|
||||||
export class FakeFancyService extends FancyService {
|
export class FakeFancyService extends FancyService {
|
||||||
value: string = 'faked value';
|
value = 'faked value';
|
||||||
}
|
}
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// #docregion FancyService
|
// #docregion FancyService
|
||||||
|
|
|
@ -677,5 +677,5 @@ class FakeGrandchildComponent { }
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
class FakeFancyService extends FancyService {
|
class FakeFancyService extends FancyService {
|
||||||
value: string = 'faked value';
|
value = 'faked value';
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class Hero {
|
||||||
// #docregion FancyService
|
// #docregion FancyService
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FancyService {
|
export class FancyService {
|
||||||
protected value: string = 'real value';
|
protected value = 'real value';
|
||||||
|
|
||||||
getValue() { return this.value; }
|
getValue() { return this.value; }
|
||||||
setValue(value: string) { this.value = value; }
|
setValue(value: string) { this.value = value; }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Hero } from './hero';
|
import { Hero } from './hero';
|
||||||
|
|
||||||
export var HEROES: Hero[] = [
|
export const HEROES: Hero[] = [
|
||||||
new Hero(11, 'Mr. Nice'),
|
new Hero(11, 'Mr. Nice'),
|
||||||
new Hero(12, 'Narco'),
|
new Hero(12, 'Narco'),
|
||||||
new Hero(13, 'Bombasto'),
|
new Hero(13, 'Bombasto'),
|
||||||
|
|
|
@ -5,7 +5,7 @@ export { HeroService } from '../hero.service';
|
||||||
import { Hero } from '../hero';
|
import { Hero } from '../hero';
|
||||||
import { HeroService } from '../hero.service';
|
import { HeroService } from '../hero.service';
|
||||||
|
|
||||||
export var HEROES: Hero[] = [
|
export const HEROES: Hero[] = [
|
||||||
new Hero(41, 'Bob'),
|
new Hero(41, 'Bob'),
|
||||||
new Hero(42, 'Carol'),
|
new Hero(42, 'Carol'),
|
||||||
new Hero(43, 'Ted'),
|
new Hero(43, 'Ted'),
|
||||||
|
|
|
@ -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 { browser, element, by, ElementFinder } from 'protractor';
|
||||||
import { promise } from 'selenium-webdriver';
|
import { promise } from 'selenium-webdriver';
|
||||||
|
|
|
@ -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 { browser, element, by, ElementFinder } from 'protractor';
|
||||||
import { promise } from 'selenium-webdriver';
|
import { promise } from 'selenium-webdriver';
|
||||||
|
|
|
@ -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 { browser, element, by, ElementFinder } from 'protractor';
|
||||||
import { promise } from 'selenium-webdriver';
|
import { promise } from 'selenium-webdriver';
|
||||||
|
|
|
@ -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 { browser, element, by, ElementFinder } from 'protractor';
|
||||||
import { promise } from 'selenium-webdriver';
|
import { promise } from 'selenium-webdriver';
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { Attribute, Component, Inject, Optional } from '@angular/core';
|
||||||
})
|
})
|
||||||
// #enddocregion templateUrl
|
// #enddocregion templateUrl
|
||||||
export class HeroTitleComponent {
|
export class HeroTitleComponent {
|
||||||
msg: string = '';
|
msg = '';
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('titlePrefix') @Optional() private titlePrefix: string,
|
@Inject('titlePrefix') @Optional() private titlePrefix: string,
|
||||||
@Attribute('title') private title: string
|
@Attribute('title') private title: string
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -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';
|
import { browser, element, by } from 'protractor';
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"ng": "yarn check-env && ng",
|
"ng": "yarn check-env && ng",
|
||||||
"start": "yarn check-env && ng serve",
|
"start": "yarn check-env && ng serve",
|
||||||
"build": "yarn check-env && yarn setup && ng build -prod -sm",
|
"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",
|
"test": "yarn check-env && ng test",
|
||||||
"pree2e": "yarn ~~update-webdriver",
|
"pree2e": "yarn ~~update-webdriver",
|
||||||
"e2e": "yarn check-env && ng e2e --no-webdriver-update",
|
"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-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",
|
"test-pwa-score": "node scripts/test-pwa-score",
|
||||||
"example-e2e": "node ./tools/examples/run-example-e2e",
|
"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-preview": "scripts/deploy-preview.sh",
|
||||||
"deploy-staging": "scripts/deploy-staging.sh",
|
"deploy-staging": "scripts/deploy-staging.sh",
|
||||||
"check-env": "node ../tools/check-environment.js",
|
"check-env": "node ../tools/check-environment.js",
|
||||||
|
|
Loading…
Reference in New Issue