Skip to content

Commit ab4d1d3

Browse files
committed
fix: fix eslint
1 parent 3cbefb3 commit ab4d1d3

Some content is hidden

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

56 files changed

+3005
-2633
lines changed

.eslintrc.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
env:
2+
es6: true
3+
node: true
4+
browser: true
5+
jest: true
6+
plugins:
7+
- '@typescript-eslint'
8+
- 'eslint-plugin-prettier'
9+
parser:
10+
'@typescript-eslint/parser'
11+
ignorePatterns:
12+
- '**/docs/**'
13+
parserOptions:
14+
ecmaVersion: 2018
15+
sourceType: module
16+
rules:
17+
curly:
18+
- error
19+
- all
20+
object-curly-spacing:
21+
- error
22+
- always
23+
array-bracket-spacing:
24+
- error
25+
- always
26+
no-console:
27+
- error
28+
- { allow: ["warn", "error"] }
29+
indent:
30+
- error
31+
- 4
32+
- { SwitchCase: 1 }
33+
linebreak-style:
34+
- error
35+
- unix
36+
quotes:
37+
- error
38+
- single
39+
semi:
40+
- error
41+
- always

.github/workflows/publish-workflow.yml

-31
This file was deleted.

.github/workflows/relese-workflow.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/checkout@v2
1616
with:
1717
submodules: recursive
18-
token: ${{ secrets.GH_TOKEN }}
18+
token: ${{ secrets.GITHUB_TOKEN }}
1919

2020
- name: Use Node.js 14.x
2121
uses: actions/setup-node@v2
@@ -35,7 +35,7 @@ jobs:
3535
3636
- name: Create release version
3737
env:
38-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3939
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4040
run: |
4141
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN

.prettierrc

-4
This file was deleted.

.prettierrc.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"arrowParens": "avoid",
3+
"bracketSpacing": true,
4+
"jsxBracketSameLine": false,
5+
"jsxSingleQuote": false,
6+
"quoteProps": "consistent",
7+
"printWidth": 120,
8+
"semi": true,
9+
"singleQuote": true,
10+
"tabWidth": 4,
11+
"trailingComma": "all",
12+
"useTabs": false
13+
}

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
"clean:coverage": "rimraf coverage",
1919
"clean:dist": "rimraf packages/*/dist",
2020
"docs": "docsify serve ./docs",
21-
"lint": "npm-run-all -p lint:*",
22-
"lint:packages": "tslint -p tsconfig.json",
23-
"lint:prettier": "prettier -l \"**/*.*(ts|js|css|scss|json|md)\"",
21+
"lint": "eslint packages/**/*.{js,ts} --fix",
2422
"test": "jest --coverage",
2523
"test:ci": "jest --coverage --ci --maxWorkers=2",
2624
"test:watch": "jest --watch",
@@ -60,9 +58,14 @@
6058
"@semantic-release/npm": "^7.0.5",
6159
"@semantic-release/release-notes-generator": "^9.0.1",
6260
"@types/jest": "23.3.13",
61+
"@typescript-eslint/eslint-plugin": "4.22.0",
62+
"@typescript-eslint/eslint-plugin-tslint": "4.22.0",
63+
"@typescript-eslint/parser": "4.22.0",
6364
"babel-jest": "23.6.0",
6465
"codelyzer": "4.5.0",
6566
"docsify-cli": "4.3.0",
67+
"eslint": "^7.22.0",
68+
"eslint-plugin-prettier": "^3.3.1",
6669
"husky": "1.3.1",
6770
"jest": "23.6.0",
6871
"jest-junit": "6.0.1",

packages/form/src/compose-reducers.spec.ts

+69-69
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,85 @@ import { fromJS, List, Map, Set } from 'immutable';
33
import { composeReducers } from './compose-reducers';
44

