-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eslintrc.cjs
More file actions
54 lines (54 loc) · 1.95 KB
/
.eslintrc.cjs
File metadata and controls
54 lines (54 loc) · 1.95 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
/**
* ESLint config for ArbeitszeitCheck
* Plain JS – Nextcloud globals, pragmatic rules for CI
*/
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
globals: {
OC: 'readonly',
},
extends: ['eslint:recommended'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
ignorePatterns: ['node_modules/', 'vendor/'],
overrides: [
{
files: ['js/**/*.test.js'],
rules: {
'no-restricted-syntax': 'off',
},
},
],
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'no-undef': ['error', { typeof: true }],
'no-inner-declarations': 'off',
'no-dupe-keys': 'warn',
'no-useless-escape': 'warn',
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.name='fetch'] > Literal:first-child[value=/^\\/apps\\/arbeitszeitcheck\\//]",
message: 'Do not call fetch() with raw /apps/arbeitszeitcheck paths. Use ArbeitszeitCheckUtils.resolveUrl(...) or Utils.ajax(...).',
},
{
selector: "CallExpression[callee.name='fetch'] > TemplateLiteral:first-child > TemplateElement[value.raw=/^\\/apps\\/arbeitszeitcheck\\//]",
message: 'Do not call fetch() with raw /apps/arbeitszeitcheck paths. Use ArbeitszeitCheckUtils.resolveUrl(...) or Utils.ajax(...).',
},
{
selector: "CallExpression[callee.name='fetch'] > Literal:first-child[value=/^(https?:)?\\/\\//]",
message: 'External fetch() URLs are disallowed by default. Route through ArbeitszeitCheckUtils.ajax(..., { allowExternal: true }) with justification.',
},
{
selector: "CallExpression[callee.name='fetch'] > TemplateLiteral:first-child > TemplateElement[value.raw=/^(https?:)?\\/\\//]",
message: 'External fetch() URLs are disallowed by default. Route through ArbeitszeitCheckUtils.ajax(..., { allowExternal: true }) with justification.',
},
],
},
}