fix(server): lint errors on main.ts; fix(server): lint script not linting
This commit is contained in:
parent
8d9f79e662
commit
a9fe54eb72
@ -20,8 +20,11 @@ M_B ?= $(call FixPath, ./node_modules/.bin/)
|
|||||||
lint:
|
lint:
|
||||||
$(M_B)eslint "./{src, tests}/**" --fix
|
$(M_B)eslint "./{src, tests}/**" --fix
|
||||||
|
|
||||||
|
lint-build:
|
||||||
|
$(M_B)eslint "./src/**" --fix
|
||||||
|
|
||||||
test:
|
test:
|
||||||
$(M_B)jest
|
$(M_B)jest
|
||||||
|
|
||||||
build: lint test
|
build: lint-build test
|
||||||
$(M_B)tsc
|
$(M_B)tsc
|
||||||
|
@ -1,55 +1,55 @@
|
|||||||
{
|
{
|
||||||
"name": "deemix-gui",
|
"name": "deemix-gui",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start-old": "node bin/www",
|
"start": "nodemon src/app.ts",
|
||||||
"start": "nodemon src/app.ts",
|
"start-build": "node dist/app.js",
|
||||||
"start-build": "node dist/app.js",
|
"lint": "eslint \"./{src, tests}/**\" --fix",
|
||||||
"lint": "eslint . --fix",
|
"lint-build": "eslint \"./src/**\" --fix",
|
||||||
"prebuild": "yarn lint",
|
"prebuild": "yarn lint-build",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test-watch": "jest --watch"
|
"test-watch": "jest --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cookie-parser": "1.4.5",
|
"cookie-parser": "1.4.5",
|
||||||
"debug": "2.6.9",
|
"debug": "2.6.9",
|
||||||
"deemix": "^0.1.3",
|
"deemix": "^0.1.3",
|
||||||
"deezer-js": "^1.0.0",
|
"deezer-js": "^1.0.0",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
"express-session": "^1.17.1",
|
"express-session": "^1.17.1",
|
||||||
"morgan": "1.10.0",
|
"morgan": "1.10.0",
|
||||||
"ramda": "0.27.1",
|
"ramda": "0.27.1",
|
||||||
"uuid": "8.3.2",
|
"uuid": "8.3.2",
|
||||||
"ws": "7.4.5"
|
"ws": "7.4.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxtjs/eslint-config": "6.0.0",
|
"@nuxtjs/eslint-config": "6.0.0",
|
||||||
"@types/cookie-parser": "1.4.2",
|
"@types/cookie-parser": "1.4.2",
|
||||||
"@types/debug": "4.1.5",
|
"@types/debug": "4.1.5",
|
||||||
"@types/express": "4.17.11",
|
"@types/express": "4.17.11",
|
||||||
"@types/express-session": "^1.17.3",
|
"@types/express-session": "^1.17.3",
|
||||||
"@types/jest": "26.0.22",
|
"@types/jest": "26.0.22",
|
||||||
"@types/morgan": "1.9.2",
|
"@types/morgan": "1.9.2",
|
||||||
"@types/node": "14.14.37",
|
"@types/node": "14.14.37",
|
||||||
"@types/ramda": "0.27.40",
|
"@types/ramda": "0.27.40",
|
||||||
"@types/supertest": "2.0.11",
|
"@types/supertest": "2.0.11",
|
||||||
"@types/uuid": "8.3.0",
|
"@types/uuid": "8.3.0",
|
||||||
"@types/ws": "7.4.1",
|
"@types/ws": "7.4.1",
|
||||||
"@typescript-eslint/eslint-plugin": "4.21.0",
|
"@typescript-eslint/eslint-plugin": "4.21.0",
|
||||||
"@typescript-eslint/parser": "4.21.0",
|
"@typescript-eslint/parser": "4.21.0",
|
||||||
"eslint": "7.23.0",
|
"eslint": "7.23.0",
|
||||||
"eslint-config-prettier": "8.1.0",
|
"eslint-config-prettier": "8.1.0",
|
||||||
"eslint-plugin-prettier": "3.3.1",
|
"eslint-plugin-prettier": "3.3.1",
|
||||||
"jest": "26.6.3",
|
"jest": "26.6.3",
|
||||||
"nodemon": "2.0.7",
|
"nodemon": "2.0.7",
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
"supertest": "6.1.3",
|
"supertest": "6.1.3",
|
||||||
"ts-jest": "26.5.4",
|
"ts-jest": "26.5.4",
|
||||||
"ts-node": "9.1.1",
|
"ts-node": "9.1.1",
|
||||||
"ts-node-dev": "1.1.6",
|
"ts-node-dev": "1.1.6",
|
||||||
"typescript": "4.2.4"
|
"typescript": "4.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import deemix from 'deemix'
|
|||||||
import WebSocket from 'ws'
|
import WebSocket from 'ws'
|
||||||
import { wss } from './app'
|
import { wss } from './app'
|
||||||
import { Settings } from './types'
|
import { Settings } from './types'
|
||||||
import { AlreadyInQueue, NotLoggedIn } from './helpers/errors'
|
import { NotLoggedIn } from './helpers/errors'
|
||||||
|
|
||||||
const Downloader = deemix.downloader.Downloader
|
const Downloader = deemix.downloader.Downloader
|
||||||
const { Single, Collection, Convertable } = deemix.types.downloadObjects
|
const { Single, Collection, Convertable } = deemix.types.downloadObjects
|
||||||
@ -19,6 +19,7 @@ export const getAccessToken = deemix.utils.deezer.getAccessToken
|
|||||||
export const getArlFromAccessToken = deemix.utils.deezer.getArlFromAccessToken
|
export const getArlFromAccessToken = deemix.utils.deezer.getArlFromAccessToken
|
||||||
|
|
||||||
export const plugins: any = {
|
export const plugins: any = {
|
||||||
|
// eslint-disable-next-line new-cap
|
||||||
spotify: new deemix.plugins.spotify()
|
spotify: new deemix.plugins.spotify()
|
||||||
}
|
}
|
||||||
plugins.spotify.setup()
|
plugins.spotify.setup()
|
||||||
@ -102,7 +103,7 @@ export async function addToQueue(dz: any, url: string[], bitrate: number) {
|
|||||||
|
|
||||||
slimmedObjects.push(downloadObj.getSlimmedDict())
|
slimmedObjects.push(downloadObj.getSlimmedDict())
|
||||||
})
|
})
|
||||||
const isSingleObject = downloadObjs.length == 1
|
const isSingleObject = downloadObjs.length === 1
|
||||||
if (isSingleObject) listener.send('addedToQueue', downloadObjs[0].getSlimmedDict())
|
if (isSingleObject) listener.send('addedToQueue', downloadObjs[0].getSlimmedDict())
|
||||||
else listener.send('addedToQueue', slimmedObjects)
|
else listener.send('addedToQueue', slimmedObjects)
|
||||||
|
|
||||||
@ -178,6 +179,7 @@ export function cancelDownload(uuid: string) {
|
|||||||
queueOrder.splice(queueOrder.indexOf(uuid), 1)
|
queueOrder.splice(queueOrder.indexOf(uuid), 1)
|
||||||
fs.writeFileSync(configFolder + `queue${sep}order.json`, JSON.stringify(queueOrder))
|
fs.writeFileSync(configFolder + `queue${sep}order.json`, JSON.stringify(queueOrder))
|
||||||
// break
|
// break
|
||||||
|
// eslint-disable-next-line no-fallthrough
|
||||||
default:
|
default:
|
||||||
// This gets called even in the 'inQueue' case. Is this the expected behaviour? If no, de-comment the break
|
// This gets called even in the 'inQueue' case. Is this the expected behaviour? If no, de-comment the break
|
||||||
listener.send('removedFromQueue', uuid)
|
listener.send('removedFromQueue', uuid)
|
||||||
@ -192,7 +194,7 @@ export function cancelAllDownloads() {
|
|||||||
queueOrder = []
|
queueOrder = []
|
||||||
let currentItem: string | null = null
|
let currentItem: string | null = null
|
||||||
Object.values(queue).forEach((downloadObject: any) => {
|
Object.values(queue).forEach((downloadObject: any) => {
|
||||||
if (downloadObject.status == 'downloading') {
|
if (downloadObject.status === 'downloading') {
|
||||||
currentJob.downloadObject.isCanceled = true
|
currentJob.downloadObject.isCanceled = true
|
||||||
listener.send('cancellingCurrentItem', downloadObject.uuid)
|
listener.send('cancellingCurrentItem', downloadObject.uuid)
|
||||||
currentItem = downloadObject.uuid
|
currentItem = downloadObject.uuid
|
||||||
@ -218,7 +220,7 @@ export function restoreQueueFromDisk() {
|
|||||||
if (!fs.existsSync(configFolder + 'queue')) fs.mkdirSync(configFolder + 'queue')
|
if (!fs.existsSync(configFolder + 'queue')) fs.mkdirSync(configFolder + 'queue')
|
||||||
const allItems: string[] = fs.readdirSync(configFolder + 'queue')
|
const allItems: string[] = fs.readdirSync(configFolder + 'queue')
|
||||||
allItems.forEach((filename: string) => {
|
allItems.forEach((filename: string) => {
|
||||||
if (filename == 'order.json') {
|
if (filename === 'order.json') {
|
||||||
queueOrder = JSON.parse(fs.readFileSync(configFolder + `queue${sep}order.json`).toString())
|
queueOrder = JSON.parse(fs.readFileSync(configFolder + `queue${sep}order.json`).toString())
|
||||||
} else {
|
} else {
|
||||||
const currentItem: any = JSON.parse(fs.readFileSync(configFolder + `queue${sep}${filename}`).toString())
|
const currentItem: any = JSON.parse(fs.readFileSync(configFolder + `queue${sep}${filename}`).toString())
|
||||||
|
Loading…
Reference in New Issue
Block a user