Skip to content
This repository was archived by the owner on Mar 29, 2020. It is now read-only.

Commit 312a62c

Browse files
committed
feat: add typescript config ⚡️
1 parent 6018bd4 commit 312a62c

File tree

4 files changed

+71
-4
lines changed

4 files changed

+71
-4
lines changed

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,20 @@
2727
"lodash.js",
2828
"react-base.js",
2929
"react-native.js",
30-
"react.js"
30+
"react.js",
31+
"typescript.js"
3132
],
3233
"scripts": {
3334
"lint": "eslint .",
3435
"lint:fix": "eslint --cache --fix .",
36+
"find-new-rules:babel": "eslint-find-rules --unused ./test/fixtures/babel.js",
3537
"find-new-rules:base": "eslint-find-rules --unused ./index.js",
36-
"find-new-rules:babel": "eslint-find-rules --unused ./babel.js",
3738
"find-new-rules:flowtype": "eslint-find-rules --unused ./test/fixtures/flowtype.js",
3839
"find-new-rules:jest": "eslint-find-rules --unused ./test/fixtures/jest.js",
3940
"find-new-rules:lodash": "eslint-find-rules --unused ./test/fixtures/lodash.js",
4041
"find-new-rules:react-native": "eslint-find-rules --unused ./test/fixtures/react-native.js",
4142
"find-new-rules:react": "eslint-find-rules --unused ./test/fixtures/react.js",
43+
"find-new-rules:typescript": "eslint-find-rules --unused ./test/fixtures/typescript.js",
4244
"find-new-rules": "run-p --silent find-new-rules:*",
4345
"prettier-check": "eslint --print-config index.js | eslint-config-prettier-check",
4446
"jest": "jest",
@@ -83,7 +85,9 @@
8385
"eslint-plugin-promise": "^3.5.0",
8486
"eslint-plugin-react": "^7.0.1",
8587
"eslint-plugin-react-native": "^2.3.2",
86-
"eslint-plugin-unicorn": "^2.1.1"
88+
"eslint-plugin-typescript": "^0.3.0",
89+
"eslint-plugin-unicorn": "^2.1.1",
90+
"typescript-eslint-parser": "^4.0.0"
8791
},
8892
"devDependencies": {
8993
"eslint": "^3.19.0",

test/fixtures/typescript.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['../../index.js', '../../typescript.js'],
3+
};

typescript.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
plugins: ['typescript'],
3+
parser: 'typescript-eslint-parser',
4+
settings: {
5+
'import/resolver': {
6+
node: {
7+
extensions: ['.js', '.ts', '.json'],
8+
},
9+
},
10+
'import/extensions': ['.js', '.ts'],
11+
},
12+
rules: {
13+
'no-undef': 'off', // conflicts with typescript
14+
'no-unused-vars': 'off', // conflicts with typescript
15+
'no-useless-constructor': 'off', // conflicts with typescript
16+
strict: 'off', // conflicts with typescript
17+
// https://github.com/benmosher/eslint-plugin-import
18+
'import/extensions': [
19+
'error',
20+
'always',
21+
{
22+
js: 'never',
23+
ts: 'never',
24+
},
25+
],
26+
'import/no-named-as-default-member': 'off', // conflicts with typescript
27+
'import/no-named-as-default': 'off', // conflicts with typescript
28+
// https://github.com/nzakas/eslint-plugin-typescript
29+
'typescript/explicit-member-accessibility': 'error',
30+
'typescript/interface-name-prefix': 'error',
31+
'typescript/no-angle-bracket-type-assertion': 'error',
32+
'typescript/no-explicit-any': 'error',
33+
'typescript/no-namespace': 'error',
34+
'typescript/no-triple-slash-reference': 'error',
35+
'typescript/no-unused-vars': 'error',
36+
'typescript/prefer-namespace-keyword': 'error',
37+
'typescript/type-annotation-spacing': 'off',
38+
},
39+
};

yarn.lock

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,12 @@ eslint-plugin-react@^7.0.1:
11891189
has "^1.0.1"
11901190
jsx-ast-utils "^1.4.1"
11911191

1192+
eslint-plugin-typescript@^0.3.0:
1193+
version "0.3.0"
1194+
resolved "https://registry.yarnpkg.com/eslint-plugin-typescript/-/eslint-plugin-typescript-0.3.0.tgz#bc3525ef3a7f35e0e6eaaa0161733c82673173fd"
1195+
dependencies:
1196+
requireindex "~1.1.0"
1197+
11921198
eslint-plugin-unicorn@^2.1.1:
11931199
version "2.1.2"
11941200
resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-2.1.2.tgz#99dffe9f4773b04bc39356a7febd64dd700274bc"
@@ -2676,6 +2682,10 @@ lodash.snakecase@^4.0.1:
26762682
version "4.1.1"
26772683
resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d"
26782684

2685+
lodash.unescape@4.0.1:
2686+
version "4.0.1"
2687+
resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c"
2688+
26792689
lodash.upperfirst@^4.2.0:
26802690
version "4.3.1"
26812691
resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
@@ -3515,6 +3525,10 @@ require-uncached@^1.0.2:
35153525
caller-path "^0.1.0"
35163526
resolve-from "^1.0.0"
35173527

3528+
requireindex@~1.1.0:
3529+
version "1.1.0"
3530+
resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162"
3531+
35183532
resolve-from@^1.0.0:
35193533
version "1.0.1"
35203534
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
@@ -3625,7 +3639,7 @@ semver-regex@1.0.0:
36253639
version "1.0.0"
36263640
resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-1.0.0.tgz#92a4969065f9c70c694753d55248fc68f8f652c9"
36273641

3628-
"semver@2 >=2.2.1 || 3.x || 4 || 5", "semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0:
3642+
"semver@2 >=2.2.1 || 3.x || 4 || 5", "semver@2 || 3 || 4 || 5", semver@5.3.0, semver@^5.0.3, semver@^5.1.0, semver@^5.2.0, semver@^5.3.0:
36293643
version "5.3.0"
36303644
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
36313645

@@ -4001,6 +4015,13 @@ typedarray@~0.0.5:
40014015
version "0.0.6"
40024016
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
40034017

4018+
typescript-eslint-parser@^4.0.0:
4019+
version "4.0.0"
4020+
resolved "https://registry.yarnpkg.com/typescript-eslint-parser/-/typescript-eslint-parser-4.0.0.tgz#263d836484c51d4577a3c11aa520f64191a6e58f"
4021+
dependencies:
4022+
lodash.unescape "4.0.1"
4023+
semver "5.3.0"
4024+
40044025
uglify-js@^2.6:
40054026
version "2.8.28"
40064027
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.28.tgz#e335032df9bb20dcb918f164589d5af47f38834a"

0 commit comments

Comments
 (0)