Skip to content

Commit

Permalink
fix(linter): handle eslint flat config path correctly in lint executor
Browse files Browse the repository at this point in the history
  • Loading branch information
leosvelperez committed Jun 26, 2024
1 parent 3a2e8d4 commit 0e6d960
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/eslint/src/executors/lint/lint.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { joinPathFragments, type ExecutorContext } from '@nx/devkit';
import type { ESLint } from 'eslint';
import { mkdirSync, writeFileSync } from 'fs';
import { interpolate } from 'nx/src/tasks-runner/utils';
import { dirname, posix, resolve } from 'path';
import { dirname, posix, relative, resolve } from 'path';
import { findFlatConfigFile, findOldConfigFile } from '../../utils/config-file';
import type { Schema } from './schema';
import { resolveAndInstantiateESLint } from './utility/eslint-utils';
Expand Down Expand Up @@ -45,10 +45,7 @@ export default async function run(
// the flat config would be resolved starting from the cwd, which we changed to the workspace root
// so we explicitly set the config path to the flat config file path we previously found
if (hasFlatConfig && !normalizedOptions.eslintConfig) {
normalizedOptions.eslintConfig = posix.relative(
systemRoot,
flatConfigFilePath
);
normalizedOptions.eslintConfig = relative(systemRoot, flatConfigFilePath);
}

/**
Expand Down

0 comments on commit 0e6d960

Please sign in to comment.