-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy patheslint.config.js
More file actions
92 lines (80 loc) · 2.58 KB
/
eslint.config.js
File metadata and controls
92 lines (80 loc) · 2.58 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
import antfu from '@antfu/eslint-config';
import globals from 'globals';
export default antfu(
{
type: 'app',
// Disable TypeScript, Vue, etc. since this is vanilla JS
typescript: false,
vue: false,
react: false,
jsonc: false,
yaml: false,
markdown: false,
ignores: [
'vendor/**',
'tests/**',
'docs/**',
'resources/vendor/**'
],
// Stylistic formatting rules
stylistic: {
indent: 4,
quotes: 'single',
semi: true
}
},
// Custom rules for the project
{
rules: {
// Allow console in debug library
'no-console': 'off',
// Allow unused vars with _ prefix or Widget suffix
'unused-imports/no-unused-vars': ['error', {
args: 'none',
varsIgnorePattern: '^(_|.*Widget)$',
caughtErrors: 'none'
}],
'no-unused-vars': ['error', {
args: 'none',
varsIgnorePattern: '^(_|.*Widget)$',
caughtErrors: 'none'
}],
// Code style
'style/brace-style': ['error', '1tbs'],
'style/comma-dangle': ['error', 'never'],
'style/no-mixed-operators': 'off',
'style/max-statements-per-line': 'off',
// Relax some rules for legacy patterns
'no-prototype-builtins': 'off',
'no-sequences': 'off',
'no-unused-expressions': 'off',
'no-use-before-define': ['error', { functions: false, classes: true, variables: true }],
'unicorn/no-array-for-each': 'off',
// JSDoc relaxed rules
'jsdoc/require-returns-description': 'off',
'jsdoc/check-param-names': 'off',
// Allow function expressions (for Widget.extend pattern)
'func-style': 'off',
'antfu/consistent-list-newline': 'off',
// Modern JavaScript requirements
'prefer-const': 'error',
'no-var': 'error',
'prefer-arrow-callback': 'warn',
'prefer-template': 'warn',
'object-shorthand': 'warn'
}
},
// Custom config for resources folder
{
files: ['resources/**/*.js'],
languageOptions: {
ecmaVersion: 2020,
sourceType: 'script',
globals: {
...globals.browser,
PhpDebugBar: 'writable',
hljs: 'readonly'
}
}
}
);