forked from Stakeholder-Network-Map/HHI
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
87 lines (81 loc) · 2.2 KB
/
eslint.config.js
File metadata and controls
87 lines (81 loc) · 2.2 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
86
87
import js from '@eslint/js'
import tseslint from '@typescript-eslint/eslint-plugin'
import tsparser from '@typescript-eslint/parser'
import reactPlugin from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import prettierConfig from 'eslint-config-prettier'
import { fileURLToPath } from 'url'
import globals from 'globals'
import path from 'path'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
export default [
// Global ignores
{
ignores: ['dist/**', 'dist-ssr/**', 'node_modules/**', '.vite/**', 'backend/**', '*.local'],
},
// Base recommended config
js.configs.recommended,
// TypeScript configuration for source files
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
...reactPlugin.configs.flat.recommended,
languageOptions: {
...reactPlugin.configs.flat.recommended.languageOptions,
parser: tsparser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
globals: {
...globals.browser,
},
},
plugins: {
'@typescript-eslint': tseslint,
'react-hooks': reactHooks,
},
rules: {
...tseslint.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/no-explicit-any': 'off', // TODO: I would love to tighten this later
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
},
// Config files (no type-checking)
{
files: ['*.config.js', '*.config.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
globals: {
console: 'readonly',
process: 'readonly',
__dirname: 'readonly',
NodeJS: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
...tseslint.configs.recommended.rules,
},
},
// Prettier config last to disable conflicting rules
prettierConfig,
]