Skip to content

Commit 76872fa

Browse files
committed
Tslint
1 parent 5a51f5d commit 76872fa

File tree

5 files changed

+37
-33
lines changed

5 files changed

+37
-33
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
!package.json
99
!yarn.lock
1010
!rollup.config.js
11+
!tslint.json
1112
!tsconfig.json

airtable.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,17 @@ export async function remove(
148148
export function pack(fields: FieldSet) {
149149
return {
150150
id: fields._id,
151-
fields: Object.assign(fields, { _id: null, createdTime: null }),
151+
fields: { ...fields, _id: null, createdTime: null },
152152
createdTime: fields.createdTime,
153153
}
154154
}
155155

156156
export function unpack({ id: _id, fields, createdTime }: FieldSet) {
157-
return Object.assign(
158-
{
159-
_id,
160-
createdTime,
161-
},
162-
fields
163-
)
157+
return {
158+
_id,
159+
createdTime,
160+
...fields,
161+
}
164162
}
165163

166164
// Filters

fetch.ts

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,17 @@ export function fetchJSON(url: string, options?: any) {
22
if (options.json) {
33
options.body = JSON.stringify(options.json)
44
}
5-
return fetch(
6-
url,
7-
Object.assign(
8-
{
9-
method: 'POST',
10-
credentials: 'same-origin',
11-
},
12-
options,
13-
{
14-
headers: Object.assign(
15-
{
16-
accept: 'application/json',
17-
},
18-
options.method !== 'GET'
19-
? { 'content-type': 'application/json' }
20-
: {},
21-
options.auth ? { Authorization: 'Bearer ' + options.auth } : {},
22-
options.headers
23-
),
24-
}
25-
)
26-
)
5+
return fetch(url, {
6+
method: 'POST',
7+
credentials: 'same-origin',
8+
...options,
9+
headers: {
10+
accept: 'application/json',
11+
...(options.method !== 'GET' && { 'content-type': 'application/json' }),
12+
...(options.auth ? { Authorization: 'Bearer ' + options.auth } : {}),
13+
...options.headers,
14+
},
15+
})
2716
.then(r => r.json())
2817
.catch(e => {
2918
throw new Error('Failed to fetch JSON: ' + e.message)

tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"noImplicitReturns": true,
2121
"noImplicitThis": true,
2222
"noImplicitUseStrict": false,
23-
"noStrictGenericChecks": false,
24-
"noUnusedLocals": false,
25-
"noUnusedParameters": false,
23+
"noStrictGenericChecks": true,
24+
"noUnusedLocals": true,
25+
"noUnusedParameters": true,
2626
"preserveConstEnums": false,
2727
"removeComments": false,
2828
"resolveJsonModule": true,

tslint.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": ["tslint:latest", "tslint-react"],
3+
"linterOptions": {
4+
"project": "./tsconfig.json",
5+
"exclude": []
6+
},
7+
"rules": {
8+
"no-console": [false],
9+
"no-empty": false,
10+
"no-shadowed-variable": false,
11+
"no-submodule-imports": false,
12+
"no-unused-variable": [true],
13+
"whitespace": false
14+
},
15+
"jsRules": true
16+
}

0 commit comments

Comments
 (0)