Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
134 lines (131 loc) · 3.44 KB
/
Copy patheslint.config.js
File metadata and controls
134 lines (131 loc) · 3.44 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
import js from '@eslint/js';
import prettier from 'eslint-config-prettier';
const nodeGlobals = {
process: 'readonly',
console: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
Buffer: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
fetch: 'readonly',
AbortSignal: 'readonly',
AbortController: 'readonly',
performance: 'readonly',
structuredClone: 'readonly',
queueMicrotask: 'readonly',
crypto: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
};
const browserGlobals = {
window: 'readonly',
document: 'readonly',
console: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
requestAnimationFrame: 'readonly',
cancelAnimationFrame: 'readonly',
fetch: 'readonly',
navigator: 'readonly',
localStorage: 'readonly',
sessionStorage: 'readonly',
indexedDB: 'readonly',
URLSearchParams: 'readonly',
URL: 'readonly',
performance: 'readonly',
WebSocket: 'readonly',
BroadcastChannel: 'readonly',
Notification: 'readonly',
XMLSerializer: 'readonly',
Blob: 'readonly',
File: 'readonly',
Image: 'readonly',
atob: 'readonly',
btoa: 'readonly',
alert: 'readonly',
prompt: 'readonly',
};
export default [
js.configs.recommended,
{
files: ['backend/src/**/*.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: nodeGlobals,
},
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-console': 'warn',
'no-shadow': ['error', { builtinGlobals: false, hoist: 'all', allow: [] }],
'no-restricted-syntax': [
'error',
{
selector: 'MemberExpression[object.name="process"][property.name=/^[A-Z_]+$/]',
message: 'Accessing process.env directly is not allowed. Use getConfig() from backend/src/config/env.js instead.',
},
],
},
},
{
files: ['backend/src/config/env.js', 'backend/src/config/secrets.js'],
rules: {
'no-restricted-syntax': 'off',
},
},
{
files: ['backend/tests/**/*.js', 'testing/**/*.js'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: nodeGlobals,
},
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-shadow': ['error', { builtinGlobals: false, hoist: 'all', allow: [] }],
},
},
// Files that use require() (CJS-style imports inside ESM modules)
{
files: [
'backend/src/notifications/channels/email.js',
'backend/src/notifications/channels/sms.js',
],
languageOptions: {
globals: { ...nodeGlobals, require: 'readonly' },
},
},
// Frontend source files — browser environment
{
files: ['frontend/src/**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parserOptions: { ecmaFeatures: { jsx: true } },
globals: browserGlobals,
},
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-console': 'warn',
'no-shadow': ['error', { builtinGlobals: false, hoist: 'all', allow: [] }],
// Disable rules from plugins not installed at root scope
'react-hooks/exhaustive-deps': 'off',
},
},
prettier,
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'**/coverage/**',
'frontend/**',
'scripts/**',
],
},
];