55
xdescribe('composeReducers', () => {
6-
const compose = (s1: any, s2: any, s3: any) => {
7-
const r1 = (state = s1) => state;
8-
const r2 = (state = s2) => state;
9-
const r3 = (state = s3) => state;
6+
const compose = (s1: any, s2: any, s3: any) => {
7+
const r1 = (state = s1) => state;
8+
const r2 = (state = s2) => state;
9+
const r3 = (state = s3) => state;
1010

11-
const reducer = composeReducers(r1, r2, r3);
11+
const reducer = composeReducers(r1, r2, r3);
1212

13-
return reducer(undefined, { type: '' });
14-
};
13+
return reducer(undefined, { type: '' });
14+
};
1515

16-
it('can compose plain-object initial states', () => {
17-
const state = compose(
18-
{ a: 1 },
19-
{ b: 1 },
20-
{ c: 1 },
21-
);
22-
expect(state).toBeDefined();
23-
expect(state).toEqual({ a: 1, b: 1, c: 1 });
24-
});
16+
it('can compose plain-object initial states', () => {
17+
const state = compose(
18+
{ a: 1 },
19+
{ b: 1 },
20+
{ c: 1 },
21+
);
22+
expect(state).toBeDefined();
23+
expect(state).toEqual({ a: 1, b: 1, c: 1 });
24+
});
2525

26-
it('can compose array states', () => {
27-
const state = compose(
28-
[1],
29-
[2],
30-
[3],
31-
);
32-
expect(state).toBeDefined();
33-
expect(state).toEqual([1, 2, 3]);
34-
});
26+
it('can compose array states', () => {
27+
const state = compose(
28+
[ 1 ],
29+
[ 2 ],
30+
[ 3 ],
31+
);
32+
expect(state).toBeDefined();
33+
expect(state).toEqual([ 1, 2, 3 ]);
34+
});
3535

36-
it('can compose Immutable::Map initial states', () => {
37-
const state = compose(
38-
fromJS({ a: 1 }),
39-
fromJS({ b: 1 }),
40-
fromJS({ c: 1 }),
41-
);
42-
expect(Map.isMap(state)).toEqual(true);
36+
it('can compose Immutable::Map initial states', () => {
37+
const state = compose(
38+
fromJS({ a: 1 }),
39+
fromJS({ b: 1 }),
40+
fromJS({ c: 1 }),
41+
);
42+
expect(Map.isMap(state)).toEqual(true);
4343

44-
const plain = state.toJS();
45-
expect(plain).not.toBeNull();
46-
expect(plain).toEqual({ a: 1, b: 1, c: 1 });
47-
});
44+
const plain = state.toJS();
45+
expect(plain).not.toBeNull();
46+
expect(plain).toEqual({ a: 1, b: 1, c: 1 });
47+
});
4848

49-
it('can compose Immutable::Set initial states', () => {
50-
const state = compose(
51-
Set.of(1, 2, 3),
52-
Set.of(4, 5, 6),
53-
Set.of(),
54-
);
55-
expect(Set.isSet(state)).toEqual(true);
49+
it('can compose Immutable::Set initial states', () => {
50+
const state = compose(
51+
Set.of(1, 2, 3),
52+
Set.of(4, 5, 6),
53+
Set.of(),
54+
);
55+
expect(Set.isSet(state)).toEqual(true);
5656

57-
const plain = state.toJS();
58-
expect(plain).not.toBeNull();
59-
expect(plain).toEqual([1, 2, 3, 4, 5, 6]);
60-
});
57+
const plain = state.toJS();
58+
expect(plain).not.toBeNull();
59+
expect(plain).toEqual([ 1, 2, 3, 4, 5, 6 ]);
60+
});
6161

62-
it('can compose Immutable::OrderedSet initial states', () => {
63-
const state = compose(
64-
Set.of(3, 2, 1),
65-
Set.of(4, 6, 5),
66-
Set.of(),
67-
);
68-
expect(Set.isSet(state)).toEqual(true);
62+
it('can compose Immutable::OrderedSet initial states', () => {
63+
const state = compose(
64+
Set.of(3, 2, 1),
65+
Set.of(4, 6, 5),
66+
Set.of(),
67+
);
68+
expect(Set.isSet(state)).toEqual(true);
6969

70-
const plain = state.toJS();
71-
expect(plain).not.toBeNull();
72-
expect(plain).toEqual([3, 2, 1, 4, 6, 5]);
73-
});
70+
const plain = state.toJS();
71+
expect(plain).not.toBeNull();
72+
expect(plain).toEqual([ 3, 2, 1, 4, 6, 5 ]);
73+
});
7474

75-
it('can compose Immutable::List initial states', () => {
76-
const state = compose(
77-
List.of('a', 'b'),
78-
List.of('c', 'd'),
79-
List.of(),
80-
);
81-
expect(List.isList(state)).toEqual(true);
75+
it('can compose Immutable::List initial states', () => {
76+
const state = compose(
77+
List.of('a', 'b'),
78+
List.of('c', 'd'),
79+
List.of(),
80+
);
81+
expect(List.isList(state)).toEqual(true);
8282

83-
const plain = state.toJS();
84-
expect(plain).not.toBeNull();
85-
expect(plain).toEqual(['a', 'b', 'c', 'd']);
86-
});
83+
const plain = state.toJS();
84+
expect(plain).not.toBeNull();
85+
expect(plain).toEqual([ 'a', 'b', 'c', 'd' ]);
86+
});
8787
});

