Skip to content

Commit 8a112d7

Browse files
committed
feat: upgrade eslint-config-airbnb-typescript to 7.2.0
BREAKING CHANGE: linting TypeScript files now requires `parserOptions.project` to be specified in your ESLint configuration. If your `tsconfig.json` is at your project root, chances are you'll be fine with no changes as this project attempts to configure ESLint for that scenario. However, if you have your `tsconfig.json` elsewhere or have some other custom setup you will likely need to specify `parserOptions.project` in your `.eslintrc.json` to point at your `tsconfig.json`
1 parent c02a45c commit 8a112d7

File tree

3 files changed

+91
-40
lines changed

3 files changed

+91
-40
lines changed

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"@rollup/plugin-node-resolve": "^7.1.1",
5959
"@rollup/plugin-replace": "^2.3.1",
6060
"@types/jest": "^25.1.3",
61-
"@typescript-eslint/eslint-plugin": "^2.16.0",
61+
"@typescript-eslint/eslint-plugin": "^2.25.0",
62+
"@typescript-eslint/parser": "^2.25.0",
6263
"arrify": "^2.0.1",
6364
"babel-jest": "^25.1.0",
6465
"babel-plugin-macros": "^2.8.0",
@@ -67,15 +68,15 @@
6768
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
6869
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
6970
"browserslist": "^4.8.7",
70-
"commitizen": "^4.0.3",
7171
"chalk": "^3.0.0",
72+
"commitizen": "^4.0.3",
7273
"concurrently": "^5.1.0",
7374
"cosmiconfig": "^6.0.0",
7475
"cross-env": "^7.0.0",
7576
"cross-spawn": "^7.0.1",
7677
"doctoc": "^1.4.0",
7778
"eslint": "^6.8.0",
78-
"eslint-config-airbnb-typescript": "^6.3.1",
79+
"eslint-config-airbnb-typescript": "^7.2.0",
7980
"eslint-config-kentcdodds": "^14.8.0",
8081
"eslint-config-prettier": "^6.10.0",
8182
"eslint-plugin-import": "^2.20.0",

src/config/helpers/eslint.js

+21
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ const prettier = withBaseConfig('eslint-config-prettier')
1111

1212
const hasReact = hasAnyDep('react')
1313

