fix(linter): handle eslint flat config path correctly in lint executor (#26687)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #26424 Fixes #26586 Fixes #26532
This commit is contained in:
parent
6528da3bd8
commit
7ba49ffc41
@ -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';
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user