Skip to content

Commit b94c0d0

Browse files
committed
feat: support ESLint 8.x
BREAKING CHANGE: Requires Node@^12.22.0 || ^14.17.0 || >=16.0.0 BREAKING CHANGE: Requires ESLint@^8.0.0
1 parent 70e2868 commit b94c0d0

File tree

7 files changed

+48
-61
lines changed

7 files changed

+48
-61
lines changed

.github/workflows/validate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: ${{ !contains(github.head_ref, 'all-contributors') }}
1717
strategy:
1818
matrix:
19-
node: [10, 12, 14, 16]
19+
node: [12.22.0, 12, 14.17.0, 14, '16.0', 16]
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: 🛑 Cancel Previous Runs
@@ -50,15 +50,15 @@ jobs:
5050
github.ref) && github.event_name == 'push' }}
5151
steps:
5252
- name: 🛑 Cancel Previous Runs
53-
uses: styfle/[email protected].0
53+
uses: styfle/[email protected].1
5454

5555
- name: ⬇️ Checkout repo
5656
uses: actions/checkout@v2
5757

5858
- name: ⎔ Setup node
5959
uses: actions/setup-node@v2
6060
with:
61-
node-version: 14
61+
node-version: 16
6262

6363
- name: 📥 Download deps
6464
uses: bahmutov/npm-install@v1

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,16 @@ for it.
9797
### Things to know
9898

9999
- The default config uses `@babel/eslint-parser` to support stage features that
100-
ESLint doesn't support and it opts to use the `@babel/eslint-plugin` rules
100+
ESLint doesn't support. It also opts to use the `@babel/eslint-plugin` rules
101101
over the ESLint rules to support rules for these features as well.
102102
- All plugins needed for rules used by these configs are dependencies of this
103103
module so you don't have to install anything on your own.
104-
- The default config actually is composed of several configurations and you can
105-
use those individually. These are the configs it's using:
106-
`possible-errors.js`, `best-practices.js`, `stylistic.js`, `es6/index.js`, and
107-
`import/index.js`. You can use each of these configs yourself if you want to
108-
leave my own personal style out of it. Also, the `es6` and `import` configs
109-
each have a `possible-errors.js`, `best-practices.js`, and `stylistic.js`
110-
which they are composed of as well.
104+
- The default config actually is composed of several configurations which can be
105+
used individually. These are the configs it's using: `possible-errors.js`,
106+
`best-practices.js`, `stylistic.js`, `es6/index.js`, and `import/index.js`.
107+
You can use each of these configs yourself if you want to leave my own
108+
personal style out of it. The `import` config also has a `possible-errors.js`,
109+
`best-practices.js`, and `stylistic.js` which it is composed of as well.
111110

112111
#### Example of highly customized config
113112

