Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit 8d55163

Browse files
authored
Merge pull request #217 from netlify/chore/comments-rules
Enable some comment-related ESLint rules
2 parents 151b228 + 968240f commit 8d55163

File tree

8 files changed

+30
-17
lines changed

8 files changed

+30
-17
lines changed

.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ module.exports = {
66
// TODO: enable those rules
77
complexity: 0,
88
'id-length': 0,
9-
'line-comment-position': 0,
109
'max-nested-callbacks': 0,
1110
'max-statements': 0,
1211
'no-await-in-loop': 0,
13-
'no-inline-comments': 0,
1412
'no-magic-numbers': 0,
1513
'no-param-reassign': 0,
1614
'no-shadow': 0,

src/deploy/hash-files.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ const hashFiles = async (dir, configPath, opts) => {
2020
const fileNormalizer = fileNormalizerCtor(opts)
2121

2222
// Written to by manifestCollector
23-
const files = {} // normalizedPath: hash (wanted by deploy API)
24-
const filesShaMap = {} // hash: [fileObj, fileObj, fileObj]
23+
// normalizedPath: hash (wanted by deploy API)
24+
const files = {}
25+
// hash: [fileObj, fileObj, fileObj]
26+
const filesShaMap = {}
2527
const manifestCollector = manifestCollectorCtor(files, filesShaMap, opts)
2628

2729
await pump(fileStream, filter, hasher, fileNormalizer, manifestCollector)

src/deploy/hash-fns.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ const hashFns = async (dir, opts) => {
3939
const hasher = hasherCtor(opts)
4040

4141
// Written to by manifestCollector
42-
const functions = {} // normalizedPath: hash (wanted by deploy API)
43-
const fnShaMap = {} // hash: [fileObj, fileObj, fileObj]
42+
// normalizedPath: hash (wanted by deploy API)
43+
const functions = {}
44+
// hash: [fileObj, fileObj, fileObj]
45+
const fnShaMap = {}
4446
const manifestCollector = manifestCollectorCtor(functions, fnShaMap, opts)
4547

4648
await pump(functionStream, hasher, manifestCollector)

src/deploy/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ const deploySite = async (api, siteId, dir, opts) => {
1515
fnDir: null,
1616
configPath: null,
1717
draft: false,
18-
message: undefined, // API calls this the 'title'
18+
// API calls this the 'title'
19+
message: undefined,
1920
tmpDir: tempy.directory(),
20-
deployTimeout: 1.2e6, // local deploy timeout: 20 mins
21-
concurrentHash: 100, // concurrent file hash calls
22-
concurrentUpload: 5, // Number of concurrent uploads
21+
// local deploy timeout: 20 mins
22+
deployTimeout: 1.2e6,
23+
// concurrent file hash calls
24+
concurrentHash: 100,
25+
// Number of concurrent uploads
26+
concurrentUpload: 5,
2327
filter: defaultFilter,
24-
syncFileLimit: 100, // number of files
25-
maxRetry: 5, // number of times to retry an upload
28+
// number of files
29+
syncFileLimit: 100,
30+
// number of times to retry an upload
31+
maxRetry: 5,
2632
statusCb: () => {
2733
/* default to noop */
2834
// statusObj: {

src/deploy/upload-files.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ const retryUpload = (uploadFn, maxRetry) =>
8181
.catch((error) => {
8282
lastError = error
8383
switch (true) {
84-
case error.status >= 400: // observed errors: 408, 401 (4** swallowed), 502
84+
// observed errors: 408, 401 (4** swallowed), 502
85+
case error.status >= 400:
8586
case error.name === 'FetchError': {
8687
return fibonacciBackoff.backoff()
8788
}

src/deploy/util.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const normalizePath = (relname) => {
3131

3232
// poll an async deployId until its done diffing
3333
const waitForDiff = async (api, deployId, siteId, timeout) => {
34-
let deploy // capture ready deploy during poll
34+
// capture ready deploy during poll
35+
let deploy
3536

3637
const loadDeploy = async () => {
3738
const d = await api.getSiteDeploy({ siteId, deployId })
@@ -68,7 +69,8 @@ const waitForDiff = async (api, deployId, siteId, timeout) => {
6869

6970
// Poll a deployId until its ready
7071
const waitForDeploy = async (api, deployId, siteId, timeout) => {
71-
let deploy // capture ready deploy during poll
72+
// capture ready deploy during poll
73+
let deploy
7274

7375
const loadDeploy = async () => {
7476
const d = await api.getSiteDeploy({ siteId, deployId })

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class NetlifyAPI {
6161

6262
const { id } = ticket
6363

64-
let authorizedTicket // ticket capture
64+
// ticket capture
65+
let authorizedTicket
6566
const checkTicket = async () => {
6667
const t = await this.showTicket({ ticketId: id })
6768
if (t.authorized) {

src/methods/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
const fetch = require('node-fetch').default || require('node-fetch') // Webpack will sometimes export default exports in different places
1+
// Webpack will sometimes export default exports in different places
2+
const fetch = require('node-fetch').default || require('node-fetch')
23

34
const { getOperations } = require('../operations')
45

0 commit comments

Comments
 (0)