-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy patheslint.config.js
More file actions
145 lines (142 loc) · 3.48 KB
/
eslint.config.js
File metadata and controls
145 lines (142 loc) · 3.48 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import globals from 'globals';
// Shared React configuration
const reactConfig = {
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
},
},
plugins: {
react,
'react-hooks': reactHooks,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...react.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
...reactHooks.configs.recommended.rules,
'react-hooks/static-components': 'off',
// Disable set-state-in-effect as it's too strict for legitimate use cases
'react-hooks/set-state-in-effect': 'off',
},
};
export default [
// Globally ignored files and directories
{
ignores: [
// Dependencies
'node_modules/**',
'package/@stackframe/**',
// Build outputs
'dist/**',
'dist-electron/**',
'build/**',
'release/**',
// Cache
'.cache/**',
'.vite/**',
// Config files
'vite.config.ts',
'vitest.config.ts',
'tailwind.config.js',
'postcss.config.cjs',
// Generated files
'**/*.d.ts',
'**/*.map',
// Python files
'**/*.py',
'__pycache__/**',
'**/.venv/**',
// Prebuilt resources
'resources/prebuilt/**',
],
},
// Configuration for JavaScript files
{
files: ['**/*.js'],
...js.configs.recommended,
},
// Configuration for JSX files
{
files: ['**/*.jsx'],
...js.configs.recommended,
...reactConfig,
rules: {
...js.configs.recommended.rules,
...reactConfig.rules,
'no-unused-vars': 'off',
'no-undef': 'off',
},
},
// Configuration for Storybook files (simple config, no project)
{
files: ['.storybook/**/*.{ts,tsx}'],
...reactConfig,
languageOptions: {
...reactConfig.languageOptions,
parser: typescriptParser,
},
rules: {
...reactConfig.rules,
'no-unused-vars': 'off',
'no-undef': 'off',
},
},
// Configuration for all TypeScript files (with project)
{
files: ['**/*.{ts,tsx}'],
ignores: ['.storybook/**'],
...reactConfig,
languageOptions: {
...reactConfig.languageOptions,
parser: typescriptParser,
parserOptions: {
...reactConfig.languageOptions.parserOptions,
projectService: true,
},
},
plugins: {
...reactConfig.plugins,
'@typescript-eslint': typescript,
},
rules: {
...reactConfig.rules,
// Disable prop-types for TypeScript files as TypeScript handles type checking
'react/prop-types': 'off',
// Disable base rule as it conflicts with TypeScript version
'no-unused-vars': 'off',
// Disable no-undef for TypeScript files as TypeScript handles this
'no-undef': 'off',
// TypeScript rules
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
},
},
// Prettier config (must be last to override conflicting rules)
prettier,
];