-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy patheslint.config.mjs
More file actions
85 lines (83 loc) · 2.32 KB
/
eslint.config.mjs
File metadata and controls
85 lines (83 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import nextTypescript from 'eslint-config-next/typescript'
import nextCoreWebVitals from 'eslint-config-next/core-web-vitals'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import js from '@eslint/js'
import tsPlugin from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import vitestPlugin from '@vitest/eslint-plugin'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export default [
...nextTypescript,
js.configs.recommended,
...nextCoreWebVitals,
{
files: ['src/**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
},
globals: {
React: 'readonly',
},
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
...tsPlugin.configs['recommended'].rules,
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
// TypeScript handles redeclaration checks - allows type + value with same name
'no-redeclare': 'off',
// TODO: Refactor hooks to use React Query instead of useEffect + setState pattern
'react-hooks/set-state-in-effect': 'off',
},
},
{
// TypeScript declaration files - disable no-undef as types are ambient
files: ['src/**/*.d.ts'],
rules: {
'no-undef': 'off',
},
},
{
files: ['test/**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: './tsconfig.json',
},
globals: vitestPlugin.environments.env.globals,
},
plugins: {
'@typescript-eslint': tsPlugin,
vitest: vitestPlugin,
},
rules: {
...tsPlugin.configs['recommended'].rules,
...vitestPlugin.configs['recommended'].rules,
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'vitest/consistent-test-it': [
'error',
{
fn: 'test',
withinDescribe: 'it',
},
],
// TODO: clean up conditional tests
'vitest/no-conditional-expect': 'off',
},
},
{
ignores: ['node_modules/', '.next/', 'build/', '*.mjs', '*.js', '*.cjs'],
},
]