@@ -116,7 +115,6 @@ module.exports = {
116115
extends: [
117116
'kentcdodds/possible-errors',
118117
'kentcdodds/best-practices',
119-
'kentcdodds/es6/possible-errors',
120118
'kentcdodds/import',
121119
'kentcdodds/jest',
122120
],

best-practices.js

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
'no-caller': 'error',
2020
'no-case-declarations': 'error',
2121
'no-constructor-return': 'error',
22+
'no-delete-var': 'error',
2223
'no-div-regex': 'error',
2324
'no-else-return': 'off',
2425
'no-empty-function': 'off', // we're all grown ups here...
@@ -35,6 +36,7 @@ module.exports = {
3536
'no-implied-eval': 'error',
3637
'no-invalid-this': 'error',
3738
'no-iterator': 'error',
39+
'no-label-var': 'error',
3840
'no-labels': 'error',
3941
'no-lone-blocks': 'error',
4042
'no-loop-func': 'error',
@@ -49,17 +51,32 @@ module.exports = {
4951
'no-param-reassign': 'off',
5052
'no-proto': 'error',
5153
'no-redeclare': 'error',
54+
'no-restricted-globals': ['error', 'event', 'fdescribe'],
5255
'no-restricted-properties': 'off', // no ideas of what to disallow right now...
5356
'no-return-assign': 'error',
5457
'no-return-await': 'error',
5558
'no-script-url': 'error',
5659
'no-self-assign': 'error',
5760
'no-self-compare': 'error',
5861
'no-sequences': 'error',
62+
'no-shadow': 'error',
63+
'no-shadow-restricted-names': 'error',
5964
'no-throw-literal': 'error',
65+
'no-undef': 'error',
66+
'no-undef-init': 'error',
67+
'no-undefined': 'off',
6068
'no-unmodified-loop-condition': 'error',
6169
'no-unused-expressions': 'off',
6270
'no-unused-labels': 'error',
71+
'no-unused-vars': [
72+
'error',
73+
{
74+
argsIgnorePattern: '^_',
75+
varsIgnorePattern: '^ignored',
76+
args: 'after-used',
77+
ignoreRestSiblings: true,
78+
},
79+
],
6380
'no-useless-call': 'error',
6481
'no-useless-catch': 'error',
6582
'no-useless-concat': 'error',
@@ -74,30 +91,9 @@ module.exports = {
7491
radix: 'error',
7592
'require-await': 'off',
7693
'require-unicode-regexp': 'off',
94+
strict: 'error',
7795
'vars-on-top': 'error',
7896
yoda: 'error',
79-
80-
// strict
81-
strict: 'error',
82-
83-
// variables
84-
'no-delete-var': 'error',
85-
'no-label-var': 'error',
86-
'no-restricted-globals': ['error', 'event', 'fdescribe'],
87-
'no-shadow': 'error',
88-
'no-shadow-restricted-names': 'error',
89-
'no-undef': 'error',
90-
'no-undef-init': 'error',
91-
'no-undefined': 'off',
92-
'no-unused-vars': [
93-
'error',
94-
{
95-
argsIgnorePattern: '^_',
96-
varsIgnorePattern: '^ignored',
97-
args: 'after-used',
98-
ignoreRestSiblings: true,
99-
},
100-
],
10197
},
10298
overrides: [
10399
{
@@ -209,8 +205,6 @@ module.exports = {
209205
'@typescript-eslint/switch-exhaustiveness-check': 'error',
210206
'@typescript-eslint/triple-slash-reference': 'error',
211207
'@typescript-eslint/unbound-method': 'error',
212-
213-
// variables
214208
'@typescript-eslint/unified-signatures': 'warn',
215209
},
216210
},

jest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const rules = {
9999
'testing-library/no-await-sync-events': 'error',
100100
'testing-library/no-await-sync-query': 'error',
101101
'testing-library/no-container': 'error',
102-
'testing-library/no-debug': 'error',
102+
'testing-library/no-debugging-utils': 'error',
103103
'testing-library/no-dom-import': ['error', 'react'],
104104
'testing-library/no-manual-cleanup': 'error',
105105
'testing-library/no-node-access': 'error',

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,38 @@
3333
},
3434
"homepage": "https://github.com/kentcdodds/eslint-config-kentcdodds#readme",
3535
"dependencies": {
36-
"@babel/core": "^7.15.5",
37-
"@babel/eslint-parser": "^7.15.4",
36+
"@babel/core": "^7.16.0",
37+
"@babel/eslint-parser": "^7.16.3",
3838
"@babel/eslint-plugin": "^7.14.5",
39-
"@babel/preset-react": "^7.14.5",
40-
"@typescript-eslint/eslint-plugin": "^4.30.0",
41-
"@typescript-eslint/parser": "^4.30.0",
39+
"@babel/preset-react": "^7.16.0",
40+
"@typescript-eslint/eslint-plugin": "^5.3.1",
41+
"@typescript-eslint/parser": "^5.3.1",
4242
"eslint-config-prettier": "^8.3.0",
43-
"eslint-plugin-import": "^2.24.2",
44-
"eslint-plugin-jest": "^24.4.0",
45-
"eslint-plugin-jest-dom": "^3.9.0",
46-
"eslint-plugin-jsx-a11y": "^6.4.1",
47-
"eslint-plugin-react": "^7.25.1",
48-
"eslint-plugin-react-hooks": "^4.2.0",
49-
"eslint-plugin-testing-library": "^4.12.0",
43+
"eslint-plugin-import": "^2.25.3",
44+
"eslint-plugin-jest": "^25.2.4",
45+
"eslint-plugin-jest-dom": "^3.9.2",
46+
"eslint-plugin-jsx-a11y": "^6.5.1",
47+
"eslint-plugin-react": "^7.27.0",
48+
"eslint-plugin-react-hooks": "^4.3.0",
49+
"eslint-plugin-testing-library": "^5.0.0",
5050
"read-pkg-up": "^7.0.1",
5151
"semver": "^7.3.5"
5252
},
5353
"devDependencies": {
5454
"@testing-library/dom": "^7.31.2",
5555
"@testing-library/jest-dom": "^5.14.1",
56-
"eslint": "^7.32.0",
57-
"eslint-find-rules": "^3.6.1",
56+
"eslint": "^8.2.0",
57+
"eslint-find-rules": "^4.0.0",
5858
"husky": "^6.0.0",
5959
"jest": "^27.1.0",
6060
"npm-run-all": "^4.1.5",
6161
"prettier": "^2.3.2",
6262
"pretty-quick": "^3.1.1",
6363
"react": "^17.0.2",
64-
"typescript": "^4.4.2"
64+
"typescript": "^4.4.4"
6565
},
6666
"peerDependencies": {
67-
"eslint": "^7.5.0",
67+
"eslint": "^8.0.0",
6868
"typescript": "^4.0.0"
6969
},
7070
"peerDependenciesMeta": {
@@ -81,7 +81,7 @@
8181
"dist"
8282
],
8383
"engines": {
84-
"node": "^10.12.0 || >=12.0.0",
84+
"node": "^12.22.0 || ^14.17.0 || >=16.0.0",
8585
"npm": ">=6",
8686
"yarn": ">=1"
8787
}

possible-errors.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ module.exports = {
3737
'no-unreachable-loop': 'error',
3838
'no-unsafe-finally': 'error',
3939
'no-unsafe-negation': 'error',
40+
'no-use-before-define': ['error', 'nofunc'],
4041
'no-useless-backreference': 'error',
4142
'require-atomic-updates': 'off',
4243
'use-isnan': 'error',
4344
'valid-typeof': 'error',
44-
45-
// variables
46-
'no-use-before-define': ['error', 'nofunc'],
4745
},
4846
overrides: [
4947
{

stylistic.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ module.exports = {
1515
// camelCase, PascalCase, __filename, CONST_VALUE, stream$, $el
1616
'^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$',
1717
],
18+
'init-declarations': 'off',
1819
'line-comment-position': 'off',
1920
'lines-between-class-members': 'off',
2021
'max-depth': ['error', 4],
2122
'max-lines': [
2223
'error',
2324
{max: 2500, skipBlankLines: false, skipComments: false},
2425
],
25-
2626
'max-lines-per-function': 'off', // this becomes an obvious problem when it's actually a problem...
2727
'max-nested-callbacks': ['error', 7],
2828
'max-params': ['error', 7],
@@ -52,9 +52,6 @@ module.exports = {
5252
'sort-keys': 'off',
5353
'sort-vars': 'off',
5454
'spaced-comment': 'off',
55-
56-
// variables
57-
'init-declarations': 'off',
5855
},
5956
overrides: [
6057
{

0 commit comments

Comments
 (0)