Skip to content

Commit

Permalink
feat: support require the package with fullname
Browse files Browse the repository at this point in the history
supports require.resolve(package) in extends field
  • Loading branch information
zouguangxian committed Oct 24, 2023
1 parent 5e881bd commit b780ac1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/config/config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ const loadConfig = (configFile) => {
return searchedFor.config || createEmptyConfig()
}

const configGetter = (path) =>
path.startsWith('solhint:') ? getSolhintCoreConfig(path) : require(`solhint-config-${path}`)
const isAbsolute = path.isAbsolute
const configGetter = (path) => {
if (isAbsolute(path)) {
return path
}
return path.startsWith('solhint:') ? getSolhintCoreConfig(path) : require(`solhint-config-${path}`)
}

const applyExtends = (config, getter = configGetter) => {
if (!config.extends) {
Expand Down

0 comments on commit b780ac1

Please sign in to comment.