forked from ONLYOFFICE/server
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patheslint.config.js
More file actions
89 lines (85 loc) · 2.67 KB
/
eslint.config.js
File metadata and controls
89 lines (85 loc) · 2.67 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
const js = require('@eslint/js');
const globals = require('globals');
const prettier = require('eslint-config-prettier');
const {includeIgnoreFile} = require('@eslint/compat');
const path = require('node:path');
const react = require('eslint-plugin-react');
const reactHooks = require('eslint-plugin-react-hooks');
const gitignorePath = path.resolve(__dirname, '.gitignore');
module.exports = [
includeIgnoreFile(gitignorePath),
{
ignores: [
'node_modules/',
'dist/',
'build/',
'coverage/',
'.next/',
'out/',
'AdminPanel/client/src/pages/AiIntegration/ai/**',
'AdminPanel/client/src/pages/AiIntegration/js/plugins.js',
'AdminPanel/client/src/pages/AiIntegration/js/plugins-ui.js',
'*.min.js',
'package-lock.json',
'npm-shrinkwrap.json',
'SpellChecker/**',
'Metrics/**'
]
},
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node, // All Node.js globals automatically
...globals.es2022 // Modern JavaScript globals
}
},
rules: {
// Code quality rules (compatible with Prettier)
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
'no-undef': 'error',
eqeqeq: 'off',
curly: ['error', 'all'],
// Server-friendly settings
'no-console': 'off', // Allow console in server code
'no-continue': 'off', // Allow continue statements
'no-plusplus': 'off',
// Modern JavaScript practices
'prefer-const': 'error', // Enforce const for immutable bindings
'no-var': 'error', // Enforce let/const over var
'object-shorthand': 'error', // Modern object property syntax
'prefer-arrow-callback': 'error', // Modern callback style
'no-duplicate-imports': 'error', // Avoid duplicate imports
'no-useless-constructor': 'error', // Remove unnecessary constructors
'no-useless-return': 'error', // Remove unnecessary return statements
'max-lines': ['warn', 5000]
}
},
{
files: ['AdminPanel/client/**/*.{js,jsx}'],
plugins: {react, 'react-hooks': reactHooks},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parserOptions: {ecmaFeatures: {jsx: true}},
globals: {...globals.browser, ...globals.es2022}
},
settings: {react: {version: 'detect'}},
rules: {
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-vars': 'error',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn'
}
},
prettier
];