diff --git a/packages/plugin-eslint/src/lib/eslint-plugin.ts b/packages/plugin-eslint/src/lib/eslint-plugin.ts index b1757665f..70a7fa679 100644 --- a/packages/plugin-eslint/src/lib/eslint-plugin.ts +++ b/packages/plugin-eslint/src/lib/eslint-plugin.ts @@ -1,4 +1,4 @@ -import { writeFile } from 'fs/promises'; +import { mkdir, writeFile } from 'fs/promises'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; import { PluginConfig } from '@code-pushup/models'; @@ -39,6 +39,7 @@ export async function eslintPlugin( // save inline config to file so runner can access it later if (typeof eslintrc !== 'string') { + await mkdir(dirname(ESLINTRC_PATH), { recursive: true }); await writeFile(ESLINTRC_PATH, JSON.stringify(eslintrc)); } const eslintrcPath = typeof eslintrc === 'string' ? eslintrc : ESLINTRC_PATH; diff --git a/packages/plugin-eslint/src/lib/runner.integration.test.ts b/packages/plugin-eslint/src/lib/runner.integration.test.ts index 6d925e6a4..7d461c8bc 100644 --- a/packages/plugin-eslint/src/lib/runner.integration.test.ts +++ b/packages/plugin-eslint/src/lib/runner.integration.test.ts @@ -1,5 +1,5 @@ import { ESLint } from 'eslint'; -import { rm, writeFile } from 'fs/promises'; +import { mkdir, rm, writeFile } from 'fs/promises'; import os from 'os'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; @@ -48,6 +48,7 @@ describe('executeRunner', () => { const config: ESLint.ConfigData = { extends: '@code-pushup', }; + await mkdir(dirname(ESLINTRC_PATH), { recursive: true }); await writeFile(ESLINTRC_PATH, JSON.stringify(config)); });