Skip to content

Commit 797ef86

Browse files
committed
add linting for TS
1 parent 5665d4a commit 797ef86

File tree

4 files changed

+60
-6
lines changed

4 files changed

+60
-6
lines changed

.eslintrc

+14-2
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,17 @@
2020
"react": {
2121
"version": "detect"
2222
}
23-
}
24-
}
23+
},
24+
"overrides": [{
25+
"files": "packages/**/*.{ts,tsx}",
26+
"parser": "@typescript-eslint/parser",
27+
"plugins": ["@typescript-eslint"],
28+
"parserOptions": {
29+
"ecmaVersion": 6,
30+
"sourceType": "module",
31+
"ecmaFeatures": {
32+
"modules": true
33+
}
34+
}
35+
}]
36+
}

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"start": "run-p start:*",
1616
"start:examples": "now dev",
1717
"start:storybook": "start-storybook -p 6006",
18-
"lint": "eslint packages/*/src/*.js",
18+
"lint": "eslint packages/*/src/*.{j,t}{s,sx}",
1919
"test": "jest packages/*/src/*.spec.js",
2020
"test:watch": "yarn test -- --watch",
2121
"test:devtools": "jest react-async-devtools/src",
@@ -51,6 +51,8 @@
5151
"@storybook/react": "5.2.0-rc.2",
5252
"@testing-library/jest-dom": "4.1.0",
5353
"@testing-library/react": "9.1.3",
54+
"@typescript-eslint/eslint-plugin": "^2.1.0",
55+
"@typescript-eslint/parser": "^2.1.0",
5456
"babel-eslint": "10.0.3",
5557
"babel-jest": "24.9.0",
5658
"babel-loader": "8.0.6",

packages/react-async/src/Async.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export const createInstance = <T extends {}>(
172172

173173
type Props = AsyncProps<T>
174174

175-
const Async: AsyncConstructor<T> = class extends React.Component<Props, AsyncState<T>> {
175+
const Async: AsyncConstructor<T> = class Async extends React.Component<Props, AsyncState<T>> {
176176
private mounted = false
177177
private counter = 0
178178
private args: any[] = []

yarn.lock

+42-2
Original file line numberDiff line numberDiff line change
@@ -3281,6 +3281,17 @@
32813281
regexpp "^2.0.1"
32823282
tsutils "^3.7.0"
32833283

3284+
"@typescript-eslint/eslint-plugin@^2.1.0":
3285+
version "2.1.0"
3286+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.1.0.tgz#4bcd978d88419ea971613675f2620dde39920d69"
3287+
integrity sha512-3i/dLPwxaVfCsaLu3HkB8CAA1Uw3McAegrTs+VBJ0BrGRKW7nUwSqRfHfCS7sw7zSbf62q3v0v6pOS8MyaYItg==
3288+
dependencies:
3289+
"@typescript-eslint/experimental-utils" "2.1.0"
3290+
eslint-utils "^1.4.0"
3291+
functional-red-black-tree "^1.0.1"
3292+
regexpp "^2.0.1"
3293+
tsutils "^3.14.0"
3294+
32843295
"@typescript-eslint/[email protected]", "@typescript-eslint/experimental-utils@^1.13.0":
32853296
version "1.13.0"
32863297
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e"
@@ -3290,6 +3301,15 @@
32903301
"@typescript-eslint/typescript-estree" "1.13.0"
32913302
eslint-scope "^4.0.0"
32923303

3304+
"@typescript-eslint/[email protected]":
3305+
version "2.1.0"
3306+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.1.0.tgz#0837229f0e75a32db0db9bf662ad0eface914453"
3307+
integrity sha512-ZJGLYXa4nxjNzomaEk1qts38B/vludg2LOM7dRc7SppEKsMPTS1swaTKS/pom+x4d/luJGoG00BDIss7PR1NQA==
3308+
dependencies:
3309+
"@types/json-schema" "^7.0.3"
3310+
"@typescript-eslint/typescript-estree" "2.1.0"
3311+
eslint-scope "^4.0.0"
3312+
32933313
"@typescript-eslint/[email protected]":
32943314
version "1.13.0"
32953315
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.13.0.tgz#61ac7811ea52791c47dc9fd4dd4a184fae9ac355"
@@ -3300,6 +3320,16 @@
33003320
"@typescript-eslint/typescript-estree" "1.13.0"
33013321
eslint-visitor-keys "^1.0.0"
33023322

3323+
"@typescript-eslint/parser@^2.1.0":
3324+
version "2.1.0"
3325+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.1.0.tgz#ca62b26fa6a5a34ecdec4a000f22baf103791830"
3326+
integrity sha512-0+hzirRJoqE1T4lSSvCfKD+kWjIpDWfbGBiisK5CENcr+22pPkHB2sfV1giON+UxHV4A08SSrQonZk7X2zIQdw==
3327+
dependencies:
3328+
"@types/eslint-visitor-keys" "^1.0.0"
3329+
"@typescript-eslint/experimental-utils" "2.1.0"
3330+
"@typescript-eslint/typescript-estree" "2.1.0"
3331+
eslint-visitor-keys "^1.0.0"
3332+
33033333
"@typescript-eslint/[email protected]":
33043334
version "1.13.0"
33053335
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
@@ -3308,6 +3338,16 @@
33083338
lodash.unescape "4.0.1"
33093339
semver "5.5.0"
33103340

3341+
"@typescript-eslint/[email protected]":
3342+
version "2.1.0"
3343+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.1.0.tgz#88e676cc9760516711f6fe43958adc31b93de8e5"
3344+
integrity sha512-482ErJJ7QYghBh+KA9G+Fwcuk/PLTy+9NBMz8S+6UFrUUnVvHRNAL7I70kdws2te0FBYEZW7pkDaXoT+y8UARw==
3345+
dependencies:
3346+
glob "^7.1.4"
3347+
is-glob "^4.0.1"
3348+
lodash.unescape "4.0.1"
3349+
semver "^6.2.0"
3350+
33113351
"@unimodules/core@~3.0.0":
33123352
version "3.0.2"
33133353
resolved "https://registry.yarnpkg.com/@unimodules/core/-/core-3.0.2.tgz#a2b143fb1e743809ba17c60ae1848f82b8637901"
@@ -7305,7 +7345,7 @@ eslint-scope@^5.0.0:
73057345
esrecurse "^4.1.0"
73067346
estraverse "^4.1.1"
73077347

7308-
eslint-utils@^1.3.1, eslint-utils@^1.4.2:
7348+
eslint-utils@^1.3.1, eslint-utils@^1.4.0, eslint-utils@^1.4.2:
73097349
version "1.4.2"
73107350
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab"
73117351
integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q==
@@ -17557,7 +17597,7 @@ tslib@^1.8.1, tslib@^1.9.0:
1755717597
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
1755817598
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
1755917599

17560-
tsutils@^3.7.0:
17600+
tsutils@^3.14.0, tsutils@^3.7.0:
1756117601
version "3.17.1"
1756217602
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
1756317603
integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==

0 commit comments

Comments
 (0)