mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-13 12:23:34 +01:00
Add eslint for server
This commit is contained in:
1 parent
186733f6af
commit
ad8b235058
3 files changed
+958
-16
No files matched your search
@@ -0,0 +1,59 @@
|
||||
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
|
||||
}
|
||||
]
|
||||
Generated
+896
-15
File diff suppressed because it is too large.
Load diff
+3
-1
@@ -19,7 +19,8 @@
|
||||
"docker-arm64-local": "docker buildx build --platform linux/arm64 --load . -t advplyr/audiobookshelf-arm64-local",
|
||||
"deploy-linux": "node deploy/linux",
|
||||
"test": "npm run build:server && mocha dist-server/test",
|
||||
"coverage": "npm run build:server && nyc mocha dist-server/test"
|
||||
"coverage": "npm run build:server && nyc mocha dist-server/test",
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"bin": "dist-server/index.js",
|
||||
"pkg": {
|
||||
@@ -63,6 +64,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.17.0",
|
||||
"chai": "^4.3.10",
|
||||
"eslint": "^10.11.0",
|
||||
"mocha": "^10.2.0",
|
||||
"nodemon": "^2.0.20",
|
||||
"nyc": "^15.1.0",
|
||||
|
||||
Reference in new issue
Block a user