forked from SillyTavern/SillyTavern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
92 lines (91 loc) · 2.81 KB
/
.eslintrc.js
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
module.exports = {
root: true,
extends: [
'eslint:recommended',
],
env: {
es6: true,
},
parserOptions: {
ecmaVersion: 'latest',
},
overrides: [
{
// Server-side files (plus this configuration file)
files: ['src/**/*.js', './*.js', 'plugins/**/*.js'],
env: {
node: true,
},
},
{
files: ['src/**/*.mjs'],
parserOptions: {
sourceType: 'module',
},
env: {
node: true,
},
},
{
// Browser-side files
files: ['public/**/*.js'],
env: {
browser: true,
jquery: true,
},
parserOptions: {
sourceType: 'module',
},
// These scripts are loaded in HTML; tell ESLint not to complain about them being undefined
globals: {
DOMPurify: 'readonly',
droll: 'readonly',
Fuse: 'readonly',
Handlebars: 'readonly',
hljs: 'readonly',
localforage: 'readonly',
moment: 'readonly',
pdfjsLib: 'readonly',
Popper: 'readonly',
showdown: 'readonly',
showdownKatex: 'readonly',
SVGInject: 'readonly',
toastr: 'readonly',
Readability: 'readonly',
isProbablyReaderable: 'readonly',
ePub: 'readonly',
diff_match_patch: 'readonly',
SillyTavern: 'readonly',
},
},
],
// There are various vendored libraries that shouldn't be linted
ignorePatterns: [
'public/lib/**/*',
'*.min.js',
'src/ai_horde/**/*',
'plugins/**/*',
'data/**/*',
'backups/**/*',
'node_modules/**/*',
],
rules: {
'no-unused-vars': ['error', { args: 'none' }],
'no-control-regex': 'off',
'no-constant-condition': ['error', { checkLoops: false }],
'require-yield': 'off',
'quotes': ['error', 'single'],
'semi': ['error', 'always'],
'indent': ['error', 4, { SwitchCase: 1, FunctionDeclaration: { parameters: 'first' } }],
'comma-dangle': ['error', 'always-multiline'],
'eol-last': ['error', 'always'],
'no-trailing-spaces': 'error',
'object-curly-spacing': ['error', 'always'],
'space-infix-ops': 'error',
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'no-cond-assign': 'error',
// These rules should eventually be enabled.
'no-async-promise-executor': 'off',
'no-inner-declarations': 'off',
},
};