Skip to content

Commit

Permalink
refactor(plugin-eslint): projects to config single project
Browse files Browse the repository at this point in the history
Signed-off-by: Vojtech Masek <[email protected]>
  • Loading branch information
vmasek committed May 22, 2024
1 parent 7181bda commit 0e4f110
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 4 additions & 6 deletions packages/plugin-eslint/src/lib/nx.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,10 @@ describe('Nx helpers', () => {
async project => {
const targets = await eslintConfigFromNxProject(project);

expect(targets).toEqual([
{
eslintrc: `./packages/${project}/.eslintrc.json`,
patterns: expect.arrayContaining([`packages/${project}/**/*.ts`]),
},
]);
expect(targets).toEqual({
eslintrc: `./packages/${project}/.eslintrc.json`,
patterns: expect.arrayContaining([`packages/${project}/**/*.ts`]),
});
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ export async function eslintConfigFromNxProject(
const { createProjectGraphAsync } = await import('@nx/devkit');
const projectGraph = await createProjectGraphAsync({ exitOnError: false });

const [project] = nxProjectsToConfig(
const [project] = await nxProjectsToConfig(
projectGraph,
project => !!project.name && project.name === projectName,
({ name }) => !!name && name === projectName,
);

if (!project) {
throw new Error(`Couldn't find Nx project named "${projectName}"`);
}

return project;
}

0 comments on commit 0e4f110

Please sign in to comment.