UNPKG

@oxlint/migrate

Version:

Generates a `.oxlintrc.json` from a existing eslint flat config

22 lines (21 loc) 495 B
import { existsSync } from "fs"; import path from "node:path"; const FLAT_CONFIG_FILENAMES = [ "eslint.config.js", "eslint.config.mjs", "eslint.config.cjs", "eslint.config.ts", "eslint.config.mts", "eslint.config.cts" ]; const getAutodetectedEslintConfigName = (cwd) => { for (const filename of FLAT_CONFIG_FILENAMES) { const filePath = path.join(cwd, filename); if (existsSync(filePath)) { return filePath; } } }; export { getAutodetectedEslintConfigName };