UNPKG

prettier-eslint-cli

Version:
15 lines (14 loc) 629 B
import { logger } from "./logger.js"; let formatPromise; async function loadFormat() { formatPromise ??= import('prettier-eslint') .catch(async () => { logger.info('We detected that no `prettier-eslint` is installed.'); logger.info('We will use our internal fallback one instead.'); logger.info('You can install `prettier-eslint` as dependency to skip this message.'); return import('@prettier/eslint'); }) .then((module) => 'default' in module ? module.default : module); return formatPromise; } export const format = async (options) => (await loadFormat())(options);