Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
125 lines (124 loc) · 3.62 KB
/
Copy patheslint.config.js
File metadata and controls
125 lines (124 loc) · 3.62 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
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import reactPlugin from 'eslint-plugin-react'
import { defineConfig, globalIgnores } from 'eslint/config'
import tsParser from '@typescript-eslint/parser'
import tsPlugin from '@typescript-eslint/eslint-plugin'
export default defineConfig([
globalIgnores(['dist', 'sdk/**', 'functions/lib/**']),
{
files: ['**/*.{js,jsx}'],
ignores: ['functions/**'],
extends: [
js.configs.recommended,
reactPlugin.configs.flat.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^[A-Z_]' }],
'no-undef': 'error',
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
'react/react-in-jsx-scope': 'off', // Not needed in modern Vite/React
'react-hooks/exhaustive-deps': 'error',
'react/jsx-no-duplicate-props': 'error',
'react/jsx-key': 'error',
'react/no-array-index-key': 'warn',
'react/no-direct-mutation-state': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'error',
},
},
// TypeScript / TSX — use @typescript-eslint parser
{
files: ['**/*.{ts,tsx}'],
ignores: ['functions/**'],
plugins: {
'@typescript-eslint': tsPlugin,
react: reactPlugin,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
globals: globals.browser,
},
settings: {
react: { version: 'detect' },
},
rules: {
// Disable base rule — TS version handles it
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^[_A-Z]' }],
'no-undef': 'off', // TS handles undefined references
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/exhaustive-deps': 'error',
'react/jsx-no-duplicate-props': 'error',
'react/jsx-key': 'error',
'react/no-array-index-key': 'warn',
'react/no-direct-mutation-state': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-debugger': 'error',
},
},
{
files: ['src/pages/MockupStudio/**/*.jsx', 'src/components/Three/**/*.jsx'],
rules: {
'react/no-unknown-property': 'off', // R3F uses camelCase versions of standard Three properties
},
},
{
files: [
'scripts/**/*.js',
'functions/scripts/**/*.js',
'test_*.js',
'*.js',
'*.cjs',
'src/**/*.test.jsx'
],
languageOptions: {
globals: {
...globals.node,
},
},
rules: {
'no-undef': 'off',
'no-console': 'off', // Scripts and tests can use console
},
},
{
files: ['functions/**/*.js'],
languageOptions: {
ecmaVersion: 2022,
globals: globals.node,
sourceType: 'module',
},
rules: {
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^[A-Z_]' }],
},
},
])