mirror of
https://github.com/hanzoai/lint-staged.git
synced 2026-10-30 19:37:36 +00:00
16 lines
387 B
JavaScript
16 lines
387 B
JavaScript
import { createRequire } from 'node:module'
|
|
|
|
/**
|
|
* require() does not exist for ESM, so we must create it to use require.resolve().
|
|
* @see https://nodejs.org/api/module.html#modulecreaterequirefilename
|
|
*/
|
|
const require = createRequire(import.meta.url)
|
|
|
|
export function resolveConfig(configPath) {
|
|
try {
|
|
return require.resolve(configPath)
|
|
} catch {
|
|
return configPath
|
|
}
|
|
}
|