-
Notifications
You must be signed in to change notification settings - Fork 305
Expand file tree
/
Copy patheslint.config.mjs
More file actions
102 lines (101 loc) · 3.62 KB
/
eslint.config.mjs
File metadata and controls
102 lines (101 loc) · 3.62 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
import js from '@eslint/js'
import globals from 'globals'
export default [
js.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.node,
...globals.mocha,
fetch: 'readonly',
AbortController: 'readonly',
Headers: 'readonly',
Request: 'readonly',
Response: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly'
}
},
rules: {
// StandardJS-like rules
'no-unused-vars': ['warn', {
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
vars: 'all'
}],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-var': 'error',
'prefer-const': ['error', { destructuring: 'all' }],
'quote-props': ['error', 'as-needed'],
semi: ['error', 'never'],
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'comma-dangle': ['error', 'never'],
'space-before-function-paren': ['error', 'always'],
indent: ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
MemberExpression: 1,
FunctionDeclaration: { parameters: 1, body: 1 },
FunctionExpression: { parameters: 1, body: 1 },
CallExpression: { arguments: 1 },
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
ignoreComments: false,
ignoredNodes: ['TemplateLiteral *', 'JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
offsetTernaryExpressions: true
}],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'keyword-spacing': ['error', { before: true, after: true }],
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'space-in-parens': ['error', 'never'],
'space-before-blocks': ['error', 'always'],
'space-infix-ops': 'error',
'eol-last': 'error',
'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'no-trailing-spaces': 'error',
'comma-spacing': ['error', { before: false, after: true }],
'no-multi-spaces': 'error',
'no-mixed-operators': ['error', {
groups: [
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof']
],
allowSamePrecedence: true
}],
'operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before', '|>': 'before' } }],
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'arrow-spacing': ['error', { before: true, after: true }],
'padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }]
}
},
{
// Browser files (client-side code)
files: ['common/**/*.mjs'],
languageOptions: {
globals: {
...globals.browser,
solid: 'readonly',
UI: 'readonly',
owaspPasswordStrengthTest: 'readonly'
}
}
},
{
ignores: [
'node_modules/**',
'coverage/**',
'.db/**',
'data/**',
'resources/**'
]
}
]