Skip to content

Commit

Permalink
refactor: use object spread
Browse files Browse the repository at this point in the history
  • Loading branch information
nadavkaner committed Oct 29, 2018
1 parent af99172 commit 4536ba5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/getConfig.js
Expand Up @@ -121,12 +121,13 @@ const optRmMsg = (opt, helpMsg) => ` Option ${chalk.bold(opt)} was removed.
*/
function validateConfig(config) {
debug('Validating config')
const exampleConfig = Object.assign({}, defaultConfig, {
const exampleConfig = {
...defaultConfig,
linters: {
'*.js': ['eslint --fix', 'git add'],
'*.css': 'stylelint'
}
})
}

const deprecatedConfig = {
gitDir: () => optRmMsg('gitDir', "lint-staged now automatically resolves '.git' directory."),
Expand Down
2 changes: 1 addition & 1 deletion src/resolveTaskFn.js
Expand Up @@ -29,7 +29,7 @@ function execLinter(bin, args, execaOptions, pathsToLint) {
debug('args: %O', binArgs)
debug('opts: %o', execaOptions)

return execa(bin, binArgs, Object.assign({}, execaOptions))
return execa(bin, binArgs, { ...execaOptions })
}

const successMsg = linter => `${symbols.success} ${linter} passed!`
Expand Down
2 changes: 1 addition & 1 deletion test/generateTasks.spec.js
Expand Up @@ -89,7 +89,7 @@ describe('generateTasks', () => {
it('should not match non-children files', () => {
const relPath = path.join(process.cwd(), '..')
resolveGitDir.mockReturnValueOnce(relPath)
const result = generateTasks(Object.assign({}, config), files)
const result = generateTasks({ ...config }, files)
const linter = result.find(item => item.pattern === '*.js')
expect(linter).toEqual({
pattern: '*.js',
Expand Down

0 comments on commit 4536ba5

Please sign in to comment.