Skip to content

Commit

Permalink
chore: code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 23, 2023
1 parent 226a89c commit f5fd341
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/commands/schema/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ export class SchemaGenerator {
// eslint-disable-next-line unicorn/no-array-reduce
const hookFiles = Object.values(this.base.config.pjson.oclif?.hooks ?? {}).reduce(
(x: string[], y: string | string[]) => (Array.isArray(y) ? [...x, ...y] : [...x, y]),
[] as string[],
[],
)
const {outDir, rootDir} = this.getDirs()
return (hookFiles as string[]).map((h) => `${path.resolve(h)}.ts`.replace(outDir, rootDir))
return hookFiles.map((h) => `${path.resolve(h)}.ts`.replace(outDir, rootDir))
}

private getDirs(): {outDir: string; rootDir: string} {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/snapshot/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default class Compare extends SnapshotCommand {

public async run(): Promise<CompareResponse> {
const {flags} = await this.parse(Compare)
const oldCommands = JSON.parse(fs.readFileSync(flags.filepath).toString('utf8')) as SnapshotEntry[]
const oldCommands = JSON.parse(fs.readFileSync(flags.filepath, 'utf8')) as SnapshotEntry[]
const newCommands = this.changed
return this.compareSnapshot(oldCommands, newCommands)
}
Expand Down

0 comments on commit f5fd341

Please sign in to comment.