-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy patheslint.config.mjs
More file actions
112 lines (110 loc) · 3.02 KB
/
Copy patheslint.config.mjs
File metadata and controls
112 lines (110 loc) · 3.02 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
// @ts-check
import eslint from '@eslint/js'
import globals from 'globals'
import { defineConfig } from 'eslint/config'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
const tsconfigRootDir = import.meta.dirname
export default defineConfig([
eslint.configs.recommended,
tseslint.configs.recommended,
{
ignores: [
'.claude/**',
'dist',
'coverage',
'.vite',
'out',
'__mocks__/**',
'./common/api/generated/**',
'utils/digicert-hook.js',
],
},
{
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
ignores: ['e2e-tests/**/*'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
tsconfigRootDir,
},
},
plugins: {
...reactHooks.configs.flat.recommended.plugins,
...reactRefresh.configs.recommended.plugins,
},
rules: {
...reactRefresh.configs.recommended.rules,
...reactHooks.configs.flat.recommended.rules,
// Allow route files to export `Route = createFileRoute(...)(...)`
// alongside their component, and allow shared constants in
// component files. The TanStack helpers aren't real React HOCs,
// but listing them here matches our project convention of
// co-locating the component with the route definition.
'react-refresh/only-export-components': [
'error',
{
allowConstantExport: true,
extraHOCs: ['createFileRoute', 'createRootRouteWithContext'],
},
],
},
},
{
extends: [eslint.configs.recommended, ...tseslint.configs.recommended],
files: ['e2e-tests/**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.node,
parserOptions: {
tsconfigRootDir,
},
},
},
{
files: ['scripts/**/*.mjs'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: globals.node,
},
},
// EXPERIMENT (issue #2296): ban hardcoded brand literals; enumerate sites.
{
files: [
'renderer/**/*.{ts,tsx}',
'main/**/*.{ts,tsx}',
'common/**/*.{ts,tsx}',
'preload/**/*.{ts,tsx}',
],
ignores: [
'**/__tests__/**',
'**/*.test.{ts,tsx}',
'**/mocks/**',
'common/app-info.ts',
],
rules: {
'no-restricted-syntax': [
'error',
{
selector: 'Literal[value=/ToolHive/]',
message:
"Hardcoded 'ToolHive' brand string — import from @common/app-info instead.",
},
{
selector: 'JSXText[value=/ToolHive/]',
message:
"Hardcoded 'ToolHive' brand string — import from @common/app-info instead.",
},
{
selector: 'TemplateElement[value.cooked=/ToolHive/]',
message:
"Hardcoded 'ToolHive' brand string — import from @common/app-info instead.",
},
],
},
},
])