Skip to content

Commit 3e9b562

Browse files
committed
feat(lint): configure linting using Airbnb + TypeScript + Prettier configs/plugins
1 parent 596d89b commit 3e9b562

File tree

3 files changed

+109
-10
lines changed

3 files changed

+109
-10
lines changed

Diff for: package.json

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"@babel/preset-flow": "^7.0.0",
4444
"@babel/preset-react": "^7.0.0",
4545
"@babel/runtime": "^7.5.4",
46+
"@typescript-eslint/eslint-plugin": "^1.13.0",
4647
"arrify": "^2.0.1",
4748
"babel-core": "^7.0.0-0",
4849
"babel-jest": "^24.8.0",
@@ -57,8 +58,13 @@
5758
"cross-spawn": "^6.0.5",
5859
"doctoc": "^1.4.0",
5960
"eslint": "^6.0.1",
61+
"eslint-config-airbnb-typescript": "^4.0.1",
6062
"eslint-config-kentcdodds": "^14.3.4",
6163
"eslint-config-prettier": "^6.0.0",
64+
"eslint-plugin-import": "^2.18.2",
65+
"eslint-plugin-jsx-a11y": "^6.2.3",
66+
"eslint-plugin-prettier": "^3.1.0",
67+
"eslint-plugin-react": "^7.14.3",
6268
"glob": "^7.1.4",
6369
"husky": "^3.0.0",
6470
"is-ci": "^2.0.0",

Diff for: src/config/eslintrc.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
const {ifAnyDep} = require('../utils')
22

3+
const withBaseConfig = base => variant =>
4+
require.resolve(base + (variant ? `/${variant}` : ''))
5+
6+
const airbnb = withBaseConfig('eslint-config-airbnb-typescript')
7+
const prettier = withBaseConfig('eslint-config-prettier')
8+
39
module.exports = {
10+
plugins: require.resolve('eslint-plugin-prettier'),
411
extends: [
5-
require.resolve('eslint-config-kentcdodds'),
6-
require.resolve('eslint-config-kentcdodds/jest'),
7-
ifAnyDep('react', require.resolve('eslint-config-kentcdodds/jsx-a11y')),
8-
ifAnyDep('react', require.resolve('eslint-config-kentcdodds/react')),
12+
ifAnyDep('react', airbnb(), airbnb('base')),
13+
prettier(),
14+
prettier('@typescript-eslint'),
15+
ifAnyDep('react', prettier('react')),
916
].filter(Boolean),
10-
rules: {},
17+
rules: {
18+
'prettier/prettier': 'error',
19+
},
1120
}

Diff for: yarn.lock

+89-5
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,11 @@
10061006
dependencies:
10071007
"@babel/types" "^7.3.0"
10081008

1009+
"@types/eslint-visitor-keys@^1.0.0":
1010+
version "1.0.0"
1011+
resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
1012+
integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==
1013+
10091014
10101015
version "0.0.39"
10111016
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
@@ -1082,7 +1087,18 @@
10821087
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916"
10831088
integrity sha512-SOhuU4wNBxhhTHxYaiG5NY4HBhDIDnJF60GU+2LqHAdKKer86//e4yg69aENCtQ04n0ovz+tq2YPME5t5yp4pw==
10841089

1085-
"@typescript-eslint/experimental-utils@^1.13.0":
1090+
"@typescript-eslint/eslint-plugin@^1.13.0":
1091+
version "1.13.0"
1092+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.13.0.tgz#22fed9b16ddfeb402fd7bcde56307820f6ebc49f"
1093+
integrity sha512-WQHCozMnuNADiqMtsNzp96FNox5sOVpU8Xt4meaT4em8lOG1SrOv92/mUbEHQVh90sldKSfcOc/I0FOb/14G1g==
1094+
dependencies:
1095+
"@typescript-eslint/experimental-utils" "1.13.0"
1096+
eslint-utils "^1.3.1"
1097+
functional-red-black-tree "^1.0.1"
1098+
regexpp "^2.0.1"
1099+
tsutils "^3.7.0"
1100+
1101+
"@typescript-eslint/[email protected]", "@typescript-eslint/experimental-utils@^1.13.0":
10861102
version "1.13.0"
10871103
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.13.0.tgz#b08c60d780c0067de2fb44b04b432f540138301e"
10881104
integrity sha512-zmpS6SyqG4ZF64ffaJ6uah6tWWWgZ8m+c54XXgwFtUv0jNz8aJAVx8chMCvnk7yl6xwn8d+d96+tWp7fXzTuDg==
@@ -1091,6 +1107,16 @@
10911107
"@typescript-eslint/typescript-estree" "1.13.0"
10921108
eslint-scope "^4.0.0"
10931109

