Three more wins on top of the previous pass:
- sortQueueJobs memoizes the result for static sort keys
(filename, host, size) — these don't change during upload, so
every 200ms progress render now reuses the same sorted array
instead of running an O(n log n) Collator compare.
- _computeQueueStats caches within a single tick via queueMicrotask.
updateStatusBar + updateStatsPanel are always called back-to-back
and now share one queue scan instead of running two.
- _updateRowInPlace writes DOM values only when they actually
changed. Idle/queued/done rows (the majority) incur zero DOM
mutations per progress tick.
84 lines
2.7 KiB
JavaScript
84 lines
2.7 KiB
JavaScript
import security from 'eslint-plugin-security';
|
|
|
|
export default [
|
|
{
|
|
files: ['**/*.js'],
|
|
ignores: ['node_modules/**', 'release/**', 'tests/**'],
|
|
plugins: { security },
|
|
languageOptions: {
|
|
ecmaVersion: 2022,
|
|
sourceType: 'commonjs',
|
|
globals: {
|
|
require: 'readonly',
|
|
module: 'readonly',
|
|
exports: 'readonly',
|
|
__dirname: 'readonly',
|
|
__filename: 'readonly',
|
|
process: 'readonly',
|
|
console: 'readonly',
|
|
setTimeout: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
setInterval: 'readonly',
|
|
clearInterval: 'readonly',
|
|
Buffer: 'readonly',
|
|
URL: 'readonly',
|
|
fetch: 'readonly',
|
|
AbortController: 'readonly',
|
|
navigator: 'readonly',
|
|
document: 'readonly',
|
|
window: 'readonly',
|
|
localStorage: 'readonly',
|
|
HTMLElement: 'readonly',
|
|
alert: 'readonly',
|
|
confirm: 'readonly',
|
|
requestAnimationFrame: 'readonly',
|
|
queueMicrotask: 'readonly',
|
|
Intl: 'readonly',
|
|
crypto: 'readonly',
|
|
URLSearchParams: 'readonly',
|
|
EventSource: 'readonly',
|
|
}
|
|
},
|
|
rules: {
|
|
// Security rules
|
|
// detect-object-injection disabled: 78 false positives from config lookups like obj[hosterName]
|
|
'security/detect-object-injection': 'off',
|
|
'security/detect-non-literal-regexp': 'warn',
|
|
'security/detect-unsafe-regex': 'warn',
|
|
'security/detect-buffer-noassert': 'warn',
|
|
'security/detect-eval-with-expression': 'error',
|
|
'security/detect-no-csrf-before-method-override': 'warn',
|
|
'security/detect-possible-timing-attacks': 'warn',
|
|
'security/detect-pseudoRandomBytes': 'warn',
|
|
// Code quality
|
|
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
'no-undef': 'error',
|
|
'no-constant-condition': 'warn',
|
|
'no-debugger': 'error',
|
|
'no-duplicate-case': 'error',
|
|
'no-empty': ['warn', { allowEmptyCatch: true }],
|
|
'no-ex-assign': 'error',
|
|
'no-extra-boolean-cast': 'warn',
|
|
'no-func-assign': 'error',
|
|
'no-inner-declarations': 'error',
|
|
'no-irregular-whitespace': 'error',
|
|
'no-unreachable': 'error',
|
|
'use-isnan': 'error',
|
|
'valid-typeof': 'error',
|
|
'eqeqeq': ['warn', 'always'],
|
|
'no-caller': 'error',
|
|
'no-eval': 'error',
|
|
'no-implied-eval': 'error',
|
|
'no-new-func': 'error',
|
|
'no-throw-literal': 'warn',
|
|
'no-self-assign': 'error',
|
|
'no-self-compare': 'error',
|
|
'no-loss-of-precision': 'error',
|
|
'no-dupe-keys': 'error',
|
|
'no-unsafe-finally': 'error',
|
|
'no-unmodified-loop-condition': 'warn',
|
|
'no-template-curly-in-string': 'warn',
|
|
}
|
|
}
|
|
];
|