Skip to content

Commit d87d529

Browse files
authored
feat: update dependencies & add new rules (#137)
BREAKING CHANGE: Requires node v18+ and updates all rules to latest version
1 parent ffa5641 commit d87d529

7 files changed

Lines changed: 35 additions & 43 deletions

File tree

.github/workflows/validate.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
if: ${{ !contains(github.head_ref, 'all-contributors') }}
1717
strategy:
1818
matrix:
19-
node: [12.22.0, 12, 14.17.0, 14, 16.0.0, 16, 18]
19+
node: [18, 20]
20+
typescript-version: [^4.0.0, ^5.0.0]
2021
runs-on: ubuntu-latest
2122
steps:
2223
- name: 🛑 Cancel Previous Runs
@@ -35,6 +36,9 @@ jobs:
3536
with:
3637
useLockFile: false
3738

39+
- name: 🆃 Setup TypeScript
40+
run: npm i typescript@${{ matrix.typescript-version }}
41+
3842
- name: ▶️ Run validate script
3943
run: npm run validate
4044

@@ -58,7 +62,7 @@ jobs:
5862
- name: ⎔ Setup node
5963
uses: actions/setup-node@v3
6064
with:
61-
node-version: 16
65+
node-version: 20
6266

6367
- name: 📥 Download deps
6468
uses: bahmutov/npm-install@v1

index.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ module.exports = {
5454
],
5555
'init-declarations': 'off',
5656
'line-comment-position': 'off',
57-
'lines-between-class-members': 'off',
5857
'logical-assignment-operators': 'warn',
5958
'max-classes-per-file': 'off',
6059
'max-depth': ['error', 4],
@@ -66,7 +65,6 @@ module.exports = {
6665
'max-nested-callbacks': ['error', 7],
6766
'max-params': ['error', 7],
6867
'max-statements': 'off', // this becomes an obvious problem when it's actually a problem...
69-
'max-statements-per-line': ['error', {max: 1}],
7068
'multiline-comment-style': 'off', // this would be cool to get the fixer, but too strict.
7169
'new-cap': 'error',
7270
'no-alert': 'error',
@@ -94,7 +92,7 @@ module.exports = {
9492
'no-dupe-else-if': 'error',
9593
'no-dupe-keys': 'error',
9694
'no-duplicate-case': 'error',
97-
'no-duplicate-imports': 'error',
95+
'no-duplicate-imports': 'off', // turned off in favor of `import/no-duplicates`
9896
'no-else-return': 'off',
9997
'no-empty': 'error',
10098
'no-empty-character-class': 'error',
@@ -136,10 +134,10 @@ module.exports = {
136134
'no-new': 'error',
137135
'no-new-func': 'error',
138136
'no-new-native-nonconstructor': 'error',
139-
'no-new-object': 'error',
140137
'no-new-symbol': 'error',
141138
'no-new-wrappers': 'error',
142139
'no-nonoctal-decimal-escape': 'error',
140+
'no-object-constructor': 'error',
143141
'no-obj-calls': 'error',
144142
'no-octal': 'error',
145143
'no-octal-escape': 'error',
@@ -156,7 +154,6 @@ module.exports = {
156154
'no-restricted-properties': 'off', // no ideas of what to disallow right now...
157155
'no-restricted-syntax': ['error', 'WithStatement'],
158156
'no-return-assign': 'error',
159-
'no-return-await': 'error',
160157
'no-script-url': 'error',
161158
'no-self-assign': 'error',
162159
'no-self-compare': 'error',
@@ -209,7 +206,6 @@ module.exports = {
209206
'object-shorthand': ['error', 'properties'], // methods are optional so you can specify a name if you want
210207
'one-var': ['error', {initialized: 'never', uninitialized: 'always'}],
211208
'operator-assignment': 'off', // readability on a case-by-case basis
212-
'padding-line-between-statements': 'off', // meh...
213209
'prefer-arrow-callback': [
214210
'error',
215211
{allowNamedFunctions: true, allowUnboundThis: true},
@@ -234,10 +230,10 @@ module.exports = {
234230
'sort-imports': 'off',
235231
'sort-keys': 'off',
236232
'sort-vars': 'off',
237-
'spaced-comment': 'off',
238233
strict: 'error',
239234
'symbol-description': 'error',
240235
'use-isnan': 'error',
236+
'unicode-bom': ['error', 'never'],
241237
'valid-typeof': 'error',
242238
'vars-on-top': 'error',
243239
yoda: 'error',
@@ -284,18 +280,12 @@ module.exports = {
284280
'init-declarations': 'off',
285281
'@typescript-eslint/init-declarations': 'off',
286282

287-
'lines-between-class-members': 'off',
288-
'@typescript-eslint/lines-between-class-members': 'off',
289-
290283
'no-array-constructor': 'off',
291284
'@typescript-eslint/no-array-constructor': 'error',
292285

293286
'no-dupe-class-members': 'off',
294287
'@typescript-eslint/no-dupe-class-members': 'off', // ts(2393) & ts(2300)
295288

296-
'no-duplicate-imports': 'off',
297-
'@typescript-eslint/no-duplicate-imports': 'error',
298-
299289
'no-empty-function': 'off',
300290
'@typescript-eslint/no-empty-function': 'off',
301291

@@ -373,7 +363,6 @@ module.exports = {
373363
'@typescript-eslint/no-extraneous-class': 'error', // stay away from classes when you can
374364
'@typescript-eslint/no-floating-promises': 'warn', // not a bad rule, but can be annoying
375365
'@typescript-eslint/no-for-in-array': 'error',
376-
'@typescript-eslint/no-implicit-any-catch': 'warn',
377366
'@typescript-eslint/no-inferrable-types': 'off', // I personally prefer relying on inference where possible, but I don't want to lint for it.
378367
'@typescript-eslint/no-invalid-void-type': 'warn',
379368
'@typescript-eslint/no-misused-new': 'error',
@@ -384,7 +373,6 @@ module.exports = {
384373
'@typescript-eslint/no-namespace': 'error',
385374
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
386375
'@typescript-eslint/no-non-null-assertion': 'error',
387-
'@typescript-eslint/no-parameter-properties': 'error', // yeah, I don't like this feature
388376
'@typescript-eslint/no-require-imports': 'off', // sometimes you can't do it any other way
389377
'@typescript-eslint/no-this-alias': 'error',
390378
'@typescript-eslint/no-type-alias': 'off',
@@ -401,6 +389,7 @@ module.exports = {
401389
'@typescript-eslint/no-unsafe-return': 'off', // seems like an ok idea, but it failed on a regular React Component
402390
'@typescript-eslint/no-var-requires': 'error',
403391
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
392+
'@typescript-eslint/parameter-properties': 'error',
404393
'@typescript-eslint/prefer-as-const': 'error',
405394
'@typescript-eslint/prefer-enum-initializers': 'error', // makes total sense
406395
'@typescript-eslint/prefer-for-of': 'off', // I prefer for of, but I don't want to lint for it

jest.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module.exports = {
5555
'jest/no-commented-out-tests': 'warn',
5656
'jest/no-conditional-expect': 'error',
5757
'jest/no-conditional-in-test': 'error',
58+
'jest/no-confusing-set-timeout': 'error',
5859
'jest/no-deprecated-functions': 'error',
5960
'jest/no-disabled-tests': 'warn',
6061
'jest/no-done-callback': 'error',
@@ -63,16 +64,16 @@ module.exports = {
6364
'jest/no-focused-tests': 'error',
6465
'jest/no-hooks': 'off',
6566
'jest/no-identical-title': 'error',
66-
'jest/no-if': 'error',
6767
'jest/no-interpolation-in-snapshots': 'error',
6868
'jest/no-jasmine-globals': 'off',
69-
'jest/no-jest-import': 'error',
7069
'jest/no-large-snapshots': ['warn', {maxSize: 300}],
7170
'jest/no-mocks-import': 'error',
71+
'jest/no-restricted-jest-methods': 'off',
7272
'jest/no-restricted-matchers': 'off',
7373
'jest/no-standalone-expect': 'off',
7474
'jest/no-test-prefixes': 'error',
7575
'jest/no-test-return-statement': 'off',
76+
'jest/no-untyped-mock-factory': 'off',
7677
'jest/prefer-called-with': 'error',
7778
'jest/prefer-comparison-matcher': 'error',
7879
'jest/prefer-each': 'error',
@@ -117,32 +118,33 @@ module.exports = {
117118

118119
...(hasTestingLibrary
119120
? {
120-
'testing-library/await-async-query': 'error',
121+
'testing-library/await-async-events': 'error',
122+
'testing-library/await-async-queries': 'error',
121123
'testing-library/await-async-utils': 'error',
122124
'testing-library/await-fire-event': 'off',
123125
'testing-library/consistent-data-testid': 'off',
124126
'testing-library/no-await-sync-events': 'error',
125-
'testing-library/no-await-sync-query': 'error',
127+
'testing-library/no-await-sync-queries': 'error',
126128
'testing-library/no-container': 'error',
127129
'testing-library/no-debugging-utils': 'error',
128130
'testing-library/no-dom-import': ['error', 'react'],
129131
'testing-library/no-global-regexp-flag-in-query': 'error',
130132
'testing-library/no-manual-cleanup': 'error',
131133
'testing-library/no-node-access': 'error',
132134
'testing-library/no-promise-in-fire-event': 'error',
133-
'testing-library/no-render-in-setup': 'error',
135+
'testing-library/no-render-in-lifecycle': 'error',
134136
'testing-library/no-unnecessary-act': 'error',
135-
'testing-library/no-wait-for-empty-callback': 'error',
136137
'testing-library/no-wait-for-multiple-assertions': 'error',
137138
'testing-library/no-wait-for-side-effects': 'error',
138139
'testing-library/no-wait-for-snapshot': 'error',
139140
'testing-library/prefer-explicit-assert': 'warn',
140141
'testing-library/prefer-find-by': 'error',
142+
'testing-library/prefer-implicit-assert': 'error',
141143
'testing-library/prefer-presence-queries': 'error',
142144
'testing-library/prefer-query-by-disappearance': 'error',
145+
'testing-library/prefer-query-matchers': 'off',
143146
'testing-library/prefer-screen-queries': 'error',
144147
'testing-library/prefer-user-event': 'error',
145-
'testing-library/prefer-wait-for': 'error',
146148
'testing-library/render-result-naming-convention': 'error',
147149
}
148150
: null),
@@ -151,6 +153,7 @@ module.exports = {
151153
{
152154
files: ['**/__tests__/**/*.ts?(x)', '**/*.{spec,test}.ts?(x)'],
153155
rules: {
156+
'jest/no-untyped-mock-factory': 'error',
154157
'@typescript-eslint/unbound-method': 'off',
155158
'jest/unbound-method': 'error',
156159
},

jsx-a11y.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ module.exports = {
1515
},
1616
plugins: ['jsx-a11y'],
1717
rules: {
18-
'jsx-a11y/accessible-emoji': 'error',
1918
'jsx-a11y/alt-text': 'warn',
2019
'jsx-a11y/anchor-ambiguous-text': 'warn',
2120
'jsx-a11y/anchor-has-content': 'error',
@@ -45,7 +44,6 @@ module.exports = {
4544
'jsx-a11y/no-noninteractive-element-interactions': 'warn',
4645
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
4746
'jsx-a11y/no-noninteractive-tabindex': 'off',
48-
'jsx-a11y/no-onchange': 'off',
4947
'jsx-a11y/no-redundant-roles': 'error',
5048
'jsx-a11y/no-static-element-interactions': 'off',
5149
'jsx-a11y/prefer-tag-over-role': 'error',

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,44 +42,44 @@
4242
],
4343
"dependencies": {
4444
"@rushstack/eslint-patch": "^1.2.0",
45-
"@typescript-eslint/eslint-plugin": "^5.49.0",
46-
"@typescript-eslint/parser": "^5.49.0",
47-
"eslint-config-prettier": "^8.6.0",
45+
"@typescript-eslint/eslint-plugin": "^6.16.0",
46+
"@typescript-eslint/parser": "^6.16.0",
47+
"eslint-config-prettier": "^9.1.0",
4848
"eslint-plugin-import": "^2.27.5",
49-
"eslint-plugin-jest": "^26.9.0",
50-
"eslint-plugin-jest-dom": "^4.0.3",
49+
"eslint-plugin-jest": "^27.6.0",
50+
"eslint-plugin-jest-dom": "^5.1.0",
5151
"eslint-plugin-jsx-a11y": "^6.7.1",
5252
"eslint-plugin-react": "^7.32.1",
5353
"eslint-plugin-react-hooks": "^4.6.0",
54-
"eslint-plugin-testing-library": "^5.10.0",
54+
"eslint-plugin-testing-library": "^6.2.0",
5555
"read-pkg-up": "^7.0.1",
5656
"semver": "^7.3.8"
5757
},
5858
"devDependencies": {
59-
"@testing-library/dom": "^8.20.0",
60-
"@testing-library/jest-dom": "^5.16.5",
59+
"@testing-library/dom": "^9.3.3",
60+
"@testing-library/jest-dom": "^6.1.5",
6161
"eslint": "^8.32.0",
6262
"eslint-find-rules": "^4.1.0",
6363
"husky": "^8.0.3",
64-
"jest": "^28.1.3",
64+
"jest": "^29.7.0",
6565
"npm-run-all": "^4.1.5",
6666
"prettier": "2.8.3",
6767
"pretty-quick": "^3.1.3",
6868
"react": "^18.2.0",
69-
"typescript": "^4.9.4"
69+
"typescript": "^5.3.3"
7070
},
7171
"peerDependencies": {
7272
"eslint": "^8.0.0",
73-
"typescript": "^4.0.0"
73+
"typescript": "4 - 5"
7474
},
7575
"peerDependenciesMeta": {
7676
"typescript": {
7777
"optional": true
7878
}
7979
},
8080
"engines": {
81-
"node": "^12.22.0 || ^14.17.0 || >=16.0.0",
82-
"npm": ">=6",
81+
"node": ">=18.0.0",
82+
"npm": ">=10",
8383
"yarn": ">=1"
8484
}
8585
}

react.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ module.exports = {
8282
'react/jsx-no-useless-fragment': 'warn',
8383
'react/jsx-pascal-case': 'error',
8484
'react/jsx-props-no-spreading': 'off',
85-
'react/jsx-sort-default-props': 'off',
8685
'react/jsx-sort-props': 'off',
87-
'react/jsx-uses-react': 'error',
86+
'react/jsx-uses-react': 'off',
8887
'react/jsx-uses-vars': 'error',
8988
'react/no-access-state-in-setstate': 'error',
9089
'react/no-adjacent-inline-elements': 'off',
@@ -122,7 +121,7 @@ module.exports = {
122121
'react/prefer-read-only-props': 'off',
123122
'react/prefer-stateless-function': 'off',
124123
'react/prop-types': hasPropTypes ? 'error' : 'off',
125-
'react/react-in-jsx-scope': 'error',
124+
'react/react-in-jsx-scope': 'off',
126125
'react/require-default-props': 'off', // sometimes the default value is undefined so that's fine...
127126
'react/require-optimization': 'off',
128127
'react/require-render-return': 'error',

samples/users.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react'
21
import PropTypes from 'prop-types'
32

43
export default Users

0 commit comments

Comments
 (0)