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 #212 from netlify/lint/array-callback-return
Browse files Browse the repository at this point in the history
Enable `array-callback-return` ESLint rule
  • Loading branch information
ehmicky authored Dec 10, 2020
2 parents e786d79 + 3d85263 commit b250cbd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = {
extends: '@netlify/eslint-config-node',
rules: {
// TODO: enable those rules
'array-callback-return': 0,
complexity: 0,
'consistent-this': 0,
'id-length': 0,
Expand Down
12 changes: 8 additions & 4 deletions src/deploy/hash-files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ test('hashes files in a folder', async (t) => {
filter: defaultFilter,
})
t.truthy(files['netlify.toml'], 'includes the netlify.toml file')
Object.keys(files).forEach((path) => t.truthy(path, 'each file has a path'))
Object.keys(files).forEach((path) => {
t.truthy(path, 'each file has a path')
})
t.truthy(filesShaMap, 'filesShaMap is returned')
Object.values(filesShaMap).forEach((fileObjArray) =>
fileObjArray.forEach((fileObj) => t.truthy(fileObj.normalizedPath, 'fileObj have a normalizedPath field')),
)
Object.values(filesShaMap).forEach((fileObjArray) => {
fileObjArray.forEach((fileObj) => {
t.truthy(fileObj.normalizedPath, 'fileObj have a normalizedPath field')
})
})
})
12 changes: 8 additions & 4 deletions src/deploy/hash-fns.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ const { defaultFilter } = require('./util')
test('hashes files in a folder', async (t) => {
const { functions, fnShaMap } = await hashFns(__dirname, { filter: defaultFilter, tmpDir: tempy.directory() })

Object.keys(functions).forEach((path) => t.truthy(path, 'each file has a path'))
Object.keys(functions).forEach((path) => {
t.truthy(path, 'each file has a path')
})
t.truthy(fnShaMap, 'fnShaMap is returned')
Object.values(fnShaMap).forEach((fileObjArray) =>
fileObjArray.forEach((fileObj) => t.truthy(fileObj.normalizedPath, 'fileObj have a normalizedPath field')),
)
Object.values(fnShaMap).forEach((fileObjArray) => {
fileObjArray.forEach((fileObj) => {
t.truthy(fileObj.normalizedPath, 'fileObj have a normalizedPath field')
})
})
})
4 changes: 3 additions & 1 deletion src/deploy/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@ test('pass empty name to defaultFilter', (t) => {
expect: true,
},
]
cases.forEach((c) => t.is(defaultFilter(c.input), c.expect))
cases.forEach((c) => {
t.is(defaultFilter(c.input), c.expect)
})
})

0 comments on commit b250cbd

Please sign in to comment.