packages/form/src/compose-reducers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AnyAction, Reducer } from 'redux';
22

33
export const composeReducers = <State>(
4-
...reducers: Reducer<State, AnyAction>[]
4+
...reducers: Reducer<State, AnyAction>[]
55
): Reducer<State, AnyAction> => (s: any, action: AnyAction) =>
6-
reducers.reduce((st, reducer) => reducer(st, action), s);
6+
reducers.reduce((st, reducer) => reducer(st, action), s);

packages/form/src/configure.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import { AbstractStore, FormStore } from './form-store';
66
/// This will allow you to provide a preexisting store that you have already
77
/// configured, rather than letting ngredux-core create one for you.
88
export const provideReduxForms = <T>(store: Store<T> | any) => {
9-
const abstractStore = wrap(store);
9+
const abstractStore = wrap(store);
1010

11-
return [
12-
{ provide: FormStore, useValue: new FormStore(abstractStore as any) },
13-
];
11+
return [
12+
{ provide: FormStore, useValue: new FormStore(abstractStore as any) },
13+
];
1414
};
1515

1616
const wrap = <T>(store: Store<T> | any): AbstractStore<T> => {
17-
const dispatch = (action: Action) => store.dispatch(action);
17+
const dispatch = (action: Action) => store.dispatch(action);
1818

19-
const getState = () => store.getState() as T;
19+
const getState = () => store.getState() as T;
2020

21-
const subscribe = (fn: (state: T) => void) =>
22-
store.subscribe(() => fn(store.getState()));
21+
const subscribe = (fn: (state: T) => void) =>
22+
store.subscribe(() => fn(store.getState()));
2323

24-
return { dispatch, getState, subscribe };
24+
return { dispatch, getState, subscribe };
2525
};
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export class ConnectArrayTemplate {
2-
constructor(public $implicit: any, public index: number, public item: any) {}
2+
constructor(public $implicit: any, public index: number, public item: any) {}
33
}

packages/form/src/connect-array/connect-array.module.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { NgModule } from '@angular/core';
22

33
import { ConnectArrayDirective } from './connect-array.directive';
44

5-
const declarations = [ConnectArrayDirective];
5+
const declarations = [ ConnectArrayDirective ];
66

77
@NgModule({
8-
declarations: [...declarations],
9-
exports: [...declarations],
8+
declarations: [ ...declarations ],
9+
exports: [ ...declarations ],
1010
})
1111
export class NgReduxFormConnectArrayModule {}

0 commit comments

Comments
 (0)