]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Use single quotes in server/ and update eslint rules
authorFlorent <florent.git@zeteo.me>
Sat, 6 Aug 2022 13:20:43 +0000 (15:20 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Mon, 8 Aug 2022 06:25:36 +0000 (08:25 +0200)
.eslintrc.json
server/lib/activitypub/activity.ts
server/middlewares/validators/config.ts
server/tests/api/moderation/abuses.ts
server/tests/feeds/feeds.ts
server/tools/peertube-import-videos.ts

index c2dd2fc446c9c7483d6b26af20dc40af2e711c4b..770913bf103e6ead70beca46f52267cf179a9c16 100644 (file)
@@ -38,6 +38,7 @@
         }
       }
     ],
+    "quotes": "off",
     "@typescript-eslint/indent": [
       "error",
       2,
     "@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",
index ba2967ce97f68f6717f1ff31f1d525be288b7cb0..1f6ec221e58d0324a623f75adf916058f73fa285 100644 (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
index 1e839d577f39e27bbb377b2602fda8836edab903..a44fcb854d7c12c3011da40b0d7b20f7fd2b06f2 100644 (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'),
index 568fbefcf06e88c5b608218e0b9ffd0b81c8dfb3..0a656b41f3767d495d371fb2eff386103b56bc5c 100644 (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")
       }
index c7331d544a8874723ec19802cca0b01a64b50147..67a9ed8e0e0b6990fea0653d0e2e95b382e85130 100644 (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 })
index 661a4cf35c1d1f6f78d9cd2acbbb34de8a73d859..e2f80c703c4bbd0962f97e78f420cac3219f459d 100644 (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)
       }