Skip to content

Commit

Permalink
Merge pull request #515 from zouguangxian/gx/package-with-absolute-path
Browse files Browse the repository at this point in the history
feat: require the package with fullname
  • Loading branch information
dbale-altoros authored Oct 27, 2023
2 parents f9804a8 + 7852c32 commit 1fd7947
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/config/config-file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require('fs')
const path = require('path')
const _ = require('lodash')
const { cosmiconfigSync } = require('cosmiconfig')
const { ConfigMissingError } = require('../common/errors')
Expand Down Expand Up @@ -64,8 +65,15 @@ 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 require(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 1fd7947

Please sign in to comment.