Skip to content

Commit

Permalink
feat: Upgrade to v^5.20.0 @typescript-eslint/eslint-plugin
Browse files Browse the repository at this point in the history
Co-authored-by: gitstart-sourcegraph <gitstart@users.noreply.github.com>
Co-authored-by: Tom Ross <tom@umpox.com>
Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
  • Loading branch information
4 people committed May 26, 2022
1 parent ce8b02e commit dc1cd97
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 299 deletions.
66 changes: 62 additions & 4 deletions .eslintrc.js
Expand Up @@ -243,7 +243,9 @@ module.exports = {
// These are error by default for JS too
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
// Turned off this rule since it was throwing
// TypeError: Cannot read property 'kind' of undefined
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',

'unicorn/filename-case': ['error', { cases: { camelCase: true, pascalCase: true, kebabCase: true } }],
Expand Down Expand Up @@ -318,8 +320,10 @@ module.exports = {
rev: { revision: true },
// Allow since it's a React term
props: false,
func: false,
ref: false,
},
whitelist: {
allowList: {
args: true, // arguments is special
fs: true, // NodeJS standard library
},
Expand All @@ -328,6 +332,56 @@ module.exports = {

'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': 'off',
// New rules added to unicorn
'unicorn/no-array-reduce': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/prefer-switch': 'off',
'unicorn/prefer-spread': 'off',
'unicorn/template-indent': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/explicit-length-check': 'off',
'unicorn/prefer-date-now': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/prefer-dom-node-text-content': 'off',
'unicorn/consistent-destructuring': 'off',
'unicorn/no-new-array': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/prefer-dom-node-dataset': 'off',
'unicorn/no-useless-spread': 'off',
'unicorn/no-lonely-if': 'off',
'unicorn/prefer-array-some': 'off',
'unicorn/prefer-native-coercion-functions': 'off',
'unicorn/relative-url-style': 'off',
'unicorn/prefer-array-flat-map': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/prefer-module': 'off',
'unicorn/no-useless-promise-resolve-reject': 'off',
'unicorn/no-array-method-this-argument': 'off',
'unicorn/no-array-for-each': 'off',
'no-unsafe-optional-chaining': 'off',
'unicorn/import-style': 'off',
'unicorn/no-array-push-push': 'off',
'unicorn/no-useless-switch-case': 'off',
'unicorn/prefer-regexp-test': 'off',
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/prefer-code-point': 'off',
'unicorn/prefer-object-from-entries': 'off',
'unicorn/prefer-math-trunc': 'off',
'unicorn/text-encoding-identifier-case': 'off',
'unicorn/no-unreadable-iife': 'off',
'unicorn/error-message': 'off',
'unicorn/no-thenable': 'off',
'unicorn/prefer-array-index-of': 'off',

'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'off',
// End

// Previous Rules that has been causing errors after upgrading
'unicorn/consistent-function-scoping': 'off',
'rxjs/no-nested-subscribe': 'off',
// End
},
overrides: [
{
Expand Down Expand Up @@ -402,7 +456,9 @@ module.exports = {
// Switch to error when all cases are fixed
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
// Turned off this rule since it was throwing
// TypeError: Cannot read property 'kind' of undefined
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
Expand Down Expand Up @@ -430,7 +486,9 @@ module.exports = {
'@typescript-eslint/prefer-nullish-coalescing': 'off', // https://github.com/typescript-eslint/typescript-eslint/issues/1265
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true, allowBoolean: true }],
// This rule was causing error so turned it off
// '@typescript-eslint/restrict-template-expressions': ['error', { allowNumber: true, allowBoolean: true }],
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/unbound-method': 'error',
'@typescript-eslint/unified-signatures': 'error',
Expand Down
12 changes: 12 additions & 0 deletions buildkite.yml
Expand Up @@ -3,15 +3,25 @@ env:
# Bump Node.js memory to prevent OOM crashes
NODE_OPTIONS: --max_old_space_size=4096

template:
- &asdf_cache_plugin
https://github.com/sourcegraph/asdf-cache-buildkite-plugin.git#main:
bucket_name: 'sourcegraph_buildkite_cache'
region_name: 'us-central1'

steps:
- command: |-
yarn
yarn prettier-check
label: ':prettier:'
plugins:
- *asdf_cache_plugin
- command: ./check_dependent.sh
label: ':eslint:'
branches: '!master'
plugins:
- *asdf_cache_plugin

- wait

Expand All @@ -22,3 +32,5 @@ steps:
label: ':npm:'
concurrency: 1
concurrency_group: release
plugins:
- *asdf_cache_plugin
2 changes: 0 additions & 2 deletions check_dependent.sh
Expand Up @@ -9,8 +9,6 @@ CLONE_DIR=$(mktemp -d)
git clone --depth 1 https://github.com/sourcegraph/sourcegraph "$CLONE_DIR"
cd "$CLONE_DIR"
mkdir -p annotations
echo "--- install nodejs"
asdf install
echo "--- yarn"
yarn --frozen-lockfile
echo "--- yarn add"
Expand Down
14 changes: 7 additions & 7 deletions package.json
Expand Up @@ -35,19 +35,19 @@
},
"dependencies": {
"@sourcegraph/prettierrc": "^3.0.3",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-ban": "^1.4.0",
"eslint-plugin-etc": "^1.1.7",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-etc": "^2.0.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest-dom": "^3.6.5",
"eslint-plugin-jsdoc": "^30.7.8",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-rxjs": "^2.1.5",
"eslint-plugin-unicorn": "^21.0.0",
"eslint-plugin-react-hooks": "^4.5.0",
"eslint-plugin-rxjs": "^5.0.2",
"eslint-plugin-unicorn": "^42.0.0",
"eslint-plugin-unused-imports": "^1.1.5"
}
}

0 comments on commit dc1cd97

Please sign in to comment.