-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
132 lines (124 loc) · 4.07 KB
/
Copy patheslint.config.js
File metadata and controls
132 lines (124 loc) · 4.07 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
import js from '@eslint/js'
import typescript from '@typescript-eslint/eslint-plugin'
import typescriptParser from '@typescript-eslint/parser'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import security from 'eslint-plugin-security'
export default [
{
ignores: [
'dist/**',
'node_modules/**',
'.eslintrc.cjs',
'vite.config.ts',
'vitest.config.ts',
'tailwind.config.js',
'postcss.config.js',
'test-azure.js',
'eslint.config.js',
'public/sw.ts',
// Server-side / tooling files not included in tsconfig
'server.js',
'simple-server.js',
'cli.js',
'prisma.config.ts',
'examples/**',
// JS utility files not included in tsconfig
'src/utils/auth0.js',
'src/utils/keyVault.js',
'src/utils/testAuthConfig.js'
]
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parser: typescriptParser,
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
jsx: true
}
},
globals: {
// Browser globals
console: 'readonly',
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
fetch: 'readonly',
alert: 'readonly',
setTimeout: 'readonly',
setInterval: 'readonly',
clearTimeout: 'readonly',
clearInterval: 'readonly',
indexedDB: 'readonly',
localStorage: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
atob: 'readonly',
btoa: 'readonly',
crypto: 'readonly',
// Node.js globals for API routes and server-side code
process: 'readonly',
global: 'readonly',
NodeJS: 'readonly',
Buffer: 'readonly'
}
},
plugins: {
'@typescript-eslint': typescript,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
'security': security
},
rules: {
// Base ESLint recommended rules
...js.configs.recommended.rules,
// React hooks rules
...reactHooks.configs.recommended.rules,
// React refresh rules
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true }
],
// TypeScript rules (more lenient for existing codebase)
'@typescript-eslint/no-explicit-any': 'warn', // Warn instead of error
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'warn', // Warn instead of error
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}],
// Security rules (more lenient)
'security/detect-object-injection': 'warn',
'security/detect-non-literal-regexp': 'warn',
'security/detect-unsafe-regex': 'warn',
'security/detect-buffer-noassert': 'error',
'security/detect-child-process': 'error',
'security/detect-disable-mustache-escape': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-no-csrf-before-method-override': 'warn',
'security/detect-non-literal-fs-filename': 'warn',
'security/detect-non-literal-require': 'warn',
'security/detect-possible-timing-attacks': 'warn',
'security/detect-pseudoRandomBytes': 'warn',
// Disable base JS rules that TypeScript already handles
'no-undef': 'off',
'no-unused-vars': 'off',
// General rules
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'no-script-url': 'error',
'no-console': 'off', // Allow console for debugging
'no-empty': 'warn',
'no-case-declarations': 'warn'
}
}
]