Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
127 lines (126 loc) · 4.24 KB
/
Copy patheslint.config.js
File metadata and controls
127 lines (126 loc) · 4.24 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
import js from '@eslint/js';
import jest from 'eslint-plugin-jest';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
export default [
{
ignores: [
'node_modules/**',
'coverage/**',
'*.min.js',
'**/dist/**',
'dist/**',
'build/**',
'packages/*/dist/**',
'packages-control/*/dist/**',
'packages-clients/*/dist/**',
'packages-shared/*/dist/**',
'packages-clients/tenant-api-client/node_modules/**',
'packages-clients/tenant-api-client/coverage/**',
'**/*.d.ts',
// Локальные/утилитарные скрипты (не часть пакетов)
'scripts/**',
'*.mjs',
'**/*.mjs',
],
},
js.configs.recommended,
{
files: ['**/*.js', '**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module'
},
globals: {
console: 'readonly',
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
global: 'readonly',
module: 'readonly',
require: 'readonly',
exports: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
fetch: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
structuredClone: 'readonly',
performance: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint
},
rules: {
// Запрещаем динамические импорты (import()) для JS
'no-restricted-syntax': [
'error',
{
selector: 'ImportExpression',
message: 'Динамические импорты (import()) запрещены. Используйте статические импорты в начале файла.',
},
],
// Разрешаем неиспользуемые переменные с префиксом _ (стандартная практика)
'no-unused-vars': 'off', // Отключаем для JS, используем TypeScript правило
// TypeScript правила
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
]
},
},
// Конфигурация для UI файлов (браузерное окружение)
{
files: ['packages-control/controlo-ui/src/**/*.ts', 'packages-control/controlo-ui/src/**/*.js'],
languageOptions: {
globals: {
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
location: 'readonly',
history: 'readonly',
alert: 'readonly',
confirm: 'readonly',
HTMLElement: 'readonly',
KeyboardEvent: 'readonly',
structuredClone: 'readonly',
},
},
},
// Конфигурация для роутера (разрешаем динамические импорты для code splitting)
{
files: ['**/router/**', '**/router/**/*.ts', '**/router/**/*.js', 'packages-control/controlo-ui/src/app/router/**'],
rules: {
'no-restricted-syntax': 'off', // Разрешаем динамические импорты в роутере (стандартная практика Vue Router)
},
},
// Конфигурация для тестовых файлов
{
files: ['**/__tests__/**', '**/*.test.js', '**/*.test.ts', '**/*.spec.js', '**/*.spec.ts'],
plugins: {
jest,
},
languageOptions: {
globals: {
...jest.environments.globals.globals,
},
},
rules: {
// В тестах разрешаем динамические импорты (могут быть нужны для условной загрузки)
'no-restricted-syntax': 'off',
// В тестах разрешаем неиспользуемые переменные (могут быть для отладки или будущего использования)
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
},
},
];