69 lines
2.2 KiB
JavaScript
69 lines
2.2 KiB
JavaScript
module.exports = {
|
|
root: true,
|
|
extends: [
|
|
'eslint:recommended',
|
|
'plugin:jsdoc/recommended',
|
|
],
|
|
plugins: [
|
|
'jsdoc',
|
|
'security',
|
|
'no-unsanitized',
|
|
],
|
|
env: {
|
|
browser: true,
|
|
jquery: true,
|
|
es6: true,
|
|
},
|
|
globals: {
|
|
toastr: 'readonly',
|
|
Fuse: 'readonly',
|
|
globalThis: 'readonly',
|
|
SillyTavern: 'readonly',
|
|
ePub: 'readonly',
|
|
pdfjsLib: 'readonly',
|
|
echarts: 'readonly',
|
|
},
|
|
parserOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'module',
|
|
},
|
|
rules: {
|
|
'no-eval': 'warn',
|
|
'no-implied-eval': 'warn',
|
|
'no-new-func': 'warn',
|
|
'no-script-url': 'warn',
|
|
'no-unsanitized/method': 'warn',
|
|
'no-unsanitized/property': 'warn',
|
|
'security/detect-object-injection': 'off',
|
|
'security/detect-non-literal-regexp': 'off',
|
|
'security/detect-unsafe-regex': 'off',
|
|
'no-restricted-syntax': [
|
|
'warn',
|
|
{
|
|
selector: 'CallExpression[callee.property.name="postMessage"][arguments.1.value="*"]',
|
|
message: 'Avoid postMessage(..., "*"); use a trusted origin or the shared iframe messaging helper.',
|
|
},
|
|
{
|
|
selector: 'CallExpression[callee.property.name="addEventListener"][arguments.0.value="message"]',
|
|
message: 'All message listeners must validate origin/source (use isTrustedMessage).',
|
|
},
|
|
],
|
|
'no-undef': 'error',
|
|
'no-unused-vars': ['warn', { args: 'none' }],
|
|
'eqeqeq': 'off',
|
|
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
'no-inner-declarations': 'off',
|
|
'no-constant-condition': ['error', { checkLoops: false }],
|
|
'no-useless-catch': 'off',
|
|
'no-control-regex': 'off',
|
|
'no-mixed-spaces-and-tabs': 'off',
|
|
'jsdoc/require-jsdoc': 'off',
|
|
'jsdoc/require-param': 'off',
|
|
'jsdoc/require-returns': 'off',
|
|
'jsdoc/require-param-description': 'off',
|
|
'jsdoc/require-returns-description': 'off',
|
|
'jsdoc/check-types': 'off',
|
|
'jsdoc/tag-lines': 'off',
|
|
},
|
|
};
|