Skip to content

Commit

Permalink
fix: simplify implementation, add comment as requested and remove "on…
Browse files Browse the repository at this point in the history
…ly" from "it.only"

Fixes lint-staged#570
  • Loading branch information
silbinarywolf committed Jan 25, 2019
1 parent 04aa58f commit ec66acd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/runAll.js
Expand Up @@ -54,21 +54,24 @@ module.exports = function runAll(config) {
return `No staged files match ${task.pattern}`
}
return false
},
hasStagedFiles: () => task.fileList.length > 0
}
}))

const listrBaseOptions = {
dateFormat: false,
renderer
}

let hasStagedTaskFiles = false
// If all of the configured "linters" should be skipped
// avoid executing any "stashing changes..." logic
let isSkippingAllLinters = true
tasks.forEach(task => {
hasStagedTaskFiles = hasStagedTaskFiles || task.hasStagedFiles()
if (!task.skip()) {
isSkippingAllLinters = false
}
})

if (hasStagedTaskFiles) {
if (!isSkippingAllLinters) {
// Do not terminate main Listr process on SIGINT
process.on('SIGINT', () => {})

Expand Down
2 changes: 1 addition & 1 deletion test/runAll.spec.js
Expand Up @@ -162,7 +162,7 @@ describe('runAll', () => {
}
})

it.only('should skip stashing changes if no lint-staged files are changed', async () => {
it('should skip stashing changes if no lint-staged files are changed', async () => {
expect.assertions(4)
hasPartiallyStagedFiles.mockImplementationOnce(() => Promise.resolve(true))
sgfMock.mockImplementationOnce((params, callback) => {
Expand Down

0 comments on commit ec66acd

Please sign in to comment.