Skip to content

Commit 3705469

Browse files
authored
fix(core): make eslint optional dependency (#608)
1 parent 483086b commit 3705469

File tree

6 files changed

+35
-22
lines changed

6 files changed

+35
-22
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/" # Location of package manifests
8+
- package-ecosystem: 'npm' # See documentation for possible values
9+
directory: '/' # Location of package manifests
1010
schedule:
11-
interval: "daily"
11+
interval: 'daily'

.github/workflows/combine-prs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
}
9090
core.setOutput('base-branch', base_branch);
9191
core.setOutput('prs-string', prs.join('\n'));
92-
92+
9393
combined = branches.join(' ')
9494
console.log('Combined: ' + combined);
9595
return combined
@@ -107,14 +107,14 @@ jobs:
107107
echo "$BRANCHES_TO_COMBINE"
108108
sourcebranches="${BRANCHES_TO_COMBINE%\"}"
109109
sourcebranches="${sourcebranches#\"}"
110-
110+
111111
basebranch="${BASE_BRANCH%\"}"
112112
basebranch="${basebranch#\"}"
113-
113+
114114
git config pull.rebase false
115115
git config user.name github-actions
116116
git config user.email github-actions@github.com
117-
117+
118118
git branch $COMBINE_BRANCH_NAME $basebranch
119119
git checkout $COMBINE_BRANCH_NAME
120120
git pull origin $sourcebranches --no-edit

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# NxDotnet
66

77
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
8+
89
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)
10+
911
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1012

1113
[![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)

packages/core/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
"peerDependencies": {
1212
"@nrwl/devkit": ">14.0.0-beta.1",
1313
"@nrwl/workspace": ">14.0.0-beta.1",
14-
"nx": ">14.0.0-beta.1"
14+
"nx": ">14.0.0-beta.1",
15+
"eslint": ">8.0.0"
16+
},
17+
"peerDependenciesMeta": {
18+
"eslint": {
19+
"optional": true
20+
}
1521
},
1622
"devDependencies": {
1723
"@nrwl/cli": "*"

packages/core/src/tasks/check-module-boundaries.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
Workspaces,
77
} from '@nrwl/devkit';
88

9-
import { ESLint } from 'eslint';
109
import { relative } from 'path';
1110

1211
import {
@@ -74,16 +73,22 @@ export async function loadModuleBoundaries(
7473
): Promise<ModuleBoundaries> {
7574
const configured = readConfig(host).moduleBoundaries;
7675
if (!configured) {
77-
const result = await new ESLint()
78-
.calculateConfigForFile(`${root}/non-existant.ts`)
79-
.catch(() =>
80-
Promise.resolve({
81-
rules: { '@nrwl/nx/enforce-module-boundaries': [] },
82-
}),
83-
);
84-
const [, moduleBoundaryConfig] =
85-
result.rules['@nrwl/nx/enforce-module-boundaries'] || [];
86-
return moduleBoundaryConfig?.depConstraints ?? [];
76+
try {
77+
// eslint-disable-next-line @typescript-eslint/no-var-requires
78+
const { ESLint }: typeof import('eslint') = require('eslint');
79+
const result = await new ESLint()
80+
.calculateConfigForFile(`${root}/non-existant.ts`)
81+
.catch(() =>
82+
Promise.resolve({
83+
rules: { '@nrwl/nx/enforce-module-boundaries': [] },
84+
}),
85+
);
86+
const [, moduleBoundaryConfig] =
87+
result.rules['@nrwl/nx/enforce-module-boundaries'] || [];
88+
return moduleBoundaryConfig?.depConstraints ?? [];
89+
} catch {
90+
return [];
91+
}
8792
} else {
8893
return configured;
8994
}

packages/dotnet/src/lib/models/dotnet-add-package/dotnet-add-package-flags.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export type dotnetAddPackageFlags =
66
| 'noRestore'
77
| 'source';
88

9-
export const addPackageKeyMap: Partial<
10-
{ [key in dotnetAddPackageFlags]: string }
11-
> = {
9+
export const addPackageKeyMap: Partial<{
10+
[key in dotnetAddPackageFlags]: string;
11+
}> = {
1212
packageDirectory: 'package-directory',
1313
noRestore: 'no-restore',
1414
};

0 commit comments

Comments
 (0)