Skip to content

Commit

Permalink
refactor: replace "object-inspect" with built-in util
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj committed Aug 11, 2023
1 parent 977c15d commit aa65846
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions lib/messages.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { inspect } from 'node:util'

import chalk from 'chalk'
import inspect from 'object-inspect'

import { error, info, warning } from './figures.js'

export const configurationError = (opt, helpMsg, value) =>
`${chalk.redBright(`${error} Validation Error:`)}
Invalid value for '${chalk.bold(opt)}': ${chalk.bold(
inspect(value, { inlineCharacterLimit: Number.POSITIVE_INFINITY })
)}
Invalid value for '${chalk.bold(opt)}': ${chalk.bold(inspect(value))}
${helpMsg}`

Expand Down
5 changes: 3 additions & 2 deletions lib/validateConfig.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** @typedef {import('./index').Logger} Logger */

import { inspect } from 'node:util'

import debug from 'debug'
import inspect from 'object-inspect'

import { configurationError } from './messages.js'
import { ConfigEmptyError, ConfigFormatError } from './symbols.js'
Expand Down Expand Up @@ -109,7 +110,7 @@ See https://github.com/okonet/lint-staged#configuration.`)
}

debugLog('Validated config from `%s`:', configPath)
debugLog(inspect(config, { indent: 2 }))
debugLog(inspect(config, { compact: false }))

return validatedConfig
}
2 changes: 1 addition & 1 deletion package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"lilconfig": "2.1.0",
"listr2": "6.6.1",
"micromatch": "4.0.5",
"object-inspect": "1.12.3",
"pidtree": "0.6.0",
"string-argv": "0.3.2",
"yaml": "2.3.1"
Expand Down

0 comments on commit aa65846

Please sign in to comment.