Skip to content

Commit

Permalink
fix(core): make eslint optional dependency (#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder authored Jan 31, 2023
1 parent 483086b commit 3705469
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "daily"
interval: 'daily'
8 changes: 4 additions & 4 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
}
core.setOutput('base-branch', base_branch);
core.setOutput('prs-string', prs.join('\n'));
combined = branches.join(' ')
console.log('Combined: ' + combined);
return combined
Expand All @@ -107,14 +107,14 @@ jobs:
echo "$BRANCHES_TO_COMBINE"
sourcebranches="${BRANCHES_TO_COMBINE%\"}"
sourcebranches="${sourcebranches#\"}"
basebranch="${BASE_BRANCH%\"}"
basebranch="${basebranch#\"}"
git config pull.rebase false
git config user.name github-actions
git config user.email github-actions@github.com
git branch $COMBINE_BRANCH_NAME $basebranch
git checkout $COMBINE_BRANCH_NAME
git pull origin $sourcebranches --no-edit
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# NxDotnet

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

[![Join the chat at https://gitter.im/nx-dotnet-plugin/community](https://badges.gitter.im/nx-dotnet-plugin/community.svg)](https://gitter.im/nx-dotnet-plugin/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Run CI checks](https://github.com/nx-dotnet/nx-dotnet/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/nx-dotnet/nx-dotnet/actions/workflows/main.yml)
Expand Down
8 changes: 7 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@
"peerDependencies": {
"@nrwl/devkit": ">14.0.0-beta.1",
"@nrwl/workspace": ">14.0.0-beta.1",
"nx": ">14.0.0-beta.1"
"nx": ">14.0.0-beta.1",
"eslint": ">8.0.0"
},
"peerDependenciesMeta": {
"eslint": {
"optional": true
}
},
"devDependencies": {
"@nrwl/cli": "*"
Expand Down
27 changes: 16 additions & 11 deletions packages/core/src/tasks/check-module-boundaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
Workspaces,
} from '@nrwl/devkit';

import { ESLint } from 'eslint';
import { relative } from 'path';

import {
Expand Down Expand Up @@ -74,16 +73,22 @@ export async function loadModuleBoundaries(
): Promise<ModuleBoundaries> {
const configured = readConfig(host).moduleBoundaries;
if (!configured) {
const result = await new ESLint()
.calculateConfigForFile(`${root}/non-existant.ts`)
.catch(() =>
Promise.resolve({
rules: { '@nrwl/nx/enforce-module-boundaries': [] },
}),
);
const [, moduleBoundaryConfig] =
result.rules['@nrwl/nx/enforce-module-boundaries'] || [];
return moduleBoundaryConfig?.depConstraints ?? [];
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { ESLint }: typeof import('eslint') = require('eslint');
const result = await new ESLint()
.calculateConfigForFile(`${root}/non-existant.ts`)
.catch(() =>
Promise.resolve({
rules: { '@nrwl/nx/enforce-module-boundaries': [] },
}),
);
const [, moduleBoundaryConfig] =
result.rules['@nrwl/nx/enforce-module-boundaries'] || [];
return moduleBoundaryConfig?.depConstraints ?? [];
} catch {
return [];
}
} else {
return configured;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export type dotnetAddPackageFlags =
| 'noRestore'
| 'source';

export const addPackageKeyMap: Partial<
{ [key in dotnetAddPackageFlags]: string }
> = {
export const addPackageKeyMap: Partial<{
[key in dotnetAddPackageFlags]: string;
}> = {
packageDirectory: 'package-directory',
noRestore: 'no-restore',
};

0 comments on commit 3705469

Please sign in to comment.