mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-17 19:59:42 +01:00
Initial ESLint setup
This sets up ESLint and its config, and disables a bunch of recommended lints that currently do not pass. Later PRs/commits will fix those lints and re-enable them.
This commit is contained in:
parent
4c4e4caeb7
commit
ec0e4026d8
77
.eslintrc.js
Normal file
77
.eslintrc.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended'
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
es6: true
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 'latest'
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
// Server-side files (plus this configuration file)
|
||||||
|
files: ["src/**/*.js", "server.js", ".eslintrc.js"],
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// There are various vendored libraries that shouldn't be linted
|
||||||
|
ignorePatterns: ['public/lib/**/*', '*.min.js', 'src/ai_horde/**/*'],
|
||||||
|
// Most, if not all, of these rules should eventually be enabled and the code changed. They're disabled so that
|
||||||
|
// linting passes.
|
||||||
|
rules: {
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'no-useless-escape': 'off',
|
||||||
|
'no-control-regex': 'off',
|
||||||
|
'no-redeclare': 'off',
|
||||||
|
'no-async-promise-executor': 'off',
|
||||||
|
'no-inner-declarations': 'off',
|
||||||
|
'no-extra-semi': 'off',
|
||||||
|
'no-undef': 'off',
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'no-unused-labels': 'off',
|
||||||
|
'no-extra-boolean-cast': 'off',
|
||||||
|
'require-yield': 'off',
|
||||||
|
'no-case-declarations': 'off',
|
||||||
|
'use-isnan': 'off',
|
||||||
|
'no-self-assign': 'off',
|
||||||
|
'no-unsafe-negation': 'off',
|
||||||
|
'no-constant-condition': 'off',
|
||||||
|
'no-empty': 'off',
|
||||||
|
'no-unsafe-finally': 'off',
|
||||||
|
'no-dupe-keys': 'off',
|
||||||
|
'no-irregular-whitespace': 'off',
|
||||||
|
'no-regex-spaces': 'off',
|
||||||
|
'no-fallthrough': 'off'
|
||||||
|
}
|
||||||
|
};
|
903
package-lock.json
generated
903
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,8 @@
|
|||||||
"start": "node server.js",
|
"start": "node server.js",
|
||||||
"start-multi": "node server.js --disableCsrf",
|
"start-multi": "node server.js --disableCsrf",
|
||||||
"pkg": "pkg --compress Gzip --no-bytecode --public .",
|
"pkg": "pkg --compress Gzip --no-bytecode --public .",
|
||||||
"postinstall": "node post-install.js"
|
"postinstall": "node post-install.js",
|
||||||
|
"lint": "eslint \"src/**/*.js\" \"public/**/*.js\" ./server.js"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"sillytavern": "./server.js"
|
"sillytavern": "./server.js"
|
||||||
@ -82,6 +83,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"eslint": "^8.55.0",
|
||||||
"jquery": "^3.6.4",
|
"jquery": "^3.6.4",
|
||||||
"pkg": "^5.8.1",
|
"pkg": "^5.8.1",
|
||||||
"pkg-fetch": "^3.5.2"
|
"pkg-fetch": "^3.5.2"
|
||||||
|
Loading…
Reference in New Issue
Block a user