Skip to content

Commit

Permalink
🐛 Use core.merge to merge config + overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAfroOfDoom committed Jul 13, 2024
1 parent 983a433 commit 81e4dbc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 45 deletions.
51 changes: 15 additions & 36 deletions __snapshots__/packages/core/test-out/service/Config.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions packages/core/src/service/Config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rfdc from 'rfdc'
import type { ExternalEventEmitter } from '../common/index.js'
import { Arrayable, bufferToString, TypePredicates } from '../common/index.js'
import { Arrayable, bufferToString, merge, TypePredicates } from '../common/index.js'
import { ErrorSeverity } from '../source/index.js'
import { FileCategories, RegistryCategories } from '../symbol/index.js'
import type { Project } from './Project.js'
Expand Down Expand Up @@ -493,13 +493,6 @@ export class ConfigService implements ExternalEventEmitter {
}

public static merge(base: Config, ...overrides: any[]): Config {
// FIXME
const ans = rfdc()(base)
for (const override of overrides) {
for (const key of ['env', 'format', 'lint', 'snippet'] as const) {
ans[key] = { ...ans[key], ...override[key] } as any
}
}
return ans
return overrides.reduce(merge, rfdc()(base))
}
}

0 comments on commit 81e4dbc

Please sign in to comment.