Skip to content

Commit b32ad24

Browse files
authored
ci(eslint): add @cspell/eslint-plugin to prevent misspelling (error) (TanStack#6718)
* ci: add @cspell/eslint-plugin to prevent misspelling * ci(eslint/cspell): convert rule as error * fix(cspell): reduce unnecessary words to check * fix(eslint): remove `ouuid` as @cspell/spellchecker's words
1 parent 8fff654 commit b32ad24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+675
-141
lines changed

.eslintrc.cjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const config = {
66
parser: '@typescript-eslint/parser',
77
plugins: ['@typescript-eslint', 'import'],
88
extends: [
9+
'plugin:@cspell/recommended',
910
'plugin:@typescript-eslint/eslint-recommended',
1011
'plugin:@typescript-eslint/recommended',
1112
'plugin:import/recommended',
@@ -34,6 +35,27 @@ const config = {
3435
},
3536
},
3637
rules: {
38+
'@cspell/spellchecker': [
39+
'error',
40+
{
41+
cspell: {
42+
words: [
43+
'tanstack', // Our package scope
44+
'tsqd', // Our public interface (TanStack Query Devtools shorthand)
45+
'retryer', // Our public interface
46+
'Promisable', // Our public interface
47+
'extralight', // Our public interface
48+
'codemod', // We support our codemod
49+
50+
'TSES', // @typescript-eslint package's interface
51+
'tsup', // We use tsup as builder
52+
'solidjs', // Our target framework
53+
'tabular-nums', // https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric
54+
'todos', // Too general word to be caught as error
55+
],
56+
},
57+
},
58+
],
3759
'@typescript-eslint/array-type': [
3860
'error',
3961
{ default: 'generic', readonly: 'generic' },

examples/react/optimistic-updates-cache/src/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Example() {
4141
// When mutate is called:
4242
onMutate: async (newTodo: string) => {
4343
setText('')
44-
// Cancel any outgoing refetches
44+
// Cancel any outgoing refetch
4545
// (so they don't overwrite our optimistic update)
4646
await queryClient.cancelQueries(todoListOptions)
4747

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
},
3838
"namespace": "@tanstack",
3939
"devDependencies": {
40+
"@cspell/eslint-plugin": "^8.3.2",
4041
"@solidjs/testing-library": "^0.8.5",
4142
"@tanstack/config": "^0.3.2",
4243
"@testing-library/jest-dom": "^6.1.5",

packages/angular-query-experimental/src/util/assert-injector/assert-injector.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @cspell/spellchecker */
12
/**
23
* The code in this file is adapted from NG Extension Platform at https://ngxtension.netlify.app.
34
*
@@ -8,6 +9,7 @@
89
* For more information about the original code, see
910
* https://github.com/nartc/ngxtension-platform
1011
*/
12+
/* eslint-enable */
1113

1214
import {
1315
InjectionToken,

packages/angular-query-experimental/src/util/assert-injector/assert-injector.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @cspell/spellchecker */
12
/**
23
* The code in this file is adapted from NG Extension Platform at https://ngxtension.netlify.app.
34
*
@@ -8,6 +9,7 @@
89
* For more information about the original code, see
910
* https://github.com/nartc/ngxtension-platform
1011
*/
12+
/* eslint-enable */
1113

1214
import {
1315
Injector,

packages/angular-query-experimental/src/util/create-injection-token/create-injection-token.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @cspell/spellchecker */
12
/**
23
* The code in this file is adapted from NG Extension Platform at https://ngxtension.netlify.app.
34
*
@@ -8,6 +9,7 @@
89
* For more information about the original code, see
910
* https://github.com/nartc/ngxtension-platform
1011
*/
12+
/* eslint-enable */
1113

1214
import { TestBed } from '@angular/core/testing'
1315
import { createNoopInjectionToken } from './create-injection-token'

packages/angular-query-experimental/src/util/create-injection-token/create-injection-token.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @cspell/spellchecker */
12
/**
23
* The code in this file is adapted from NG Extension Platform at https://ngxtension.netlify.app.
34
*
@@ -8,6 +9,7 @@
89
* For more information about the original code, see
910
* https://github.com/nartc/ngxtension-platform
1011
*/
12+
/* eslint-enable */
1113

1214
import {
1315
type EnvironmentProviders,

packages/codemods/src/v5/remove-overloads/__testfixtures__/default-import.input.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ export const WithIdentifiers = () => {
200200
}
201201

202202
export const SecondArgumentIsAFunctionExample = () => {
203-
useQuery(ordersCacheKeys.groupOrders(ouuid), () => api.getPatientGroupOrders(ouuid).then((r) => r.data))
203+
useQuery(ordersCacheKeys.groupOrders(id), () => api.getPatientGroupOrders(id).then((r) => r.data))
204204

205205
const rest = 'rest'
206206
const of = 1
207207
const functionArguments = { foo: 'bar' }
208208

209-
useQuery(ordersCacheKeys.groupOrders(ouuid), () => api.getPatientGroupOrders(ouuid).then((r) => r.data), rest, of, functionArguments)
209+
useQuery(ordersCacheKeys.groupOrders(id), () => api.getPatientGroupOrders(id).then((r) => r.data), rest, of, functionArguments)
210210
}

packages/codemods/src/v5/remove-overloads/__testfixtures__/default-import.output.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,16 +486,16 @@ export const WithIdentifiers = () => {
486486

487487
export const SecondArgumentIsAFunctionExample = () => {
488488
useQuery({
489-
queryKey: ordersCacheKeys.groupOrders(ouuid),
490-
queryFn: () => api.getPatientGroupOrders(ouuid).then((r) => r.data)
489+
queryKey: ordersCacheKeys.groupOrders(id),
490+
queryFn: () => api.getPatientGroupOrders(id).then((r) => r.data)
491491
})
492492

493493
const rest = 'rest'
494494
const of = 1
495495
const functionArguments = { foo: 'bar' }
496496

497497
useQuery({
498-
queryKey: ordersCacheKeys.groupOrders(ouuid),
499-
queryFn: () => api.getPatientGroupOrders(ouuid).then((r) => r.data)
498+
queryKey: ordersCacheKeys.groupOrders(id),
499+
queryFn: () => api.getPatientGroupOrders(id).then((r) => r.data)
500500
}, rest, of, functionArguments)
501501
}

packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@ ruleTester.run('exhaustive-deps', rule, {
364364
const CONST_VAL = 1
365365
function useHook() {
366366
const queryClient = useQueryClient()
367-
const kueryKlient = useQueryClient()
367+
const queryClient2 = useQueryClient()
368368
useQuery({
369369
queryKey: ["foo"],
370370
queryFn: () => {
371371
doSomething(queryClient)
372372
queryClient.invalidateQueries()
373-
doSomethingSus(kueryKlient)
373+
doSomethingSus(queryClient2)
374374
}
375375
});
376376
}

0 commit comments

Comments
 (0)