Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use object spread #524

Merged
merged 2 commits into from Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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