-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheslint.config.cjs
More file actions
143 lines (129 loc) · 3.41 KB
/
Copy patheslint.config.cjs
File metadata and controls
143 lines (129 loc) · 3.41 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
139
140
141
142
143
const js = require('@eslint/js');
const tseslint = require('typescript-eslint');
const react = require('eslint-plugin-react');
const reactHooks = require('eslint-plugin-react-hooks');
const eslintConfigPrettier = require('eslint-config-prettier');
/** @type {import("eslint").Linter.FlatConfig[]} */
module.exports = [
{
ignores: [
'.output/**',
'.wxt/**',
'.safari-xcode/**',
'dist/**',
'dist-firefox/**',
'node_modules/**',
'_temp/**',
'cloudflare-workers/**',
'public/src/vendor/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['src/**/*.{ts,tsx}', 'tests/**/*.{ts,tsx}'],
plugins: {
react,
'react-hooks': reactHooks,
},
languageOptions: {
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
settings: {
react: { version: 'detect' },
},
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
// The codebase uses `any` in DOM scraping and protocol boundary areas.
// Keep it permissive until we have time to tighten types.
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-unused-expressions': 'off',
'no-useless-escape': 'off',
'prefer-const': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
},
{
files: ['src/ui/**/*.{ts,tsx}', 'src/viewmodels/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['@platform', '@platform/*', '@platform/**'],
},
],
},
},
{
files: ['src/services/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: ['@ui', '@ui/*', '@ui/**', '@viewmodels', '@viewmodels/*', '@viewmodels/**'],
},
],
},
},
// Bootstrap and Shadow-DOM panel mounting are glue layers that currently reuse UI modules/styles.
// Keep them unblocked by the strict service -> ui restriction, but avoid introducing new deps elsewhere.
{
files: ['src/services/bootstrap/**/*.{ts,tsx}', 'src/services/comments/threaded-comments-panel.ts'],
rules: {
'no-restricted-imports': 'off',
},
},
{
files: ['tests/**/*.{ts,tsx}'],
rules: {
// Tests sometimes embed escape-heavy strings; keep the rule enabled for src when re-enabled.
'no-useless-escape': 'off',
},
},
{
files: ['**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
globals: {
module: 'readonly',
require: 'readonly',
exports: 'readonly',
__dirname: 'readonly',
process: 'readonly',
},
},
rules: {
'no-undef': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
},
{
files: ['.github/scripts/**/*.{js,mjs}'],
languageOptions: {
sourceType: 'module',
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
setTimeout: 'readonly',
fetch: 'readonly',
FormData: 'readonly',
Blob: 'readonly',
URLSearchParams: 'readonly',
},
},
},
eslintConfigPrettier,
];