Skip to content

Commit dc1cd97

Browse files
gitstart-sourcegraphgitstartumpoxjhchabran
authored
feat: Upgrade to v^5.20.0 @typescript-eslint/eslint-plugin
Co-authored-by: gitstart-sourcegraph <[email protected]> Co-authored-by: Tom Ross <[email protected]> Co-authored-by: Jean-Hadrien Chabran <[email protected]>
1 parent ce8b02e commit dc1cd97

File tree

5 files changed

+446
-299
lines changed

5 files changed

+446
-299
lines changed

.eslintrc.js

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ module.exports = {
243243
// These are error by default for JS too
244244
'@typescript-eslint/no-unsafe-call': 'warn',
245245
'@typescript-eslint/no-unsafe-member-access': 'warn',
246-
'@typescript-eslint/no-unsafe-return': 'warn',
246+
// Turned off this rule since it was throwing
247+
// TypeError: Cannot read property 'kind' of undefined
248+
'@typescript-eslint/no-unsafe-return': 'off',
247249
'@typescript-eslint/no-unsafe-assignment': 'warn',
248250

249251
'unicorn/filename-case': ['error', { cases: { camelCase: true, pascalCase: true, kebabCase: true } }],
@@ -318,8 +320,10 @@ module.exports = {
318320
rev: { revision: true },
319321
// Allow since it's a React term
320322
props: false,
323+
func: false,
324+
ref: false,
321325
},
322-
whitelist: {
326+
allowList: {
323327
args: true, // arguments is special
324328
fs: true, // NodeJS standard library
325329
},
@@ -328,6 +332,56 @@ module.exports = {
328332

329333
'unused-imports/no-unused-imports': 'error',
330334
'unused-imports/no-unused-vars': 'off',
335+
// New rules added to unicorn
336+
'unicorn/no-array-reduce': 'off',
337+
'unicorn/no-array-callback-reference': 'off',
338+
'unicorn/numeric-separators-style': 'off',
339+
'unicorn/prefer-switch': 'off',
340+
'unicorn/prefer-spread': 'off',
341+
'unicorn/template-indent': 'off',
342+
'unicorn/prefer-export-from': 'off',
343+
'unicorn/explicit-length-check': 'off',
344+
'unicorn/prefer-date-now': 'off',
345+
'unicorn/no-await-expression-member': 'off',
346+
'unicorn/prefer-dom-node-text-content': 'off',
347+
'unicorn/consistent-destructuring': 'off',
348+
'unicorn/no-new-array': 'off',
349+
'unicorn/prefer-ternary': 'off',
350+
'unicorn/prefer-dom-node-dataset': 'off',
351+
'unicorn/no-useless-spread': 'off',
352+
'unicorn/no-lonely-if': 'off',
353+
'unicorn/prefer-array-some': 'off',
354+
'unicorn/prefer-native-coercion-functions': 'off',
355+
'unicorn/relative-url-style': 'off',
356+
'unicorn/prefer-array-flat-map': 'off',
357+
'unicorn/prefer-node-protocol': 'off',
358+
'unicorn/prefer-module': 'off',
359+
'unicorn/no-useless-promise-resolve-reject': 'off',
360+
'unicorn/no-array-method-this-argument': 'off',
361+
'unicorn/no-array-for-each': 'off',
362+
'no-unsafe-optional-chaining': 'off',
363+
'unicorn/import-style': 'off',
364+
'unicorn/no-array-push-push': 'off',
365+
'unicorn/no-useless-switch-case': 'off',
366+
'unicorn/prefer-regexp-test': 'off',
367+
'unicorn/no-object-as-default-parameter': 'off',
368+
'unicorn/prefer-code-point': 'off',
369+
'unicorn/prefer-object-from-entries': 'off',
370+
'unicorn/prefer-math-trunc': 'off',
371+
'unicorn/text-encoding-identifier-case': 'off',
372+
'unicorn/no-unreadable-iife': 'off',
373+
'unicorn/error-message': 'off',
374+
'unicorn/no-thenable': 'off',
375+
'unicorn/prefer-array-index-of': 'off',
376+
377+
'@typescript-eslint/no-unsafe-argument': 'off',
378+
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
379+
// End
380+
381+
// Previous Rules that has been causing errors after upgrading
382+
'unicorn/consistent-function-scoping': 'off',
383+
'rxjs/no-nested-subscribe': 'off',
384+
// End
331385
},
332386
overrides: [
333387
{
@@ -402,7 +456,9 @@ module.exports = {
402456
// Switch to error when all cases are fixed
403457
'@typescript-eslint/no-unsafe-call': 'warn',
404458
'@typescript-eslint/no-unsafe-member-access': 'warn',
405-
'@typescript-eslint/no-unsafe-return': 'warn',
459+
// Turned off this rule since it was throwing
460+
// TypeError: Cannot read property 'kind' of undefined
461+
'@typescript-eslint/no-unsafe-return': 'off',
406462
'@typescript-eslint/no-unsafe-assignment': 'warn',
407463
'@typescript-eslint/no-unused-vars': [
408464
'warn',
@@ -430,7 +486,9 @@ module.exports = {
430486
'@typescript-eslint/prefer-nullish-coalescing': 'off', // https://github.com/typescript-eslint/typescript-eslint/issues/1265
431487
'@typescript-eslint/type-annotation-spacing': 'off',
432488
'@typescript-eslint/triple-slash-reference': 'error',
433-
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true, allowBoolean: true }],
489+
// This rule was causing error so turned it off
490+
// '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true, allowBoolean: true }],
491+
'@typescript-eslint/restrict-template-expressions': 'off',
434492
'@typescript-eslint/return-await': 'error',
435493
'@typescript-eslint/unbound-method': 'error',
436494
'@typescript-eslint/unified-signatures': 'error',

buildkite.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@ env:
33
# Bump Node.js memory to prevent OOM crashes
44
NODE_OPTIONS: --max_old_space_size=4096
55

6+
template:
7+
- &asdf_cache_plugin
8+
https://github.com/sourcegraph/asdf-cache-buildkite-plugin.git#main:
9+
bucket_name: 'sourcegraph_buildkite_cache'
10+
region_name: 'us-central1'
11+
612
steps:
713
- command: |-
814
yarn
915
yarn prettier-check
1016
label: ':prettier:'
17+
plugins:
18+
- *asdf_cache_plugin
1119
1220
- command: ./check_dependent.sh
1321
label: ':eslint:'
1422
branches: '!master'
23+
plugins:
24+
- *asdf_cache_plugin
1525

1626
- wait
1727

@@ -22,3 +32,5 @@ steps:
2232
label: ':npm:'
2333
concurrency: 1
2434
concurrency_group: release
35+
plugins:
36+
- *asdf_cache_plugin

check_dependent.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ CLONE_DIR=$(mktemp -d)
99
git clone --depth 1 https://github.com/sourcegraph/sourcegraph "$CLONE_DIR"
1010
cd "$CLONE_DIR"
1111
mkdir -p annotations
12-
echo "--- install nodejs"
13-
asdf install
1412
echo "--- yarn"
1513
yarn --frozen-lockfile
1614
echo "--- yarn add"

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@
3535
},
3636
"dependencies": {
3737
"@sourcegraph/prettierrc": "^3.0.3",
38-
"@typescript-eslint/eslint-plugin": "^4.28.3",
39-
"@typescript-eslint/parser": "^4.28.3",
38+
"@typescript-eslint/eslint-plugin": "^5.20.0",
39+
"@typescript-eslint/parser": "^5.20.0",
4040
"eslint-config-prettier": "^6.15.0",
4141
"eslint-plugin-ban": "^1.4.0",
42-
"eslint-plugin-etc": "^1.1.7",
43-
"eslint-plugin-import": "^2.22.1",
42+
"eslint-plugin-etc": "^2.0.2",
43+
"eslint-plugin-import": "^2.26.0",
4444
"eslint-plugin-jest-dom": "^3.6.5",
4545
"eslint-plugin-jsdoc": "^30.7.8",
4646
"eslint-plugin-jsx-a11y": "^6.5.1",
4747
"eslint-plugin-react": "^7.21.4",
48-
"eslint-plugin-react-hooks": "^4.2.0",
49-
"eslint-plugin-rxjs": "^2.1.5",
50-
"eslint-plugin-unicorn": "^21.0.0",
48+
"eslint-plugin-react-hooks": "^4.5.0",
49+
"eslint-plugin-rxjs": "^5.0.2",
50+
"eslint-plugin-unicorn": "^42.0.0",
5151
"eslint-plugin-unused-imports": "^1.1.5"
5252
}
5353
}

0 commit comments

Comments
 (0)