-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
123 lines (112 loc) · 3.26 KB
/
Copy patheslint.config.js
File metadata and controls
123 lines (112 loc) · 3.26 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
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReact from "eslint-plugin-react";
import pluginReactHooks from "eslint-plugin-react-hooks";
import pluginUnusedImports from "eslint-plugin-unused-imports";
export default [
// =========================================================================
// Frontend (React) configuration
// =========================================================================
{
files: [
"src/components/**/*.{js,mjs,cjs,jsx}",
"src/pages/**/*.{js,mjs,cjs,jsx}",
"src/Layout.jsx",
],
ignores: ["src/lib/**/*", "src/components/ui/**/*"],
...pluginJs.configs.recommended,
...pluginReact.configs.flat.recommended,
languageOptions: {
globals: globals.browser,
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
},
plugins: {
react: pluginReact,
"react-hooks": pluginReactHooks,
"unused-imports": pluginUnusedImports,
},
rules: {
"no-unused-vars": "off",
"react/jsx-uses-vars": "error",
"react/jsx-uses-react": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"react/no-unknown-property": [
"error",
{ ignore: ["cmdk-input-wrapper", "toast-close"] },
],
"react-hooks/rules-of-hooks": "error",
},
},
// =========================================================================
// Backend (Electron main process) configuration
// =========================================================================
{
files: [
"electron/**/*.cjs",
],
...pluginJs.configs.recommended,
languageOptions: {
globals: {
...globals.node,
},
parserOptions: {
ecmaVersion: 2022,
sourceType: "commonjs",
},
},
rules: {
// Disallow bare console.log/warn/error in production code.
// Use the structured logger (electron/services/logger.cjs) instead.
"no-console": "warn",
// Catch variables that are declared but never read
"no-unused-vars": [
"warn",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
},
],
// Enforce consistent error handling
"no-throw-literal": "error",
// Prevent accidental assignments in conditions
"no-cond-assign": ["error", "always"],
// Disallow eval() — security-critical for HIPAA compliance
"no-eval": "error",
"no-implied-eval": "error",
// Require strict equality
"eqeqeq": ["error", "always"],
// Disallow with statements
"no-with": "error",
// Prevent duplicate keys in objects
"no-dupe-keys": "error",
// No unreachable code
"no-unreachable": "error",
// Require valid typeof comparisons
"valid-typeof": "error",
},
},
];