1110+
"@typescript-eslint/parser@^1.11.0":
1111+
version "1.13.0"
1112+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.13.0.tgz#61ac7811ea52791c47dc9fd4dd4a184fae9ac355"
1113+
integrity sha512-ITMBs52PCPgLb2nGPoeT4iU3HdQZHcPaZVw+7CsFagRJHUhyeTgorEwHXhFf3e7Evzi8oujKNpHc8TONth8AdQ==
1114+
dependencies:
1115+
"@types/eslint-visitor-keys" "^1.0.0"
1116+
"@typescript-eslint/experimental-utils" "1.13.0"
1117+
"@typescript-eslint/typescript-estree" "1.13.0"
1118+
eslint-visitor-keys "^1.0.0"
1119+
10941120
"@typescript-eslint/[email protected]":
10951121
version "1.13.0"
10961122
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.13.0.tgz#8140f17d0f60c03619798f1d628b8434913dc32e"
@@ -2181,6 +2207,11 @@ concurrently@^4.1.1:
21812207
tree-kill "^1.1.0"
21822208
yargs "^12.0.1"
21832209

2210+
confusing-browser-globals@^1.0.5:
2211+
version "1.0.7"
2212+
resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.7.tgz#5ae852bd541a910e7ffb2dbb864a2d21a36ad29b"
2213+
integrity sha512-cgHI1azax5ATrZ8rJ+ODDML9Fvu67PimB6aNxBrc/QwSaDaM9eTfIEUHx3bBLJJ82ioSb+/5zfsMCCEJax3ByQ==
2214+
21842215
console-browserify@^1.1.0:
21852216
version "1.1.0"
21862217
resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.1.0.tgz#f0241c45730a9fc6323b206dbf38edc741d0bb10"
@@ -2738,6 +2769,33 @@ escodegen@^1.9.1:
27382769
optionalDependencies:
27392770
source-map "~0.6.1"
27402771

2772+
eslint-config-airbnb-base@^13.1.0, eslint-config-airbnb-base@^13.2.0:
2773+
version "13.2.0"
2774+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.2.0.tgz#f6ea81459ff4dec2dda200c35f1d8f7419d57943"
2775+
integrity sha512-1mg/7eoB4AUeB0X1c/ho4vb2gYkNH8Trr/EgCT/aGmKhhG+F6vF5s8+iRBlWAzFIAphxIdp3YfEKgEl0f9Xg+w==
2776+
dependencies:
2777+
confusing-browser-globals "^1.0.5"
2778+
object.assign "^4.1.0"
2779+
object.entries "^1.1.0"
2780+
2781+
eslint-config-airbnb-typescript@^4.0.1:
2782+
version "4.0.1"
2783+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-4.0.1.tgz#516a95d6e8c495100973b0c49daa54bff0964434"
2784+
integrity sha512-4LHD0O0X1e08k+e8AngAsKPYNc7nL+5PzK7OEl9qZ6d7C+wo8BN2fMxBhhiUmRggJxArrldp7Dgb1s2f1/Robg==
2785+
dependencies:
2786+
"@typescript-eslint/parser" "^1.11.0"
2787+
eslint-config-airbnb "^17.1.0"
2788+
eslint-config-airbnb-base "^13.1.0"
2789+
2790+
eslint-config-airbnb@^17.1.0:
2791+
version "17.1.1"
2792+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-17.1.1.tgz#2272e0b86bb1e2b138cdf88d07a3b6f4cda3d626"
2793+
integrity sha512-xCu//8a/aWqagKljt+1/qAM62BYZeNq04HmdevG5yUGWpja0I/xhqd6GdLRch5oetEGFiJAnvtGuTEAese53Qg==
2794+
dependencies:
2795+
eslint-config-airbnb-base "^13.2.0"
2796+
object.assign "^4.1.0"
2797+
object.entries "^1.1.0"
2798+
27412799
eslint-config-kentcdodds@^14.3.4:
27422800
version "14.3.4"
27432801
resolved "https://registry.yarnpkg.com/eslint-config-kentcdodds/-/eslint-config-kentcdodds-14.3.4.tgz#49cde58dba48d76aec486b3eae65f2142bfa4ca2"
@@ -2802,7 +2860,7 @@ eslint-plugin-babel@^5.3.0:
28022860
dependencies:
28032861
eslint-rule-composer "^0.3.0"
28042862

