2023-12-02 15:02:57 +01:00
|
|
|
module.exports = {
|
|
|
|
root: true,
|
|
|
|
extends: [
|
2023-12-03 13:23:20 +01:00
|
|
|
'eslint:recommended',
|
2023-12-02 15:02:57 +01:00
|
|
|
],
|
|
|
|
env: {
|
2023-12-03 13:23:20 +01:00
|
|
|
es6: true,
|
2023-12-02 15:02:57 +01:00
|
|
|
},
|
|
|
|
parserOptions: {
|
2023-12-03 13:23:20 +01:00
|
|
|
ecmaVersion: 'latest',
|
2023-12-02 15:02:57 +01:00
|
|
|
},
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
// Server-side files (plus this configuration file)
|
2023-12-16 21:21:40 +01:00
|
|
|
files: ['src/**/*.js', './*.js', 'plugins/**/*.js'],
|
2023-12-02 15:02:57 +01:00
|
|
|
env: {
|
2023-12-03 13:23:20 +01:00
|
|
|
node: true,
|
|
|
|
},
|
2024-10-10 21:37:22 +02:00
|
|
|
parserOptions: {
|
|
|
|
sourceType: 'module',
|
|
|
|
},
|
2024-10-18 11:13:25 +02:00
|
|
|
globals: {
|
|
|
|
globalThis: 'readonly',
|
|
|
|
},
|
2023-12-02 15:02:57 +01:00
|
|
|
},
|
2024-10-13 13:01:41 +02:00
|
|
|
{
|
|
|
|
files: ['*.cjs'],
|
|
|
|
parserOptions: {
|
|
|
|
sourceType: 'commonjs',
|
|
|
|
},
|
|
|
|
env: {
|
|
|
|
node: true,
|
|
|
|
},
|
|
|
|
},
|
2024-07-17 14:48:59 +02:00
|
|
|
{
|
|
|
|
files: ['src/**/*.mjs'],
|
|
|
|
parserOptions: {
|
|
|
|
sourceType: 'module',
|
|
|
|
},
|
|
|
|
env: {
|
|
|
|
node: true,
|
|
|
|
},
|
|
|
|
},
|
2023-12-02 15:02:57 +01:00
|
|
|
{
|
|
|
|
// Browser-side files
|
2023-12-02 20:11:06 +01:00
|
|
|
files: ['public/**/*.js'],
|
2023-12-02 15:02:57 +01:00
|
|
|
env: {
|
|
|
|
browser: true,
|
2023-12-03 13:23:20 +01:00
|
|
|
jquery: true,
|
2023-12-02 15:02:57 +01:00
|
|
|
},
|
|
|
|
parserOptions: {
|
2023-12-03 13:23:20 +01:00
|
|
|
sourceType: 'module',
|
2023-12-02 15:02:57 +01:00
|
|
|
},
|
|
|
|
// These scripts are loaded in HTML; tell ESLint not to complain about them being undefined
|
|
|
|
globals: {
|
2024-10-17 19:59:42 +02:00
|
|
|
ePub: 'readonly',
|
2024-10-17 19:53:18 +02:00
|
|
|
pdfjsLib: 'readonly',
|
2023-12-03 13:23:20 +01:00
|
|
|
toastr: 'readonly',
|
2024-08-12 20:56:32 +02:00
|
|
|
SillyTavern: 'readonly',
|
2023-12-03 13:23:20 +01:00
|
|
|
},
|
|
|
|
},
|
2023-12-02 15:02:57 +01:00
|
|
|
],
|
2024-04-13 12:29:52 +02:00
|
|
|
ignorePatterns: [
|
2024-10-06 18:12:28 +02:00
|
|
|
'**/node_modules/**',
|
|
|
|
'**/dist/**',
|
|
|
|
'**/.git/**',
|
|
|
|
'public/lib/**',
|
|
|
|
'backups/**',
|
|
|
|
'data/**',
|
|
|
|
'cache/**',
|
|
|
|
'src/tokenizers/**',
|
|
|
|
'docker/**',
|
|
|
|
'plugins/**',
|
|
|
|
'**/*.min.js',
|
2024-10-13 13:01:41 +02:00
|
|
|
'public/scripts/extensions/quick-reply/lib/**',
|
2024-04-13 12:29:52 +02:00
|
|
|
],
|
2023-12-02 15:02:57 +01:00
|
|
|
rules: {
|
2023-12-02 20:11:06 +01:00
|
|
|
'no-unused-vars': ['error', { args: 'none' }],
|
2023-12-02 15:02:57 +01:00
|
|
|
'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',
|
2024-04-14 14:40:10 +02:00
|
|
|
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
|
|
|
|
'no-cond-assign': 'error',
|
2023-12-02 19:04:51 +01:00
|
|
|
|
|
|
|
// These rules should eventually be enabled.
|
2023-12-02 15:02:57 +01:00
|
|
|
'no-async-promise-executor': 'off',
|
|
|
|
'no-inner-declarations': 'off',
|
2023-12-03 13:23:20 +01:00
|
|
|
},
|
2023-12-02 15:02:57 +01:00
|
|
|
};
|