mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-13 12:23:34 +01:00
60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
const nodeGlobals = {
|
|
AbortController: 'readonly',
|
|
Buffer: 'readonly',
|
|
TextDecoder: 'readonly',
|
|
URL: 'readonly',
|
|
URLSearchParams: 'readonly',
|
|
__dirname: 'readonly',
|
|
clearInterval: 'readonly',
|
|
clearTimeout: 'readonly',
|
|
console: 'readonly',
|
|
process: 'readonly',
|
|
setInterval: 'readonly',
|
|
setTimeout: 'readonly',
|
|
structuredClone: 'readonly'
|
|
}
|
|
|
|
const mochaGlobals = {
|
|
after: 'readonly',
|
|
afterEach: 'readonly',
|
|
before: 'readonly',
|
|
beforeEach: 'readonly',
|
|
describe: 'readonly',
|
|
it: 'readonly'
|
|
}
|
|
|
|
const rules = {
|
|
'no-undef': 'error',
|
|
'no-redeclare': 'error',
|
|
'no-dupe-keys': 'error',
|
|
'no-dupe-class-members': 'error',
|
|
'no-global-assign': 'error'
|
|
}
|
|
|
|
export default [
|
|
{
|
|
ignores: ['**/node_modules/**', 'client/**', 'dist/**', 'dist-server/**', 'coverage/**', 'server/libs/**']
|
|
},
|
|
{
|
|
files: ['index.js', 'prod.js', 'dev.js', 'server/**/*.js'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'commonjs',
|
|
globals: nodeGlobals
|
|
},
|
|
rules
|
|
},
|
|
{
|
|
files: ['test/**/*.js'],
|
|
languageOptions: {
|
|
ecmaVersion: 'latest',
|
|
sourceType: 'commonjs',
|
|
globals: {
|
|
...nodeGlobals,
|
|
...mochaGlobals
|
|
}
|
|
},
|
|
rules
|
|
}
|
|
]
|