Skip to content

Commit 2d04b60

Browse files
authored
style(linting): add global tslint rules (#35)
Adds tslint rules to be run across the workspace based off of the latest preset with some tweaks to taste closes #4. BREAKING CHANGES: - ConnectArray has been renamed to ConnectArrayDirective - ReactiveConnect has been renamed to ReactiveConnectDirective - Connect has been renamed to ConnectDirective - interfaces with an "I" prefix have had that prefix removed (e.g "IAppStore" -> "AppStore")
1 parent d047bb2 commit 2d04b60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+531
-784
lines changed

jest/tests-setup.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
// TODO: Should be able to remove this once dev dependencies are hoisted to the workspace
2+
// tslint:disable:no-implicit-dependencies
13
import 'core-js/es6/reflect';
24
import 'core-js/es7/reflect';
35
import 'zone.js';
4-
import 'zone.js/dist/proxy';
5-
import 'zone.js/dist/sync-test';
66
import 'zone.js/dist/async-test';
77
import 'zone.js/dist/fake-async-test';
8+
import 'zone.js/dist/proxy';
9+
import 'zone.js/dist/sync-test';
10+
// This must be loaded in after ZoneJS
11+
// tslint:disable-next-line:ordered-imports
812
import 'jest-zone-patch';
913

1014
import { TestBed } from '@angular/core/testing';

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"clean:workspace-deps": "rimraf node_modules",
1010
"clean:package-deps": "rimraf packages/*/node_modules",
1111
"clean:coverage": "rimraf coverage",
12-
"lint": "npm-run-all -p lint:*",
12+
"lint": "tslint -p tsconfig.json",
1313
"lint:packages": "lerna run lint",
1414
"lint:prettier": "prettier -l \"**/*.*(ts|js|css|scss|json|md)\"",
1515
"test": "jest --coverage",
@@ -31,14 +31,17 @@
3131
"@commitlint/config-conventional": "7.0.1",
3232
"@commitlint/prompt-cli": "7.0.0",
3333
"@types/jest": "23.1.6",
34+
"codelyzer": "4.4.2",
3435
"husky": "0.14.3",
3536
"jest": "23.4.1",
3637
"jest-junit": "5.1.0",
3738
"jest-preset-angular": "5.2.3",
39+
"jest-zone-patch": "0.0.8",
3840
"lerna": "2.11.0",
3941
"lint-staged": "7.2.0",
4042
"npm-run-all": "4.1.3",
4143
"prettier": "1.13.7",
42-
"rimraf": "2.6.2"
44+
"rimraf": "2.6.2",
45+
"tslint": "5.11.0"
4346
}
4447
}

packages/example-app/circle.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/example-app/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@
3737
"@angular/compiler-cli": "^4.1.0",
3838
"@types/node": "~6.0.71",
3939
"@types/redux-logger": "^3.0.0",
40-
"codelyzer": "~3.0.1",
4140
"protractor": "~5.1.1",
4241
"ts-node": "~3.0.2",
43-
"tslint": "~5.1.0",
4442
"typescript": "^2.4.1"
4543
}
4644
}

packages/example-app/src/app/animals/animal-list/component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Component, Input } from '@angular/core';
2-
import { TestBed, async } from '@angular/core/testing';
2+
import { async, TestBed } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
4-
import { AnimalListComponent } from './component';
54
import { CoreModule } from '../../core/module';
65
import { AnimalType } from '../model';
6+
import { AnimalListComponent } from './component';
77

88
@Component({ selector: 'zoo-animal', template: '' })
99
class MockAnimalComponent {
@@ -19,7 +19,7 @@ xdescribe('AnimalListComponent', () => {
1919
}).compileComponents();
2020
}));
2121

22-
it(`should have as title 'Welcome to the Zoo'`, async(() => {
22+
it("should have as title 'Welcome to the Zoo'", async(() => {
2323
const fixture = TestBed.createComponent(AnimalListComponent);
2424
const animalList = fixture.debugElement.componentInstance;
2525

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
22
import { Observable } from 'rxjs/Observable';
3-
import { IAnimal } from '../model';
3+
import { Animal } from '../model';
44

55
@Component({
66
selector: 'zoo-animal-list',
@@ -11,14 +11,14 @@ import { IAnimal } from '../model';
1111
export class AnimalListComponent {
1212
@Input() animalsName: string;
1313
@Input() animalType: string;
14-
@Input() animals: Observable<IAnimal[]>;
14+
@Input() animals: Observable<Animal[]>;
1515
@Input() loading: Observable<boolean>;
1616
@Input() error: Observable<any>;
1717

1818
// Since we're observing an array of items, we need to set up a 'trackBy'
1919
// parameter so Angular doesn't tear down and rebuild the list's DOM every
2020
// time there's an update.
21-
getKey(_, animal: IAnimal) {
21+
getKey(_, animal: Animal) {
2222
return animal.id;
2323
}
2424
}

packages/example-app/src/app/animals/animal/component.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { async, TestBed } from '@angular/core/testing';
21
import {
3-
NgReduxTestingModule,
42
MockNgRedux,
3+
NgReduxTestingModule,
54
} from '@angular-redux/store/testing';
6-
import { AnimalComponent } from './component';
7-
import { CoreModule } from '../../core/module';
5+
import { async, TestBed } from '@angular/core/testing';
86
import 'rxjs/add/operator/toArray';
7+
import { CoreModule } from '../../core/module';
8+
import { AnimalComponent } from './component';
99

1010
xdescribe('AnimalComponent', () => {
1111
let fixture;

packages/example-app/src/app/animals/animal/component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
21
import { dispatch, select, select$, WithSubStore } from '@angular-redux/store';
2+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
33
import { Observable } from 'rxjs/Observable';
44

5+
import { Animal } from '../model';
56
import { animalComponentReducer } from './reducers';
6-
import { IAnimal } from '../model';
77

8-
export const toSubTotal = (obs$: Observable<IAnimal>): Observable<number> =>
8+
export const toSubTotal = (obs$: Observable<Animal>): Observable<number> =>
99
obs$.map(s => s.ticketPrice * s.tickets);
1010

1111
/**

packages/example-app/src/app/animals/animal/reducers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Reducer, Action } from 'redux';
1+
import { Action, Reducer } from 'redux';
22
import { AnimalComponent } from './component';
33

44
export const ticketsReducer: Reducer<number> = (

packages/example-app/src/app/animals/api/actions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Injectable } from '@angular/core';
21
import { dispatch } from '@angular-redux/store';
2+
import { Injectable } from '@angular/core';
33
import { FluxStandardAction } from 'flux-standard-action';
4-
import { IAnimal, AnimalType } from '../model';
4+
import { Animal, AnimalType } from '../model';
55

66
// Flux-standard-action gives us stronger typing of our actions.
7-
type Payload = IAnimal[];
7+
type Payload = Animal[];
88
interface MetaData {
99
animalType: AnimalType;
1010
}

0 commit comments

Comments
 (0)