Skip to content

Commit

Permalink
fix(linter): do not break migration if eslint file is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Aug 22, 2023
1 parent 231a998 commit f99b76e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/linter/src/generators/init/init-migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ export function migrateConfigToMonorepoStyle(
projects.forEach((project) => {
const lintTarget = findLintTarget(project);
if (lintTarget) {
const projectEslintPath = joinPathFragments(
project.root,
lintTarget.options.eslintConfig || findEslintFile(tree, project.root)
);
const eslintFile =
lintTarget.options.eslintConfig || findEslintFile(tree, project.root);
if (!eslintFile) {
return;
}
const projectEslintPath = joinPathFragments(project.root, eslintFile);
migrateEslintFile(projectEslintPath, tree);
}
});
Expand All @@ -38,9 +40,8 @@ export function migrateConfigToMonorepoStyle(
export function findLintTarget(
project: ProjectConfiguration
): TargetConfiguration {
return Object.entries(project.targets ?? {}).find(
([name, target]) =>
name === 'lint' ||
return Object.values(project.targets ?? {}).find(
(target) =>
target.executor === '@nx/linter:eslint' ||
target.executor === '@nrwl/linter:eslint'
)?.[1];
Expand Down

0 comments on commit f99b76e

Please sign in to comment.