Skip to content

Commit

Permalink
Turn tsconfig settings to 11 (angular-redux#438)
Browse files Browse the repository at this point in the history
Adding `"noUnusedLocals": true, "noUnusedParameters": true` caught a bunch of minor stuff.
  • Loading branch information
SethDavenport authored Jul 10, 2017
1 parent 093f455 commit e9b8f9a
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 41 deletions.
8 changes: 3 additions & 5 deletions src/components/root-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { NgRedux } from './ng-redux';
import { RootStore } from './root-store';
import { select } from '../decorators/select';

const returnPojo = () => ({});

class MockNgZone {
run = (fn: Function) => fn()
}
Expand Down Expand Up @@ -122,7 +120,7 @@ describe('NgRedux Observable Store', () => {
const spy = jasmine
.createSpy('spy')
.and.callFake((foo: string) => { fooData = foo; });
const foo$ = ngRedux
ngRedux
.select(state => `${state.foo}-${state.baz}`)
.subscribe(spy);

Expand Down Expand Up @@ -153,7 +151,7 @@ describe('NgRedux Observable Store', () => {
.and.callFake((data: IRecord) => fooData = data);
const cmp = (a: IRecord, b: IRecord) => a.data === b.data;

const foo$ = ngRedux
ngRedux
.select(state => ({ data: `${state.foo}-${state.baz}` }), cmp)
.subscribe(spy);

Expand Down Expand Up @@ -203,7 +201,7 @@ describe('NgRedux Observable Store', () => {
bar: string;
baz: number;

constructor(private _ngRedux: NgRedux<any>) {
constructor(_ngRedux: NgRedux<any>) {
_ngRedux.select(n => n.foo).subscribe(foo => this.foo = foo);
_ngRedux.select(n => n.bar).subscribe(bar => this.bar = bar);
_ngRedux.select(n => n.baz).subscribe(baz => this.baz = baz);
Expand Down
3 changes: 1 addition & 2 deletions src/components/sub-store.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NgZone } from '@angular/core';
import { async } from '@angular/core/testing'
import { Action } from 'redux';
import { RootStore } from './root-store';
import { NgRedux } from './ng-redux';
Expand All @@ -22,7 +21,7 @@ interface IAppState {
}

describe('Substore', () => {
const defaultReducer = (state: any, action: Action) => state;
const defaultReducer = (state: any, _: Action) => state;

const basePath = ['foo', 'bar'];
let ngRedux: NgRedux<IAppState>;
Expand Down
5 changes: 1 addition & 4 deletions src/components/sub-store.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { Dispatch, Reducer, Action } from 'redux';
import { Dispatch, Reducer } from 'redux';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/distinctUntilChanged';

import { getIn } from '../utils/get-in';
import { setIn } from '../utils/set-in';
import {
PathSelector,
Selector,
PropertySelector,
FunctionSelector,
Comparator,
resolveToFunctionSelector,
} from './selectors';
Expand Down
2 changes: 1 addition & 1 deletion src/decorators/dispatch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('@dispatch', () => {
});

describe('On a substore', () => {
const localReducer = (state: any, action: Action) => state;
const localReducer = (state: any, _: Action) => state;
@WithSubStore({
basePathMethodName: 'getBasePath',
localReducer,
Expand Down
4 changes: 2 additions & 2 deletions src/decorators/select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('Select decorators', () => {
});

describe('when passed a comparator', () => {
const comparator = (x: any, y: any): boolean => y === 1;
const comparator = (_: any, y: any): boolean => y === 1;
class MockClass { @select('baz', comparator) baz$: Observable<number> };

it('should only trigger next when comparator returns true', done => {
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('Select decorators', () => {
});

describe('when passed a comparator', () => {
const comparator = (x: any, y: any): boolean => y === 1;
const comparator = (_: any, y: any): boolean => y === 1;
class MockClass { @select$('baz', transformer, comparator) baz$: Observable<number> }

it('should only trigger next when the comparator returns true', done => {
Expand Down
6 changes: 1 addition & 5 deletions src/decorators/select.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { Observable } from 'rxjs/Observable';
import { ReplaySubject } from 'rxjs/ReplaySubject';
import 'rxjs/add/operator/let'
import { NgRedux } from '../components/ng-redux';
import { ObservableStore } from '../components/observable-store';
import { Selector, Comparator, Transformer } from '../components/selectors';
import { IFractalStoreOptions, getInstanceSelection } from './helpers';
import { getInstanceSelection } from './helpers';

/**
* Selects an observable from the store, and attaches it to the decorated
Expand Down
4 changes: 2 additions & 2 deletions src/decorators/with-sub-store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MockNgZone { run = (fn: Function) => fn() }

describe('@WithSubStore', () => {
let ngRedux: NgRedux<any>;
const localReducer = (state: any, action: Action) => state;
const localReducer = (state: any, _: Action) => state;
const basePathMethodName = 'getSubStorePath';

beforeEach(() => {
Expand All @@ -30,7 +30,7 @@ describe('@WithSubStore', () => {
ngRedux = new RootStore(new MockNgZone() as NgZone);
NgRedux.instance = ngRedux;
ngRedux.configureStore(
(state: any, action: Action) => state,
(state: any, _: Action) => state,
defaultState);
});

Expand Down
1 change: 0 additions & 1 deletion src/decorators/with-sub-store.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Reducer } from 'redux';
import { IFractalStoreOptions, setClassOptions } from './helpers';

/**
Expand Down
2 changes: 1 addition & 1 deletion testing/ng-redux.mock.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TestBed, async } from '@angular/core/testing';
import { TestBed } from '@angular/core/testing';
import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import 'rxjs/add/operator/toArray';
Expand Down
20 changes: 10 additions & 10 deletions testing/ng-redux.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ import {
NgRedux,
Selector,
Comparator,
ObservableStore,
PathSelector,
} from '@angular-redux/store';
import { Reducer, Action, Dispatch, Middleware, Store, StoreEnhancer } from 'redux';
import { Reducer, Dispatch, Middleware, Store, StoreEnhancer } from 'redux';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { ReplaySubject } from 'rxjs/ReplaySubject';
import 'rxjs/add/observable/from';
import 'rxjs/add/operator/distinctUntilChanged';
import { MockObservableStore } from './observable-store.mock';
Expand Down Expand Up @@ -71,16 +69,18 @@ export class MockNgRedux extends NgRedux<any> {
return MockNgRedux.mockInstance;
}

provideStore = (store: Store<any>): void => {};
provideStore = (_: Store<any>): void => {};
configureStore = (
rootReducer: Reducer<any>,
initState: any,
middleware?: Middleware[],
enhancers?: StoreEnhancer<any>[]): void => {};
_: Reducer<any>,
__: any,
___?: Middleware[],
____?: StoreEnhancer<any>[]): void => {};

configureSubStore = this.mockRootStore.configureSubStore;
select = this.mockRootStore.select;

select: <SelectedType>(
selector: Selector<any, SelectedType>,
comparator?: Comparator) => Observable<SelectedType> = this.mockRootStore.select;

dispatch = this.mockRootStore.dispatch as Dispatch<any>;
getState = this.mockRootStore.getState;
subscribe = this.mockRootStore.subscribe;
Expand Down
5 changes: 2 additions & 3 deletions testing/observable-store.mock.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {
NgRedux,
Selector,
Comparator,
ObservableStore,
PathSelector,
} from '@angular-redux/store';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { Reducer, Action, Dispatch } from 'redux';
import { Reducer, Dispatch } from 'redux';
import { ReplaySubject } from 'rxjs/ReplaySubject';
import 'rxjs/add/observable/from';
import 'rxjs/add/operator/distinctUntilChanged';
Expand Down Expand Up @@ -60,7 +59,7 @@ export class MockObservableStore<State> implements ObservableStore<any> {

configureSubStore = <SubState>(
basePath: PathSelector,
localReducer: Reducer<SubState>): MockObservableStore<SubState> =>
_: Reducer<SubState>): MockObservableStore<SubState> =>
this.initSubStore<SubState>(basePath)

getSubStore = <SubState>(...pathSelectors: PathSelector[]): MockObservableStore<any> => {
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
"paths": {
"@angular-redux/store": [ "./src/index.ts" ]
},
"skipLibCheck": true
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true
},
"compileOnSave": false,
"buildOnSave": false,
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"@angular-redux/store": ["src/index.ts"]
},
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true
},
"compileOnSave": false,
"buildOnSave": false,
Expand Down
9 changes: 7 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
"@angular-redux/store": ["src/index.ts"]
},
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true
},
"compileOnSave": false,
"buildOnSave": false,
"include": [
"src/**/*.ts"
"src/**/*.ts",
"testing/**/*.ts"
],
"exclude": [
"node_modules",
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.testing.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"@angular-redux/store": ["./lib/src"]
},
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true
},
"compileOnSave": false,
"buildOnSave": false,
Expand Down

0 comments on commit e9b8f9a

Please sign in to comment.