Skip to content

Commit

Permalink
eslint - add react-query checks
Browse files Browse the repository at this point in the history
Looking at [1], add eslint rules for react-query.  The rules are
currently set to `error` in order to highlight what "best practices"
will be enforced with this change.

[1] - https://tanstack.com/query/latest/docs/react/eslint/eslint-plugin-query

Signed-off-by: Scott J Dickerson <[email protected]>
  • Loading branch information
sjd78 committed Sep 22, 2023
1 parent 48dd6fd commit 05f384c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = {
"@typescript-eslint",
"react",
"react-hooks",
"@tanstack/query",
],

// NOTE: Tweak the rules as needed when bulk fixes get merged
Expand All @@ -55,6 +56,9 @@ module.exports = {

// Allow the "cy-data" property for tackle-ui-test (but should really be "data-cy" w/o this rule)
"react/no-unknown-property": ["error", { ignore: ["cy-data"] }],

"@tanstack/query/exhaustive-deps": "error",
"@tanstack/query/prefer-query-object-syntax": "error",
},

settings: {
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-run": "^3.0.1",
"@rollup/plugin-typescript": "^11.1.2",
"@tanstack/eslint-plugin-query": "^4.34.1",
"@types/jest": "^29.5.4",
"@types/node": "^18.14.2",
"@typescript-eslint/eslint-plugin": "^6.4.0",
Expand Down

0 comments on commit 05f384c

Please sign in to comment.