Files
LittleWhiteBox/.eslintrc.cjs

69 lines
2.2 KiB
JavaScript
Raw Normal View History

2026-01-17 16:34:39 +08:00
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',
2026-01-26 01:16:35 +08:00
echarts: 'readonly',
2026-01-17 16:34:39 +08:00
},
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',
},
};