-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
113 lines (105 loc) · 3.6 KB
/
eslint.config.mjs
File metadata and controls
113 lines (105 loc) · 3.6 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
// Import plugins for comprehensive linting
import eslint from "@eslint/js"
import security from "eslint-plugin-security"
import html from "eslint-plugin-html"
// oxlint-disable-next-line import/no-default-export, import/no-anonymous-default-export -- ESLint flat config requires default export
export default [
// Global ignores
{
ignores: [
"node_modules/**",
"bin/**",
"obj/**",
"web/wwwroot/**",
"**/*.min.js",
"**/*.bundle.js",
"VueApp/node_modules/**",
"VueApp/dist/**",
"**/dist",
"**/coverage",
"*.d.ts",
],
},
// Main configuration for JS files (non-Vue)
{
files: ["scripts/**/*.{js,ts}"],
...eslint.configs.recommended,
plugins: {
security: security,
},
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
// Security plugin recommended rules
...security.configs.recommended.rules,
// Allow console and process.exit in scripts
"no-console": "off",
"no-process-exit": "off",
},
},
// Exclude cshtml files with Razor syntax (@Url.Content, ~) inside <script> blocks
// that breaks the JS parser — no rules can run on these anyway
{
ignores: [
"web/Areas/Directory/Views/Card.cshtml",
"web/Areas/Directory/Views/Table.cshtml",
"web/Areas/Students/Views/StudentClassYear.cshtml",
"web/Areas/Students/Views/StudentClassYearImport.cshtml",
],
},
// Configuration for CSHTML files (JavaScript in <script> tags)
{
files: ["web/**/*.cshtml"],
plugins: {
html,
security,
},
languageOptions: {
globals: {
// Browser globals (cshtml scripts run in browser context)
fetch: "readonly",
URL: "readonly",
URLSearchParams: "readonly",
location: "readonly",
history: "readonly",
window: "readonly",
document: "readonly",
console: "readonly",
setTimeout: "readonly",
setInterval: "readonly",
// Project globals (loaded via shared script tags in _VIPERLayout.cshtml)
createVueApp: "readonly",
viperFetch: "readonly",
quasarTable: "readonly",
formatDate: "readonly",
formatDateForDateInput: "readonly",
getItemFromStorage: "readonly",
putItemInStorage: "readonly",
showStatusNotification: "readonly",
Quasar: "readonly",
},
},
settings: {
"html/html-extensions": [".cshtml"],
"html/xml-extensions": [],
"html/indent": "+4",
"html/report-bad-indent": "error",
},
rules: {
// Apply same basic quality rules as Vue.js
...eslint.configs.recommended.rules,
// Security rules (from Vue.js config)
...security.configs.recommended.rules,
// Additional JavaScript quality rules from Vue config (not in recommended)
"no-alert": "warn",
// Keep these as errors - they prevent real bugs
eqeqeq: "error",
curly: "error",
"no-eval": "error",
"no-implied-eval": "error",
"no-new-func": "error",
},
},
]