SillyTavern/.eslintrc.js

65 lines
2.0 KiB
JavaScript
Raw Normal View History

module.exports = {
root: true,
extends: [
'eslint:recommended'
],
env: {
es6: true
},
parserOptions: {
ecmaVersion: 'latest'
},
overrides: [
{
// Server-side files (plus this configuration file)
2023-12-02 20:11:06 +01:00
files: ['src/**/*.js', 'server.js', '.eslintrc.js'],
env: {
node: true
}
},
{
// Browser-side files
2023-12-02 20:11:06 +01:00
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/**/*'],
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-02 19:04:51 +01:00
// These rules should eventually be enabled.
'no-async-promise-executor': 'off',
'no-inner-declarations': 'off',
}
};