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

Commit

Permalink
Merge pull request #217 from netlify/chore/comments-rules
Browse files Browse the repository at this point in the history
Enable some comment-related ESLint rules
  • Loading branch information
ehmicky authored Dec 10, 2020
2 parents 151b228 + 968240f commit 8d55163
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ module.exports = {
// TODO: enable those rules
complexity: 0,
'id-length': 0,
'line-comment-position': 0,
'max-nested-callbacks': 0,
'max-statements': 0,
'no-await-in-loop': 0,
'no-inline-comments': 0,
'no-magic-numbers': 0,
'no-param-reassign': 0,
'no-shadow': 0,
Expand Down
6 changes: 4 additions & 2 deletions src/deploy/hash-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ const hashFiles = async (dir, configPath, opts) => {
const fileNormalizer = fileNormalizerCtor(opts)

// Written to by manifestCollector
const files = {} // normalizedPath: hash (wanted by deploy API)
const filesShaMap = {} // hash: [fileObj, fileObj, fileObj]
// normalizedPath: hash (wanted by deploy API)
const files = {}
// hash: [fileObj, fileObj, fileObj]
const filesShaMap = {}
const manifestCollector = manifestCollectorCtor(files, filesShaMap, opts)

await pump(fileStream, filter, hasher, fileNormalizer, manifestCollector)
Expand Down
6 changes: 4 additions & 2 deletions src/deploy/hash-fns.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const hashFns = async (dir, opts) => {
const hasher = hasherCtor(opts)

// Written to by manifestCollector
const functions = {} // normalizedPath: hash (wanted by deploy API)
const fnShaMap = {} // hash: [fileObj, fileObj, fileObj]
// normalizedPath: hash (wanted by deploy API)
const functions = {}
// hash: [fileObj, fileObj, fileObj]
const fnShaMap = {}
const manifestCollector = manifestCollectorCtor(functions, fnShaMap, opts)

await pump(functionStream, hasher, manifestCollector)
Expand Down
18 changes: 12 additions & 6 deletions src/deploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ const deploySite = async (api, siteId, dir, opts) => {
fnDir: null,
configPath: null,
draft: false,
message: undefined, // API calls this the 'title'
// API calls this the 'title'
message: undefined,
tmpDir: tempy.directory(),
deployTimeout: 1.2e6, // local deploy timeout: 20 mins
concurrentHash: 100, // concurrent file hash calls
concurrentUpload: 5, // Number of concurrent uploads
// local deploy timeout: 20 mins
deployTimeout: 1.2e6,
// concurrent file hash calls
concurrentHash: 100,
// Number of concurrent uploads
concurrentUpload: 5,
filter: defaultFilter,
syncFileLimit: 100, // number of files
maxRetry: 5, // number of times to retry an upload
// number of files
syncFileLimit: 100,
// number of times to retry an upload
maxRetry: 5,
statusCb: () => {
/* default to noop */
// statusObj: {
Expand Down
3 changes: 2 additions & 1 deletion src/deploy/upload-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ const retryUpload = (uploadFn, maxRetry) =>
.catch((error) => {
lastError = error
switch (true) {
case error.status >= 400: // observed errors: 408, 401 (4** swallowed), 502
// observed errors: 408, 401 (4** swallowed), 502
case error.status >= 400:
case error.name === 'FetchError': {
return fibonacciBackoff.backoff()
}
Expand Down
6 changes: 4 additions & 2 deletions src/deploy/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const normalizePath = (relname) => {

// poll an async deployId until its done diffing
const waitForDiff = async (api, deployId, siteId, timeout) => {
let deploy // capture ready deploy during poll
// capture ready deploy during poll
let deploy

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

// Poll a deployId until its ready
const waitForDeploy = async (api, deployId, siteId, timeout) => {
let deploy // capture ready deploy during poll
// capture ready deploy during poll
let deploy

const loadDeploy = async () => {
const d = await api.getSiteDeploy({ siteId, deployId })
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class NetlifyAPI {

const { id } = ticket

let authorizedTicket // ticket capture
// ticket capture
let authorizedTicket
const checkTicket = async () => {
const t = await this.showTicket({ ticketId: id })
if (t.authorized) {
Expand Down
3 changes: 2 additions & 1 deletion src/methods/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fetch = require('node-fetch').default || require('node-fetch') // Webpack will sometimes export default exports in different places
// Webpack will sometimes export default exports in different places
const fetch = require('node-fetch').default || require('node-fetch')

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

Expand Down

0 comments on commit 8d55163

Please sign in to comment.