Skip to content

Commit

Permalink
Update eslint plugins (#3552)
Browse files Browse the repository at this point in the history
* bump `@typescript-eslint`

* Remove deprecated rules

* Add new rules

* sort

* Update `eslint-plugin-jest`

* Update `eslint-plugin-react`

* Address comments

* Update .eslintrc.cjs

* Update .eslintrc.cjs

Co-authored-by: Nicolas Stepien <[email protected]>

---------

Co-authored-by: Nicolas Stepien <[email protected]>
  • Loading branch information
amanmahajan7 and nstepien authored Jul 23, 2024
1 parent e44d74b commit 9c2bdc2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 31 deletions.
39 changes: 15 additions & 24 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const rules = {
'prefer-numeric-literals': 1,
'prefer-object-has-own': 1,
'prefer-object-spread': 1,
'prefer-promise-reject-errors': [1, { allowEmptyReject: true }],
'prefer-promise-reject-errors': 0, // replaced by @typescript-eslint/prefer-promise-reject-errors
'prefer-regex-literals': [1, { disallowRedundantWrapping: true }],
'prefer-rest-params': 1,
'prefer-spread': 1,
Expand Down Expand Up @@ -289,6 +289,7 @@ const rules = {
// https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules
'react/boolean-prop-naming': 0,
'react/button-has-type': 0,
'react/checked-requires-onchange-or-readonly': 1,
'react/default-props-match-prop-types': 0,
'react/destructuring-assignment': 0,
'react/display-name': 0,
Expand Down Expand Up @@ -344,10 +345,9 @@ const rules = {
'react/jsx-one-expression-per-line': 0,
'react/jsx-pascal-case': 1,
'react/jsx-props-no-multi-spaces': 1,
'react/jsx-props-no-spread-multi': 1,
'react/jsx-props-no-spreading': 0,
'react/jsx-sort-default-props': 0,
'react/jsx-sort-props': 0,
'react/jsx-space-before-closing': 0,
'react/jsx-tag-spacing': [
1,
{
Expand Down Expand Up @@ -434,6 +434,7 @@ const rules = {
'jest/no-commented-out-tests': 1,
'jest/no-conditional-expect': 1,
'jest/no-conditional-in-test': 0,
'jest/no-confusing-set-timeout': 0,
'jest/no-deprecated-functions': 0,
'jest/no-disabled-tests': 0,
'jest/no-done-callback': 0,
Expand Down Expand Up @@ -465,9 +466,11 @@ const rules = {
'jest/prefer-each': 1,
'jest/prefer-equality-matcher': 1,
'jest/prefer-expect-assertions': 0,
'jest/prefer-expect-resolves': 0,
'jest/prefer-expect-resolves': 1,
'jest/prefer-hooks-in-order': 1,
'jest/prefer-hooks-on-top': 1,
'jest/prefer-importing-jest-globals': 0,
'jest/prefer-jest-mocked': 0,
'jest/prefer-lowercase-title': 0,
'jest/prefer-mock-promise-shorthand': 1,
'jest/prefer-snapshot-hint': 0,
Expand Down Expand Up @@ -554,17 +557,18 @@ const rules = {
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-member-accessibility': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/member-delimiter-style': 0,
'@typescript-eslint/member-ordering': 0,
'@typescript-eslint/method-signature-style': 1,
'@typescript-eslint/naming-convention': 0,
'@typescript-eslint/no-array-delete': 1,
'@typescript-eslint/no-base-to-string': 0,
'@typescript-eslint/no-confusing-non-null-assertion': 0,
'@typescript-eslint/no-confusing-void-expression': [1, { ignoreArrowShorthand: true }],
'@typescript-eslint/no-duplicate-enum-values': 1,
'@typescript-eslint/no-duplicate-type-constituents': 1,
'@typescript-eslint/no-dynamic-delete': 0,
'@typescript-eslint/no-empty-interface': 1,
'@typescript-eslint/no-empty-object-type': 1,
'@typescript-eslint/no-explicit-any': [1, { fixToUnknown: true }],
'@typescript-eslint/no-extra-non-null-assertion': 1,
'@typescript-eslint/no-extraneous-class': 1,
Expand All @@ -587,7 +591,9 @@ const rules = {
'@typescript-eslint/no-type-alias': 0,
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 1,
'@typescript-eslint/no-unnecessary-condition': 1,
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 1,
'@typescript-eslint/no-unnecessary-qualifier': 0,
'@typescript-eslint/no-unnecessary-template-expression': 1,
'@typescript-eslint/no-unnecessary-type-arguments': 1,
'@typescript-eslint/no-unnecessary-type-assertion': 1,
'@typescript-eslint/no-unnecessary-type-constraint': 1,
Expand All @@ -604,6 +610,7 @@ const rules = {
'@typescript-eslint/parameter-properties': 1,
'@typescript-eslint/prefer-as-const': 1,
'@typescript-eslint/prefer-enum-initializers': 0,
'@typescript-eslint/prefer-find': 1,
'@typescript-eslint/prefer-for-of': 1,
'@typescript-eslint/prefer-function-type': 1,
'@typescript-eslint/prefer-includes': 1,
Expand All @@ -614,13 +621,13 @@ const rules = {
{ ignorePrimitives: { boolean: true, string: true } }
],
'@typescript-eslint/prefer-optional-chain': 1,
'@typescript-eslint/prefer-promise-reject-errors': [1, { allowEmptyReject: true }],
'@typescript-eslint/prefer-readonly': 1,
'@typescript-eslint/prefer-readonly-parameter-types': 0,
'@typescript-eslint/prefer-reduce-type-parameter': 1,
'@typescript-eslint/prefer-regexp-exec': 1,
'@typescript-eslint/prefer-return-this-type': 0,
'@typescript-eslint/prefer-string-starts-ends-with': 1,
'@typescript-eslint/prefer-ts-expect-error': 1,
'@typescript-eslint/promise-function-async': 0,
'@typescript-eslint/require-array-sort-compare': 1,
'@typescript-eslint/restrict-plus-operands': 0,
Expand All @@ -629,31 +636,18 @@ const rules = {
'@typescript-eslint/strict-boolean-expressions': 0,
'@typescript-eslint/switch-exhaustiveness-check': 1,
'@typescript-eslint/triple-slash-reference': [1, { path: 'never', types: 'never', lib: 'never' }],
'@typescript-eslint/type-annotation-spacing': 0,
'@typescript-eslint/typedef': 0,
'@typescript-eslint/unbound-method': 0,
'@typescript-eslint/unified-signatures': 0,

// @typescript-eslint/eslint-plugin Extension Rules
// https://typescript-eslint.io/rules/#extension-rules
'@typescript-eslint/block-spacing': 0,
'@typescript-eslint/brace-style': 0,
'@typescript-eslint/comma-dangle': 0,
'@typescript-eslint/comma-spacing': 0,
'@typescript-eslint/default-param-last': 0,
'@typescript-eslint/dot-notation': 1,
'@typescript-eslint/func-call-spacing': 0,
'@typescript-eslint/indent': 0,
'@typescript-eslint/init-declarations': 0,
'@typescript-eslint/key-spacing': 0,
'@typescript-eslint/keyword-spacing': 0,
'@typescript-eslint/lines-around-comment': 0,
'@typescript-eslint/lines-between-class-members': 0,
'@typescript-eslint/no-array-constructor': 1,
'@typescript-eslint/no-dupe-class-members': 0,
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-extra-parens': 0,
'@typescript-eslint/no-extra-semi': 0,
'@typescript-eslint/no-implied-eval': 1,
'@typescript-eslint/no-invalid-this': 0,
'@typescript-eslint/no-loop-func': 0,
Expand Down Expand Up @@ -696,6 +690,7 @@ const rules = {
'@typescript-eslint/no-use-before-define': 0,
'@typescript-eslint/no-useless-constructor': 1,
'@typescript-eslint/object-curly-spacing': 0,
// TODO: deprecated
'@typescript-eslint/padding-line-between-statements': [
1,
{
Expand All @@ -709,13 +704,9 @@ const rules = {
next: '*'
}
],
'@typescript-eslint/quotes': 0,
'@typescript-eslint/require-await': 1,
'@typescript-eslint/return-await': 1,
'@typescript-eslint/semi': 0,
'@typescript-eslint/space-before-blocks': 0,
'@typescript-eslint/space-before-function-paren': 0,
'@typescript-eslint/space-infix-ops': 0,
'@typescript-eslint/use-unknown-in-catch-callback-variable': 1,

// eslint-plugin-testing-library Rules
// https://github.com/testing-library/eslint-plugin-testing-library#supported-rules
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"@types/node": "^20.10.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/browser": "^2.0.3",
"@vitest/coverage-istanbul": "^2.0.3",
Expand All @@ -85,10 +85,10 @@
"babel-plugin-optimize-clsx": "^2.6.2",
"eslint": "^8.43.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-jest-dom": "^5.0.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-sonarjs": "^1.0.3",
"eslint-plugin-testing-library": "^6.2.0",
Expand Down
4 changes: 2 additions & 2 deletions test/column/frozen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ test('frozen column have a specific class, and are stable-sorted before non-froz

expect(cell1).toHaveClass(`${cellClassname} ${cellFrozenClassname}`, { exact: true });
expect(cell2).toHaveClass(`${cellClassname} ${cellFrozenClassname}`, { exact: true });
expect(cell3).toHaveClass(`${cellClassname}`, { exact: true });
expect(cell4).toHaveClass(`${cellClassname}`, { exact: true });
expect(cell3).toHaveClass(cellClassname, { exact: true });
expect(cell4).toHaveClass(cellClassname, { exact: true });

expect(cell1).toHaveTextContent('col1');
expect(cell2).toHaveTextContent('col3');
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"pretty": true,
"strict": true,
"target": "esnext",
"skipLibCheck": true
"skipLibCheck": true,
"useUnknownInCatchVariables": true
}
}

0 comments on commit 9c2bdc2

Please sign in to comment.