Use single quotes in server/ and update eslint rules

This commit is contained in:
Florent 2022-08-06 15:20:43 +02:00 committed by Chocobozzz
parent 2c9c6e653e
commit 7e0f50d6e0
6 changed files with 25 additions and 17 deletions

View File

@ -38,6 +38,7 @@
}
}
],
"quotes": "off",
"@typescript-eslint/indent": [
"error",
2,
@ -78,7 +79,14 @@
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/method-signature-style": "off",
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/quotes": "off",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/promise-function-async": "off",

View File

@ -1,4 +1,4 @@
import { ActivityType } from "@shared/models"
import { ActivityType } from '@shared/models'
function getAPId (object: string | { id: string }) {
if (typeof object === 'string') return object

View File

@ -30,7 +30,7 @@ const customConfigUpdateValidator = [
body('signup.enabled').isBoolean().withMessage('Should have a valid signup enabled boolean'),
body('signup.limit').isInt().withMessage('Should have a valid signup limit'),
body('signup.requiresEmailVerification').isBoolean().withMessage('Should have a valid requiresEmailVerification boolean'),
body('signup.minimumAge').isInt().withMessage("Should have a valid minimum age required"),
body('signup.minimumAge').isInt().withMessage('Should have a valid minimum age required'),
body('admin.email').isEmail().withMessage('Should have a valid administrator email'),
body('contactForm.enabled').isBoolean().withMessage('Should have a valid contact form enabled boolean'),
@ -38,7 +38,7 @@ const customConfigUpdateValidator = [
body('user.videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid video quota'),
body('user.videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily video quota'),
body('videoChannels.maxPerUser').isInt().withMessage("Should have a valid maximum amount of video channels per user"),
body('videoChannels.maxPerUser').isInt().withMessage('Should have a valid maximum amount of video channels per user'),
body('transcoding.enabled').isBoolean().withMessage('Should have a valid transcoding enabled boolean'),
body('transcoding.allowAdditionalExtensions').isBoolean().withMessage('Should have a valid additional extensions boolean'),

View File

@ -260,12 +260,12 @@ describe('Test abuses', function () {
await waitJobs(servers)
const body = await commands[1].getAdminList()
expect(body.total).to.equal(2, "wrong number of videos returned")
expect(body.data).to.have.lengthOf(2, "wrong number of videos returned")
expect(body.total).to.equal(2, 'wrong number of videos returned')
expect(body.data).to.have.lengthOf(2, 'wrong number of videos returned')
const abuse = body.data[0]
expect(abuse.id).to.equal(abuseServer2.id, "wrong origin server id for first video")
expect(abuse.video.id).to.equal(abuseServer2.video.id, "wrong video id")
expect(abuse.id).to.equal(abuseServer2.id, 'wrong origin server id for first video')
expect(abuse.video.id).to.equal(abuseServer2.video.id, 'wrong video id')
expect(abuse.video.channel).to.exist
expect(abuse.video.deleted).to.be.true
})
@ -299,13 +299,13 @@ describe('Test abuses', function () {
const abuseVideo3 = body.data.find(a => a.video.id === video3Id)
expect(abuseVideo3).to.not.be.undefined
expect(abuseVideo3.video.countReports).to.equal(1, "wrong reports count for video 3")
expect(abuseVideo3.video.nthReport).to.equal(1, "wrong report position in report list for video 3")
expect(abuseVideo3.countReportsForReportee).to.equal(1, "wrong reports count for reporter on video 3 abuse")
expect(abuseVideo3.countReportsForReporter).to.equal(3, "wrong reports count for reportee on video 3 abuse")
expect(abuseVideo3.video.countReports).to.equal(1, 'wrong reports count for video 3')
expect(abuseVideo3.video.nthReport).to.equal(1, 'wrong report position in report list for video 3')
expect(abuseVideo3.countReportsForReportee).to.equal(1, 'wrong reports count for reporter on video 3 abuse')
expect(abuseVideo3.countReportsForReporter).to.equal(3, 'wrong reports count for reportee on video 3 abuse')
const abuseServer1 = abuses.find(a => a.video.id === servers[0].store.videoCreated.id)
expect(abuseServer1.countReportsForReportee).to.equal(3, "wrong reports count for reporter on video 1 abuse")
expect(abuseServer1.countReportsForReportee).to.equal(3, 'wrong reports count for reporter on video 1 abuse')
}
})
@ -327,7 +327,7 @@ describe('Test abuses', function () {
{
const abuse = body.data.find(a => a.id === createRes.abuse.id)
expect(abuse.reason).to.equals(reason5)
expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, "predefined reasons do not match the one reported")
expect(abuse.predefinedReasons).to.deep.equals(predefinedReasons5, 'predefined reasons do not match the one reported')
expect(abuse.video.startAt).to.equal(1, "starting timestamp doesn't match the one reported")
expect(abuse.video.endAt).to.equal(5, "ending timestamp doesn't match the one reported")
}

View File

@ -433,7 +433,7 @@ describe('Test syndication feeds', () => {
{
const body = await servers[0].subscriptions.listVideos({ token: userAccessToken })
expect(body.total).to.equal(2, "there should be 2 videos part of the subscription")
expect(body.total).to.equal(2, 'there should be 2 videos part of the subscription')
const query = { accountId: userAccountId, token: userFeedToken }
const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })

View File

@ -37,7 +37,7 @@ command
.option('--last <last>', 'Process last n elements of returned playlist')
.option('--wait-interval <waitInterval>', 'Duration between two video imports (in seconds)', convertIntoMs)
.option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname)
.usage("[global options] [ -- youtube-dl options]")
.usage('[global options] [ -- youtube-dl options]')
.parse(process.argv)
const options = command.opts()
@ -97,7 +97,7 @@ async function run (url: string, username: string, password: string) {
for (const [ index, info ] of infoArray.entries()) {
try {
if (index > 0 && options.waitInterval && !skipInterval) {
log.info("Wait for %d seconds before continuing.", options.waitInterval / 1000)
log.info('Wait for %d seconds before continuing.', options.waitInterval / 1000)
await wait(options.waitInterval)
}