Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jan 23, 2022
1 parent a729fc0 commit f367d0f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/config/normalize/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ import {
// eslint-disable-next-line import/max-dependencies
import { normalizeConfigPath, normalizeConfigGlob } from './path.js'

const METADATA_COMMANDS = new Set(['show', 'remove'])

const config = {
async default() {
return await getDefaultConfig()
Expand Down Expand Up @@ -190,14 +188,18 @@ const showDiff = {
}

const showMetadata = {
default({ command }) {
return METADATA_COMMANDS.has(command)
},
default: true,
normalize(value, { name }) {
checkBoolean(value, name)
},
}

// `showMetadata` configuration property specific logic for the `run` command
const showMetadataRun = {
...showMetadata,
default: false,
}

const showPrecision = {
default: false,
normalize(value, { name }) {
Expand Down Expand Up @@ -299,7 +301,7 @@ export const COMMANDS_PROPS = {
save,
select,
showDiff,
showMetadata,
showMetadata: showMetadataRun,
showPrecision,
showSystem,
showTitles,
Expand Down

0 comments on commit f367d0f

Please sign in to comment.