-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy patheslint.config.mjs
More file actions
138 lines (127 loc) · 3.23 KB
/
eslint.config.mjs
File metadata and controls
138 lines (127 loc) · 3.23 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
135
136
137
138
import { FlatCompat } from '@eslint/eslintrc';
import pluginJs from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import prettier from 'eslint-config-prettier';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import globals from 'globals';
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
const eslintConfig = [
// General Ignore Patterns
{
ignores: ['**/.next/*', '**/dist/*', '**/out/*'],
},
// Base Configuration for JS/TS Files
{
files: [
'{networks,packages,wallets,apps/rosen-service2}/**/*.{js,jsx,ts,tsx}',
'apps/{guard,rosen,watcher}/{app,src}/**/*.{js,jsx,ts,tsx}',
],
languageOptions: {
parser: typescriptParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: {
'@typescript-eslint': typescriptEslint,
},
rules: {
...pluginJs.configs.recommended.rules,
...typescriptEslint.configs.recommended.rules,
},
},
// Browser-Specific Globals
{
files: ['{packages,wallets}/**/*.{js,jsx,ts,tsx}'],
ignores: [
'packages/asset-calculator/**/*.{js,jsx,ts,tsx}',
'packages/public-status/**/*.{js,jsx,ts,tsx}',
],
languageOptions: {
globals: globals.browser,
},
},
// Node-Specific Globals
{
files: [
'apps/rosen-service2/**/*.{js,jsx,ts,tsx}',
'networks/**/*.{js,jsx,ts,tsx}',
'packages/asset-calculator/**/*.{js,jsx,ts,tsx}',
'packages/asset-aggregator/**/*.{js,jsx,ts,tsx}',
'packages/public-status/**/*.{js,jsx,ts,tsx}',
],
languageOptions: {
globals: {
...globals.node,
...globals.vitest,
vi: 'readonly',
afterAll: 'readonly',
afterEach: 'readonly',
beforeAll: 'readonly',
beforeEach: 'readonly',
describe: 'readonly',
expect: 'readonly',
fit: 'readonly',
it: 'readonly',
jest: 'readonly',
test: 'readonly',
},
},
},
// React-Specific Rules and Plugins
{
files: [
'apps/{guard,rosen,watcher}/{app,src}/**/*.{js,jsx,ts,tsx}',
'packages/ui-kit/**/*.{js,jsx,ts,tsx}',
],
plugins: {
'react-refresh': reactRefresh,
'react-hooks': reactHooks,
},
rules: {
'react-refresh/only-export-components': 'warn',
...reactHooks.configs.recommended.rules,
},
},
{
files: ['packages/swr-helpers/**/*.{js,jsx,ts,tsx}'],
languageOptions: {
globals: {
process: 'readonly',
},
},
},
// Additional Global Rules
{
languageOptions: {
parser: typescriptParser,
globals: {
...globals.node,
...globals.vitest,
},
},
plugins: {
'@typescript-eslint': typescriptEslint,
},
rules: {
'@typescript-eslint/no-unused-expressions': [
'error',
{ allowShortCircuit: true },
],
},
},
...compat.config({
extends: ['next/core-web-vitals'],
settings: {
next: {
rootDir: ['apps/guard', 'apps/rosen', 'apps/watcher'],
},
},
}),
// Integrate Prettier for Formatting
prettier,
];
export default eslintConfig;