Skip to content

Commit e633c67

Browse files
chore: Use typescript-eslint v6 features (#594)
* chore: Use typescript-eslint v6 features * Remove unnecessary parserOptions * Delete stray prettierrc
1 parent 70e4fdb commit e633c67

File tree

21 files changed

+163
-118
lines changed

21 files changed

+163
-118
lines changed

.eslintrc.cjs

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
root: true,
6+
reportUnusedDisableDirectives: true,
7+
ignorePatterns: ['**/build', '**/coverage', '**/dist'],
68
parser: '@typescript-eslint/parser',
79
plugins: ['@typescript-eslint', 'import'],
810
extends: [
9-
'plugin:@typescript-eslint/eslint-recommended',
11+
'eslint:recommended',
1012
'plugin:@typescript-eslint/recommended',
13+
'plugin:@typescript-eslint/stylistic',
1114
'plugin:import/recommended',
1215
'plugin:import/typescript',
1316
'prettier',
@@ -18,7 +21,7 @@ const config = {
1821
},
1922
parserOptions: {
2023
tsconfigRootDir: __dirname,
21-
project: './tsconfig.json',
24+
project: true,
2225
sourceType: 'module',
2326
ecmaVersion: 2020,
2427
},
@@ -34,14 +37,17 @@ const config = {
3437
},
3538
},
3639
rules: {
40+
'@typescript-eslint/array-type': 'off',
3741
'@typescript-eslint/ban-types': 'off',
3842
'@typescript-eslint/ban-ts-comment': 'off',
43+
'@typescript-eslint/consistent-type-definitions': 'off',
3944
'@typescript-eslint/consistent-type-imports': 'error',
4045
'@typescript-eslint/explicit-module-boundary-types': 'off',
4146
'@typescript-eslint/no-empty-interface': 'off',
4247
'@typescript-eslint/no-explicit-any': 'off',
4348
'@typescript-eslint/no-non-null-assertion': 'off',
4449
'@typescript-eslint/no-unnecessary-condition': 'error',
50+
'@typescript-eslint/no-unused-vars': 'off',
4551
'@typescript-eslint/no-inferrable-types': [
4652
'error',
4753
{
@@ -52,8 +58,10 @@ const config = {
5258
'import/no-cycle': 'error',
5359
'import/no-unresolved': ['error', { ignore: ['^@tanstack/'] }],
5460
'import/no-unused-modules': ['off', { unusedExports: true }],
61+
'no-async-promise-executor': 'off',
62+
'no-empty': 'off',
5563
'no-redeclare': 'off',
56-
'@typescript-eslint/no-unused-vars': 'off',
64+
'no-undef': 'off',
5765
},
5866
overrides: [
5967
{
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
module.exports = {
22
extends: 'next/core-web-vitals',
3-
parserOptions: {
4-
tsconfigRootDir: __dirname,
5-
project: ['./tsconfig.json'],
6-
},
73
}

examples/react/simple/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
6-
parserOptions: {
7-
tsconfigRootDir: __dirname,
8-
project: './tsconfig.json',
9-
},
106
rules: {
117
'react/no-children-prop': 'off',
128
},

examples/react/ui-libraries/.eslintrc.cjs

+1-8
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22

33
/** @type {import('eslint').Linter.Config} */
44
const config = {
5-
env: { browser: true, es2020: true },
6-
extends: [
7-
'eslint:recommended',
8-
'plugin:@typescript-eslint/recommended',
9-
'plugin:react-hooks/recommended',
10-
],
11-
parser: '@typescript-eslint/parser',
12-
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
5+
extends: ['plugin:react-hooks/recommended'],
136
plugins: ['react-refresh'],
147
rules: {
158
'react-refresh/only-export-components': 'warn',

examples/react/valibot/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
6-
parserOptions: {
7-
tsconfigRootDir: __dirname,
8-
project: './tsconfig.json',
9-
},
106
rules: {
117
'react/no-children-prop': 'off',
128
},

examples/react/yup/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
6-
parserOptions: {
7-
tsconfigRootDir: __dirname,
8-
project: './tsconfig.json',
9-
},
106
rules: {
117
'react/no-children-prop': 'off',
128
},

examples/react/zod/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
6-
parserOptions: {
7-
tsconfigRootDir: __dirname,
8-
project: './tsconfig.json',
9-
},
106
rules: {
117
'react/no-children-prop': 'off',
128
},

examples/react/zod/.prettierrc

-1
This file was deleted.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
"@types/node": "^18.19.3",
4444
"@types/react": "^18.2.45",
4545
"@types/react-dom": "^18.0.5",
46-
"@typescript-eslint/eslint-plugin": "^6.4.1",
47-
"@typescript-eslint/parser": "^6.4.1",
46+
"@typescript-eslint/eslint-plugin": "^6.20.0",
47+
"@typescript-eslint/parser": "^6.20.0",
4848
"@vitest/coverage-istanbul": "^1.2.2",
4949
"eslint": "^8.56.0",
5050
"eslint-config-prettier": "^9.1.0",

packages/form-core/.eslintrc.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

packages/form-core/src/FieldApi.ts

-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ export class FieldApi<
305305
this.store = new Store<FieldState<TData>>(
306306
{
307307
value: this.getValue(),
308-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
309308
meta: this._getMeta() ?? {
310309
isValidating: false,
311310
isTouched: false,
@@ -424,7 +423,6 @@ export class FieldApi<
424423
>,
425424
) => {
426425
// Default Value
427-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
428426
if (this.state.value === undefined) {
429427
const formDefault =
430428
opts.form.options.defaultValues?.[opts.name as keyof TParentData]

packages/form-core/src/FormApi.ts

-2
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,7 @@ export class FormApi<
314314
Object.assign(
315315
{},
316316
this.state as any,
317-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
318317
shouldUpdateState ? options.defaultState : {},
319-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
320318
shouldUpdateValues
321319
? {
322320
values: options.defaultValues,

packages/react-form/.eslintrc.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
/** @type {import('eslint').Linter.Config} */
44
const config = {
55
extends: ['plugin:react/recommended', 'plugin:react-hooks/recommended'],
6-
parserOptions: {
7-
tsconfigRootDir: __dirname,
8-
project: './tsconfig.json',
9-
},
106
rules: {
117
'react/jsx-key': ['error', { checkFragmentShorthand: true }],
128
'react-hooks/exhaustive-deps': 'error',

packages/solid-form/.eslintrc.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

packages/solid-form/src/createField.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FieldApi, type Validator } from '@tanstack/form-core'
1+
import { FieldApi } from '@tanstack/form-core'
22
import {
33
createComponent,
44
createComputed,
@@ -9,7 +9,12 @@ import {
99
} from 'solid-js'
1010
import { formContext, useFormContext } from './formContext'
1111

12-
import type { DeepKeys, DeepValue, Narrow } from '@tanstack/form-core'
12+
import type {
13+
DeepKeys,
14+
DeepValue,
15+
Narrow,
16+
Validator,
17+
} from '@tanstack/form-core'
1318
import type { JSXElement } from 'solid-js'
1419
import type { CreateFieldOptions } from './types'
1520

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

packages/vue-form/.eslintrc.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

packages/vue-form/src/useField.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
import { FieldApi, type Validator } from '@tanstack/form-core'
2-
import type { DeepKeys, DeepValue, Narrow } from '@tanstack/form-core'
1+
import { FieldApi } from '@tanstack/form-core'
32
import { useStore } from '@tanstack/vue-store'
43
import { defineComponent, onMounted, onUnmounted, watch } from 'vue'
5-
import type { SlotsType, SetupContext, Ref } from 'vue'
64
import { provideFormContext, useFormContext } from './formContext'
5+
import type {
6+
DeepKeys,
7+
DeepValue,
8+
Narrow,
9+
Validator,
10+
} from '@tanstack/form-core'
11+
import type { SlotsType, SetupContext, Ref } from 'vue'
712
import type { UseFieldOptions } from './types'
813

914
declare module '@tanstack/form-core' {
+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config
+1-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
// @ts-check
22

33
/** @type {import('eslint').Linter.Config} */
4-
const config = {
5-
parserOptions: {
6-
tsconfigRootDir: __dirname,
7-
project: './tsconfig.json',
8-
},
9-
}
4+
const config = {}
105

116
module.exports = config

0 commit comments

Comments
 (0)