Eslint: configure for standard-typescript (backend), and separate configurations depending on folders.

This commit is contained in:
John Livingston
2021-04-07 17:20:28 +02:00
parent 8b11c10e32
commit 3dd8718744
7 changed files with 524 additions and 36 deletions

44
server/.eslintrc.json Normal file
View File

@ -0,0 +1,44 @@
{
"root": true,
"env": {
"browser": false,
"es6": true
},
"extends": [
"standard-with-typescript"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"BUILD": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"project": [
"./server/tsconfig.json"
]
},
"plugins": [
"@typescript-eslint"
],
"ignorePatterns": [],
"rules": {
"@typescript-eslint/no-unused-vars": [2, {"argsIgnorePattern": "^_"}],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/return-await": [2, "in-try-catch"], // FIXME: correct?
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/triple-slash-reference": "off",
"max-len": [
"error",
{
"code": 120,
"comments": 120
}
],
"no-unused-vars": "off"
}
}

View File

@ -3,26 +3,21 @@ import type { NextFunction, Request, Response } from 'express'
const path = require('path')
const fs = require('fs').promises
type RegisterServerOptions = {
registerHook: any,
registerSetting: any,
settingsManager: any,
storageManager: any,
videoCategoryManager: any,
videoLicenceManager: any,
videoLanguageManager: any,
getRouter: any,
interface RegisterServerOptions {
registerHook: any
registerSetting: any
settingsManager: any
storageManager: any
videoCategoryManager: any
videoLicenceManager: any
videoLanguageManager: any
getRouter: any
peertubeHelpers: any
}
async function register ({
registerHook,
registerSetting,
settingsManager,
storageManager,
videoCategoryManager,
videoLicenceManager,
videoLanguageManager,
getRouter,
peertubeHelpers
}: RegisterServerOptions): Promise<any> {
@ -197,7 +192,7 @@ async function register ({
throw new Error('Video not found')
}
let page = '' + converseJSIndex
let page = '' + (converseJSIndex as string)
// FIXME: Peertube should provide the static folder path. For now:
const staticRelative = '../static'
page = page.replace(/{{BASE_STATIC_URL}}/g, staticRelative)
@ -216,7 +211,7 @@ async function register ({
})
}
async function unregister () {
async function unregister (): Promise<any> {
}
module.exports = {