SillyTavern/.eslintrc.js

69 lines
2.2 KiB
JavaScript
Raw Normal View History

module.exports = {
root: true,
extends: [
2023-12-03 13:23:20 +01:00
'eslint:recommended',
],
env: {
2023-12-03 13:23:20 +01:00
es6: true,
},
parserOptions: {
2023-12-03 13:23:20 +01:00
ecmaVersion: 'latest',
},
overrides: [
{
// Server-side files (plus this configuration file)
2023-12-16 21:21:40 +01:00
files: ['src/**/*.js', './*.js', 'plugins/**/*.js'],
env: {
2023-12-03 13:23:20 +01:00
node: true,
},
},
{
// Browser-side files
2023-12-02 20:11:06 +01:00
files: ['public/**/*.js'],
env: {
browser: true,
2023-12-03 13:23:20 +01:00
jquery: true,
},
parserOptions: {
2023-12-03 13:23:20 +01:00
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',
2023-12-03 13:23:20 +01:00
toastr: 'readonly',
},
},
],
// There are various vendored libraries that shouldn't be linted
ignorePatterns: ['public/lib/**/*', '*.min.js', 'src/ai_horde/**/*'],
rules: {
2023-12-02 20:11:06 +01:00
'no-unused-vars': ['error', { args: 'none' }],
'no-control-regex': 'off',
2023-12-02 20:11:06 +01:00
'no-constant-condition': ['error', { checkLoops: false }],
2023-12-02 19:04:51 +01:00
'require-yield': 'off',
'quotes': ['error', 'single'],
2023-12-02 20:11:06 +01:00
'semi': ['error', 'always'],
2023-12-02 20:56:16 +01:00
'indent': ['error', 4, { SwitchCase: 1, FunctionDeclaration: { parameters: 'first' } }],
2023-12-02 21:06:57 +01:00
'comma-dangle': ['error', 'always-multiline'],
2023-12-03 13:23:20 +01:00
'eol-last': ['error', 'always'],
'no-trailing-spaces': 'error',
2023-12-04 18:32:41 +01:00
'object-curly-spacing': ['error', 'always'],
2023-12-06 21:08:06 +01:00
'space-infix-ops': 'error',
2023-12-02 19:04:51 +01:00
// These rules should eventually be enabled.
'no-async-promise-executor': 'off',
'no-inner-declarations': 'off',
2023-12-03 13:23:20 +01:00
},
};