Skip to content

Commit 77466b1

Browse files
committed
Fix ESLint setup
1 parent 19e8074 commit 77466b1

File tree

5 files changed

+27
-47
lines changed

5 files changed

+27
-47
lines changed

eslint.config.mjs

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ import prettierPlugin from 'eslint-plugin-prettier/recommended'
88
export default defineConfig([
99
{
1010
name: 'global ignores',
11-
ignores: ['**/coverage/**/*', '**/dist/**/*', 'docs/.vitepress/dist/**/*', 'docs/.vitepress/cache/**/*'],
11+
ignores: ['**/coverage/**/*', '**/dist/**/*', 'docs/.vitepress/**/*'],
1212
},
1313

1414
{
1515
name: 'js recommended',
1616
...jsPlugin.configs.recommended,
1717
},
1818

19-
...tsPlugin.configs.recommendedTypeChecked,
20-
2119
{
2220
name: 'react recommended',
2321
...reactPlugin.configs.flat.recommended,
@@ -28,39 +26,23 @@ export default defineConfig([
2826
...reactPlugin.configs.flat['jsx-runtime'],
2927
},
3028

31-
prettierPlugin,
32-
33-
{
34-
name: 'ts configuration',
35-
files: ['**/*.{ts,tsx}'],
36-
languageOptions: {
37-
parserOptions: {
38-
projectService: true,
39-
tsconfigRootDir: import.meta.dirname,
40-
},
41-
},
42-
rules: {
43-
'no-unused-vars': 'off',
29+
...tsPlugin.configs.recommendedTypeChecked,
4430

45-
'@typescript-eslint/consistent-type-imports': 'error',
46-
'@typescript-eslint/consistent-type-exports': 'error',
47-
'@typescript-eslint/no-unused-vars': [
48-
'error',
49-
{
50-
ignoreRestSiblings: true,
51-
argsIgnorePattern: '^_',
52-
destructuredArrayIgnorePattern: '^_',
53-
},
54-
],
55-
},
56-
},
31+
prettierPlugin,
5732

5833
{
5934
name: 'global configuration',
6035

6136
languageOptions: {
6237
...reactPlugin.configs.flat.recommended.languageOptions,
6338

39+
parserOptions: {
40+
projectService: {
41+
allowDefaultProject: ['eslint.config.mjs'],
42+
},
43+
tsconfigRootDir: import.meta.dirname,
44+
},
45+
6446
globals: {
6547
...globals.serviceworker,
6648
...globals.browser,
@@ -76,9 +58,26 @@ export default defineConfig([
7658
rules: {
7759
'no-console': 'error',
7860
'no-debugger': 'error',
61+
'no-unused-vars': 'off',
7962

8063
'react/prop-types': 'off',
8164
'react/display-name': 'off',
65+
66+
'@typescript-eslint/consistent-type-imports': 'error',
67+
'@typescript-eslint/consistent-type-exports': 'error',
68+
'@typescript-eslint/no-unsafe-assignment': 'off',
69+
'@typescript-eslint/no-unsafe-member-access': 'off',
70+
'@typescript-eslint/no-unsafe-return': 'off',
71+
'@typescript-eslint/no-unsafe-argument': 'off',
72+
'@typescript-eslint/no-explicit-any': 'off',
73+
'@typescript-eslint/no-unused-vars': [
74+
'error',
75+
{
76+
ignoreRestSiblings: true,
77+
argsIgnorePattern: '^_',
78+
destructuredArrayIgnorePattern: '^_',
79+
},
80+
],
8281
},
8382
},
8483
])

packages/core/src/state-utils.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import clone from 'shallow-clone'
22
import isEqual from 'lodash.isequal'
33

4-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
5-
/* eslint-disable @typescript-eslint/no-unsafe-return */
6-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
7-
/* eslint-disable @typescript-eslint/no-explicit-any */
8-
94
// Originally taken from https://github.com/jaredpalmer/formik/blob/master/packages/formik/src/utils.ts
105
function getPath(source: any, path: string | string[], fallback?: any) {
116
let p = 0
@@ -55,11 +50,6 @@ function setPath(obj: any, path: string, value: any): any {
5550
return res
5651
}
5752

58-
/* eslint-enable @typescript-eslint/no-unsafe-member-access */
59-
/* eslint-enable @typescript-eslint/no-unsafe-return */
60-
/* eslint-enable @typescript-eslint/no-unsafe-assignment */
61-
/* eslint-enable @typescript-eslint/no-explicit-any */
62-
6353
function setKey<T extends Record<string, unknown>>(source: T, key: string, value: unknown): T {
6454
if (isEqual(source[key], value)) {
6555
return source

packages/core/tests/form.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2-
/* eslint-disable @typescript-eslint/no-explicit-any */
3-
41
import {describe, expect, it, vi} from 'vitest'
52

63
import {Formulier} from '../src/form.js'

packages/core/tests/state-utils.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2-
31
import {describe, expect, it} from 'vitest'
42

53
import {getPath, isInteger, isObject, removeKey, setKey, setPath, toPath} from '../src/state-utils.js'

packages/react/tests/form.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
2-
/* eslint-disable @typescript-eslint/no-unsafe-call */
3-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
4-
51
import * as React from 'react'
62
import {describe, expect, it} from 'vitest'
73
import {render} from '@testing-library/react'

0 commit comments

Comments
 (0)