14+
const parserRules = (typescript = false) => {
15+
const isOff = off => (off ? 'off' : 'error')
16+
17+
return {
18+
'no-implied-eval': isOff(typescript),
19+
'no-throw-literal': isOff(typescript),
20+
'@typescript-eslint/no-implied-eval': isOff(!typescript),
21+
'@typescript-eslint/no-throw-literal': isOff(!typescript),
22+
}
23+
}
24+
1425
const buildConfig = ({withReact = false} = {}) => {
1526
const ifReact = (t, f) => (withReact || hasReact ? t : f)
1627

@@ -35,8 +46,18 @@ const buildConfig = ({withReact = false} = {}) => {
3546
optionalDependencies: false,
3647
},
3748
],
49+
...parserRules(),
3850
},
3951
overrides: [
52+
{
53+
files: ['**/*.ts?(x)'],
54+
parserOptions: {
55+
project: './tsconfig.json',
56+
},
57+
rules: {
58+
...parserRules(true),
59+
},
60+
},
4061
{
4162
files: testMatch,
4263
rules: {

yarn.lock

+66-37
Original file line numberDiff line numberDiff line change
@@ -1450,25 +1450,25 @@
14501450
dependencies:
14511451
"@types/yargs-parser" "*"
14521452

1453-
"@typescript-eslint/eslint-plugin@^2.16.0":
1454-
version "2.23.0"
1455-
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz#aa7133bfb7b685379d9eafe4ae9e08b9037e129d"
1456-
integrity sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==
1453+
"@typescript-eslint/eslint-plugin@^2.25.0":
1454+
version "2.25.0"
1455+
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.25.0.tgz#0b60917332f20dcff54d0eb9be2a9e9f4c9fbd02"
1456+
integrity sha512-W2YyMtjmlrOjtXc+FtTelVs9OhuR6OlYc4XKIslJ8PUJOqgYYAPRJhAqkYRQo3G4sjvG8jSodsNycEn4W2gHUw==
14571457
dependencies:
1458-
"@typescript-eslint/experimental-utils" "2.23.0"
1459-
eslint-utils "^1.4.3"
1458+
"@typescript-eslint/experimental-utils" "2.25.0"
14601459
functional-red-black-tree "^1.0.1"
14611460
regexpp "^3.0.0"
14621461
tsutils "^3.17.1"
14631462

1464-
"@typescript-eslint/experimental-utils@2.23.0", "@typescript-eslint/experimental-utils@^2.5.0":
1465-
version "2.23.0"
1466-
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz#5d2261c8038ec1698ca4435a8da479c661dc9242"
1467-
integrity sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==
1463+
"@typescript-eslint/experimental-utils@2.25.0":
1464+
version "2.25.0"
1465+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.25.0.tgz#13691c4fe368bd377b1e5b1e4ad660b220bf7714"
1466+
integrity sha512-0IZ4ZR5QkFYbaJk+8eJ2kYeA+1tzOE1sBjbwwtSV85oNWYUBep+EyhlZ7DLUCyhMUGuJpcCCFL0fDtYAP1zMZw==
14681467
dependencies:
14691468
"@types/json-schema" "^7.0.3"
1470-
"@typescript-eslint/typescript-estree" "2.23.0"
1469+
"@typescript-eslint/typescript-estree" "2.25.0"
14711470
eslint-scope "^5.0.0"
1471+
eslint-utils "^2.0.0"
14721472

14731473
"@typescript-eslint/experimental-utils@^1.13.0":
14741474
version "1.13.0"
@@ -1479,14 +1479,23 @@
14791479
"@typescript-eslint/typescript-estree" "1.13.0"
14801480
eslint-scope "^4.0.0"
14811481

1482-
"@typescript-eslint/parser@^2.3.0":
1482+
"@typescript-eslint/experimental-utils@^2.5.0":
14831483
version "2.23.0"
1484-
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.23.0.tgz#f3d4e2928ff647fe77fc2fcef1a3534fee6a3212"
1485-
integrity sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==
1484+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz#5d2261c8038ec1698ca4435a8da479c661dc9242"
1485+
integrity sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==
14861486
dependencies:
1487-
"@types/eslint-visitor-keys" "^1.0.0"
1488-
"@typescript-eslint/experimental-utils" "2.23.0"
1487+
"@types/json-schema" "^7.0.3"
14891488
"@typescript-eslint/typescript-estree" "2.23.0"
1489+
eslint-scope "^5.0.0"
1490+
1491+
"@typescript-eslint/parser@^2.24.0", "@typescript-eslint/parser@^2.25.0":
1492+
version "2.25.0"
1493+
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.25.0.tgz#abfb3d999084824d9a756d9b9c0f36fba03adb76"
1494+
integrity sha512-mccBLaBSpNVgp191CP5W+8U1crTyXsRziWliCqzj02kpxdjKMvFHGJbK33NroquH3zB/gZ8H511HEsJBa2fNEg==
1495+
dependencies:
1496+
"@types/eslint-visitor-keys" "^1.0.0"
1497+
"@typescript-eslint/experimental-utils" "2.25.0"
1498+
"@typescript-eslint/typescript-estree" "2.25.0"
14901499
eslint-visitor-keys "^1.1.0"
14911500

14921501
"@typescript-eslint/typescript-estree@1.13.0":
@@ -1510,6 +1519,19 @@
15101519
semver "^6.3.0"
15111520
tsutils "^3.17.1"
15121521

1522+
"@typescript-eslint/typescript-estree@2.25.0":
1523+
version "2.25.0"
1524+
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.25.0.tgz#b790497556734b7476fa7dd3fa539955a5c79e2c"
1525+
integrity sha512-VUksmx5lDxSi6GfmwSK7SSoIKSw9anukWWNitQPqt58LuYrKalzsgeuignbqnB+rK/xxGlSsCy8lYnwFfB6YJg==
1526+
dependencies:
1527+
debug "^4.1.1"
1528+
eslint-visitor-keys "^1.1.0"
1529+
glob "^7.1.6"
1530+
is-glob "^4.0.1"
1531+
lodash "^4.17.15"
1532+
semver "^6.3.0"
1533+
tsutils "^3.17.1"
1534+
15131535
"@webassemblyjs/ast@1.8.5":
15141536
version "1.8.5"
15151537
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359"
@@ -2769,7 +2791,7 @@ concurrently@^5.1.0:
27692791
tree-kill "^1.2.2"
27702792
yargs "^13.3.0"
27712793

2772-
confusing-browser-globals@^1.0.7:
2794+
confusing-browser-globals@^1.0.9:
27732795
version "1.0.9"
27742796
resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd"
27752797
integrity sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==
@@ -3412,32 +3434,32 @@ escodegen@^1.11.1:
34123434
optionalDependencies:
34133435
source-map "~0.6.1"
34143436

3415-
eslint-config-airbnb-base@^14.0.0:
3416-
version "14.0.0"
3417-
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.0.0.tgz#8a7bcb9643d13c55df4dd7444f138bf4efa61e17"
3418-
integrity sha512-2IDHobw97upExLmsebhtfoD3NAKhV4H0CJWP3Uprd/uk+cHuWYOczPVxQ8PxLFUAw7o3Th1RAU8u1DoUpr+cMA==
3437+
eslint-config-airbnb-base@^14.1.0:
3438+
version "14.1.0"
3439+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.1.0.tgz#2ba4592dd6843258221d9bff2b6831bd77c874e4"
3440+
integrity sha512-+XCcfGyCnbzOnktDVhwsCAx+9DmrzEmuwxyHUJpw+kqBVT744OUBrB09khgFKlK1lshVww6qXGsYPZpavoNjJw==
34193441
dependencies:
3420-
confusing-browser-globals "^1.0.7"
3442+
confusing-browser-globals "^1.0.9"
34213443
object.assign "^4.1.0"
3422-
object.entries "^1.1.0"
3444+
object.entries "^1.1.1"
34233445

3424-
eslint-config-airbnb-typescript@^6.3.1:
3425-
version "6.3.2"
3426-
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-6.3.2.tgz#d63d30f1f6b54fefdf619e0aa1e622d0f8bbccda"
3427-
integrity sha512-JdwaDl+0vX223MSKRyY+K8tQzrTcVDc3xCd3BtpQ4wsvu74Nbvvz7Ikuo/9ddFGZ2bNrYkfmXsPPrTdBJIxYug==
3446+
eslint-config-airbnb-typescript@^7.2.0:
3447+
version "7.2.0"
3448+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-7.2.0.tgz#afa7cea5657c9f70c0b96d52bf7d470e9827b66a"
3449+
integrity sha512-W7IZUIJpBZIzU3p65KoyJPl2vGSy6FS3R+K91Cp3NLK/0m1oyvCFeBHI2QlWdqxkJ4FvwnLvsoRTutwpKNIT+A==
34283450
dependencies:
3429-
"@typescript-eslint/parser" "^2.3.0"
3430-
eslint-config-airbnb "^18.0.1"
3431-
eslint-config-airbnb-base "^14.0.0"
3451+
"@typescript-eslint/parser" "^2.24.0"
3452+
eslint-config-airbnb "^18.1.0"
3453+
eslint-config-airbnb-base "^14.1.0"
34323454

3433-
eslint-config-airbnb@^18.0.1:
3434-
version "18.0.1"
3435-
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-18.0.1.tgz#a3a74cc29b46413b6096965025381df8fb908559"
3436-
integrity sha512-hLb/ccvW4grVhvd6CT83bECacc+s4Z3/AEyWQdIT2KeTsG9dR7nx1gs7Iw4tDmGKozCNHFn4yZmRm3Tgy+XxyQ==
3455+
eslint-config-airbnb@^18.1.0:
3456+
version "18.1.0"
3457+
resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-18.1.0.tgz#724d7e93dadd2169492ff5363c5aaa779e01257d"
3458+
integrity sha512-kZFuQC/MPnH7KJp6v95xsLBf63G/w7YqdPfQ0MUanxQ7zcKUNG8j+sSY860g3NwCBOa62apw16J6pRN+AOgXzw==
34373459
dependencies:
3438-
eslint-config-airbnb-base "^14.0.0"
3460+
eslint-config-airbnb-base "^14.1.0"
34393461
object.assign "^4.1.0"
3440-
object.entries "^1.1.0"
3462+
object.entries "^1.1.1"
34413463

34423464
eslint-config-kentcdodds@^14.8.0:
34433465
version "14.8.0"
@@ -3608,6 +3630,13 @@ eslint-utils@^1.4.3:
36083630
dependencies:
36093631
eslint-visitor-keys "^1.1.0"
36103632

3633+
eslint-utils@^2.0.0:
3634+
version "2.0.0"
3635+
resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.0.0.tgz#7be1cc70f27a72a76cd14aa698bcabed6890e1cd"
3636+
integrity sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==
3637+
dependencies:
3638+
eslint-visitor-keys "^1.1.0"
3639+
36113640
eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0:
36123641
version "1.1.0"
36133642
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2"
@@ -6481,7 +6510,7 @@ object.assign@^4.1.0:
64816510
has-symbols "^1.0.0"
64826511
object-keys "^1.0.11"
64836512

6484-
object.entries@^1.1.0, object.entries@^1.1.1:
6513+
object.entries@^1.1.1:
64856514
version "1.1.1"
64866515
resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.1.tgz#ee1cf04153de02bb093fec33683900f57ce5399b"
64876516
integrity sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ==

0 commit comments

Comments
 (0)