Skip to content

Commit

Permalink
chore: Update ESLint config (#790)
Browse files Browse the repository at this point in the history
* chore: Update eslint config

* Bump version
  • Loading branch information
lachlancollins authored Jun 28, 2024
1 parent adc74e0 commit f53062f
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 36 deletions.
25 changes: 13 additions & 12 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// @ts-check

// @ts-expect-error
import { rootConfig } from '@tanstack/config/eslint'
// @ts-ignore Needed due to moduleResolution Node vs Bundler
import { tanstackConfig } from '@tanstack/config/eslint'

export default [
...rootConfig,
...tanstackConfig,
{
name: 'tanstack/temp',
name: 'tanstack/local',
rules: {
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/method-signature-style': 'off',
'@typescript-eslint/naming-convention': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/prefer-for-of': 'off',
'ts/array-type': 'off',
'ts/ban-types': 'off',
'ts/method-signature-style': 'off',
'ts/naming-convention': 'off',
'ts/no-unnecessary-type-assertion': 'off',
'ts/prefer-for-of': 'off',
'ts/require-await': 'off',
'no-async-promise-executor': 'off',
'no-empty': 'off',
},
},
]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@eslint-react/eslint-plugin": "^1.5.16",
"@solidjs/testing-library": "^0.8.6",
"@tanstack/config": "^0.8.1",
"@tanstack/config": "^0.8.6",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/form-core/src/FieldApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export class FieldApi<
if (error) {
this.setMeta((prev) => ({
...prev,
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
// eslint-disable-next-line ts/no-unnecessary-condition
errorMap: { ...prev?.errorMap, onMount: error },
}))
}
Expand Down Expand Up @@ -880,7 +880,7 @@ export class FieldApi<
return {
...prev,
errorMap: {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
// eslint-disable-next-line ts/no-unnecessary-condition
...prev?.errorMap,
[getErrorMapKey(cause)]: error,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/form-core/src/FormApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ export class FormApi<
field: TField,
cause: ValidationCause,
) => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
// eslint-disable-next-line ts/no-unnecessary-condition
const fieldInstance = this.fieldInfo[field]?.instance
if (!fieldInstance) return []

Expand Down Expand Up @@ -842,7 +842,7 @@ export class FormApi<
getFieldInfo = <TField extends DeepKeys<TFormData>>(
field: TField,
): FieldInfo<TFormData, TFormValidator> => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
// eslint-disable-next-line ts/no-unnecessary-condition
return (this.fieldInfo[field] ||= {
instance: null,
validationMetaMap: {
Expand Down
2 changes: 1 addition & 1 deletion packages/form-core/src/mergeForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function mutateMergeDeep(target: object, source: object): object {
mutateMergeDeep(target[targetKey] as {}, source[sourceKey] as {})
} else {
// Prevent assigning undefined to target, only if undefined is not explicitly set on source
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
// eslint-disable-next-line ts/no-unnecessary-condition
if (!(sourceKey in source) && source[sourceKey] === undefined) {
continue
}
Expand Down
10 changes: 2 additions & 8 deletions packages/react-form/src/useForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,11 @@ export function useForm<
}
// eslint-disable-next-line react-hooks/rules-of-hooks
api.useField = (props) => useField({ ...props, form: api })
api.useStore = (
// @ts-ignore
selector,
) => {
api.useStore = (selector) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useStore(api.store as any, selector as any) as any
}
api.Subscribe = (
// @ts-ignore
props,
) => {
api.Subscribe = (props) => {
return functionalUpdate(
props.children,
// eslint-disable-next-line react-hooks/rules-of-hooks
Expand Down
1 change: 0 additions & 1 deletion packages/react-form/src/useIsomorphicLayoutEffect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect, useLayoutEffect } from 'react'

export const useIsomorphicLayoutEffect =
// @ts-ignore
typeof window !== 'undefined' ? useLayoutEffect : useEffect
2 changes: 1 addition & 1 deletion packages/react-form/tests/useField.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ describe('useField', () => {
firstName: '',
lastName: '',
},
// eslint-disable-next-line @typescript-eslint/no-empty-function
// eslint-disable-next-line ts/no-empty-function
onSubmit: async () => {},
})

Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

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

0 comments on commit f53062f

Please sign in to comment.