2805-
eslint-plugin-import@^2.17.1:
2863+
eslint-plugin-import@^2.17.1, eslint-plugin-import@^2.18.2:
28062864
version "2.18.2"
28072865
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6"
28082866
integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==
@@ -2826,7 +2884,7 @@ eslint-plugin-jest@^22.4.1:
28262884
dependencies:
28272885
"@typescript-eslint/experimental-utils" "^1.13.0"
28282886

2829-
eslint-plugin-jsx-a11y@^6.2.1:
2887+
eslint-plugin-jsx-a11y@^6.2.1, eslint-plugin-jsx-a11y@^6.2.3:
28302888
version "6.2.3"
28312889
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.3.tgz#b872a09d5de51af70a97db1eea7dc933043708aa"
28322890
integrity sha512-CawzfGt9w83tyuVekn0GDPU9ytYtxyxyFZ3aSWROmnRRFQFT2BiPJd7jvRdzNDi6oLWaS2asMeYSNMjWTV4eNg==
@@ -2841,12 +2899,19 @@ eslint-plugin-jsx-a11y@^6.2.1:
28412899
has "^1.0.3"
28422900
jsx-ast-utils "^2.2.1"
28432901

2902+
eslint-plugin-prettier@^3.1.0:
2903+
version "3.1.0"
2904+
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d"
2905+
integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA==
2906+
dependencies:
2907+
prettier-linter-helpers "^1.0.0"
2908+
28442909
eslint-plugin-react-hooks@^1.6.0:
28452910
version "1.6.1"
28462911
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.1.tgz#3c66a5515ea3e0a221ffc5d4e75c971c217b1a4c"
28472912
integrity sha512-wHhmGJyVuijnYIJXZJHDUF2WM+rJYTjulUTqF9k61d3BTk8etydz+M4dXUVH7M76ZRS85rqBTCx0Es/lLsrjnA==
28482913

2849-
eslint-plugin-react@^7.13.0:
2914+
eslint-plugin-react@^7.13.0, eslint-plugin-react@^7.14.3:
28502915
version "7.14.3"
28512916
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz#911030dd7e98ba49e1b2208599571846a66bdf13"
28522917
integrity sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==
@@ -3127,6 +3192,11 @@ fast-deep-equal@^2.0.1:
31273192
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
31283193
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
31293194

3195+
fast-diff@^1.1.2:
3196+
version "1.2.0"
3197+
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
3198+
integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
3199+
31303200
fast-glob@^3.0.3:
31313201
version "3.0.4"
31323202
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.0.4.tgz#d484a41005cb6faeb399b951fd1bd70ddaebb602"
@@ -6012,6 +6082,13 @@ prelude-ls@~1.1.2:
60126082
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
60136083
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
60146084

6085+
prettier-linter-helpers@^1.0.0:
6086+
version "1.0.0"
6087+
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
6088+
integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
6089+
dependencies:
6090+
fast-diff "^1.1.2"
6091+
60156092
prettier@^1.18.2:
60166093
version "1.18.2"
60176094
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
@@ -7410,11 +7487,18 @@ trough@^1.0.0:
74107487
resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.4.tgz#3b52b1f13924f460c3fbfd0df69b587dbcbc762e"
74117488
integrity sha512-tdzBRDGWcI1OpPVmChbdSKhvSVurznZ8X36AYURAcl+0o2ldlCY2XPzyXNNxwJwwyIU+rIglTCG4kxtNKBQH7Q==
74127489

7413-
tslib@^1.9.0:
7490+
tslib@^1.8.1, tslib@^1.9.0:
74147491
version "1.10.0"
74157492
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
74167493
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
74177494

7495+
tsutils@^3.7.0:
7496+
version "3.17.0"
7497+
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.0.tgz#c3ccab927a475aa2beef6a3695c2ff76da13cdf8"
7498+
integrity sha512-fyveWOtAXfumAxIqkcMHuPaaVyLBKjB8Y00ANZkqh+HITBAQscCbQIHwwBTJdvQq7RykLEbOPcUUnJ16X4NA0g==
7499+
dependencies:
7500+
tslib "^1.8.1"
7501+
74187502
74197503
version "0.0.0"
74207504
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"

0 commit comments

Comments
 (0)