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

Commit 5402768

Browse files
authored
Add id-length ESLint rule (#227)
1 parent 208382c commit 5402768

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = {
55
rules: {
66
// TODO: enable those rules
77
complexity: 0,
8-
'id-length': 0,
98
'max-nested-callbacks': 0,
109
'max-statements': 0,
1110
'no-await-in-loop': 0,

src/deploy/upload_files.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ const uploadFiles = async (api, deployId, uploadList, { concurrentUpload, status
4848
break
4949
}
5050
default: {
51-
const e = new Error('File Object missing assetType property')
52-
e.fileObj = fileObj
53-
throw e
51+
const error = new Error('File Object missing assetType property')
52+
error.fileObj = fileObj
53+
throw error
5454
}
5555
}
5656

src/deploy/util.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ const path = require('path')
33
const pWaitFor = require('p-wait-for')
44

55
// Default filter when scanning for files
6-
const defaultFilter = (filename) => {
7-
if (filename == null) return false
8-
const n = path.basename(filename)
6+
const defaultFilter = (filePath) => {
7+
if (filePath == null) return false
8+
const filename = path.basename(filePath)
99
switch (true) {
10-
case n === 'node_modules':
11-
case n.startsWith('.') && n !== '.well-known':
12-
case n.match(/(\/__MACOSX|\/\.)/):
10+
case filename === 'node_modules':
11+
case filename.startsWith('.') && filename !== '.well-known':
12+
case filename.match(/(\/__MACOSX|\/\.)/):
1313
return false
1414
default:
1515
return true
@@ -35,20 +35,20 @@ const waitForDiff = async (api, deployId, siteId, timeout) => {
3535
let deploy
3636

3737
const loadDeploy = async () => {
38-
const d = await api.getSiteDeploy({ siteId, deployId })
38+
const siteDeploy = await api.getSiteDeploy({ siteId, deployId })
3939

40-
switch (d.state) {
40+
switch (siteDeploy.state) {
4141
// https://github.com/netlify/bitballoon/blob/master/app/models/deploy.rb#L21-L33
4242
case 'error': {
4343
const deployError = new Error(`Deploy ${deployId} had an error`)
44-
deployError.deploy = d
44+
deployError.deploy = siteDeploy
4545
throw deployError
4646
}
4747
case 'prepared':
4848
case 'uploading':
4949
case 'uploaded':
5050
case 'ready': {
51-
deploy = d
51+
deploy = siteDeploy
5252
return true
5353
}
5454
case 'preparing':
@@ -73,16 +73,16 @@ const waitForDeploy = async (api, deployId, siteId, timeout) => {
7373
let deploy
7474

7575
const loadDeploy = async () => {
76-
const d = await api.getSiteDeploy({ siteId, deployId })
77-
switch (d.state) {
76+
const siteDeploy = await api.getSiteDeploy({ siteId, deployId })
77+
switch (siteDeploy.state) {
7878
// https://github.com/netlify/bitballoon/blob/master/app/models/deploy.rb#L21-L33
7979
case 'error': {
8080
const deployError = new Error(`Deploy ${deployId} had an error`)
81-
deployError.deploy = d
81+
deployError.deploy = siteDeploy
8282
throw deployError
8383
}
8484
case 'ready': {
85-
deploy = d
85+
deploy = siteDeploy
8686
return true
8787
}
8888
case 'preparing':

src/deploy/util.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('pass empty name to defaultFilter', (t) => {
4747
expect: true,
4848
},
4949
]
50-
cases.forEach((c) => {
51-
t.is(defaultFilter(c.input), c.expect)
50+
cases.forEach(({ input, expect }) => {
51+
t.is(defaultFilter(input), expect)
5252
})
5353
})

0 commit comments

Comments
 (0)