Skip to content

Commit bedba5a

Browse files
nadavkanerokonet
authored andcommitted
refactor: Use object spread (#524)
Closes #508
1 parent 225a904 commit bedba5a

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/getConfig.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,13 @@ const optRmMsg = (opt, helpMsg) => ` Option ${chalk.bold(opt)} was removed.
121121
*/
122122
function validateConfig(config) {
123123
debug('Validating config')
124-
const exampleConfig = Object.assign({}, defaultConfig, {
124+
const exampleConfig = {
125+
...defaultConfig,
125126
linters: {
126127
'*.js': ['eslint --fix', 'git add'],
127128
'*.css': 'stylelint'
128129
}
129-
})
130+
}
130131

131132
const deprecatedConfig = {
132133
gitDir: () => optRmMsg('gitDir', "lint-staged now automatically resolves '.git' directory."),

src/resolveTaskFn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function execLinter(bin, args, execaOptions, pathsToLint) {
2929
debug('args: %O', binArgs)
3030
debug('opts: %o', execaOptions)
3131

32-
return execa(bin, binArgs, Object.assign({}, execaOptions))
32+
return execa(bin, binArgs, { ...execaOptions })
3333
}
3434

3535
const successMsg = linter => `${symbols.success} ${linter} passed!`

test/generateTasks.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('generateTasks', () => {
8989
it('should not match non-children files', () => {
9090
const relPath = path.join(process.cwd(), '..')
9191
resolveGitDir.mockReturnValueOnce(relPath)
92-
const result = generateTasks(Object.assign({}, config), files)
92+
const result = generateTasks({ ...config }, files)
9393
const linter = result.find(item => item.pattern === '*.js')
9494
expect(linter).toEqual({
9595
pattern: '*.js',

0 commit comments

Comments
 (0)