Skip to content

Commit

Permalink
fix: enhance resolution of generated configs
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Jan 8, 2025
1 parent d1e9a7a commit 5191e95
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { join } from "path"
import { resolve } from "path"
import { Options, optionsToNumber, numberToShortHash } from "./util.js"
import { Linter } from "eslint"

export async function getConfig(options: Options) {
const num = optionsToNumber(options)
const hash = numberToShortHash(num)
const configPath = join(process.cwd(), "dist", "configs", `${hash}.js`)

const __dirname = import.meta.dirname

// Make sure that we are in "dist" folder and not in "src".
const configPath = resolve(__dirname, "..", "dist", "configs", `${hash}.js`)

const module = (await import(configPath)) as { default: Linter.Config }
return module.default
Expand Down

0 comments on commit 5191e95

Please sign in to comment.