Skip to content

Commit d320ce8

Browse files
author
Ben Callaghan
committed
feat(core): add lint config to generated projects
Add lint configuration to all new projects for user convenience.
1 parent 92afd05 commit d320ce8

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

packages/core/src/generators/utils/generate-project.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ describe('nx-dotnet project generator', () => {
9494
expect(config.targets.serve).toBeDefined();
9595
});
9696

97+
it('should include lint target', async () => {
98+
await GenerateProject(appTree, options, dotnetClient, 'application');
99+
const config = readProjectConfiguration(appTree, 'test');
100+
expect(config.targets.lint).toBeDefined();
101+
});
102+
103+
it('should include lint target in test project', async () => {
104+
options.testTemplate = 'nunit';
105+
await GenerateProject(appTree, options, dotnetClient, 'application');
106+
const config = readProjectConfiguration(appTree, 'test-test');
107+
expect(config.targets.lint).toBeDefined();
108+
});
109+
97110
/**
98111
* This test requires a live dotnet client.
99112
*/

packages/core/src/generators/utils/generate-project.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323

2424
import {
2525
GetBuildExecutorConfiguration,
26+
GetLintExecutorConfiguration,
2627
GetServeExecutorConfig,
2728
GetTestExecutorConfig,
2829
NxDotnetProjectGeneratorSchema,
@@ -97,6 +98,7 @@ async function GenerateTestProject(
9798
targets: {
9899
build: GetBuildExecutorConfiguration(testRoot),
99100
test: GetTestExecutorConfig(),
101+
lint: GetLintExecutorConfiguration(),
100102
},
101103
tags: schema.parsedTags,
102104
});
@@ -192,6 +194,7 @@ export async function GenerateProject(
192194
...(projectType === 'application'
193195
? { serve: GetServeExecutorConfig() }
194196
: {}),
197+
lint: GetLintExecutorConfiguration(),
195198
},
196199
tags: normalizedOptions.parsedTags,
197200
};

packages/core/src/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './build-executor-configuration';
22
export * from './project-generator-schema';
33
export * from './serve-executor-configuration';
44
export * from './test-executor-configuration';
5+
export * from './lint-executor-configuration';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { TargetConfiguration } from '@nrwl/devkit';
2+
3+
export function GetLintExecutorConfiguration(): TargetConfiguration {
4+
return {
5+
executor: '@nx-dotnet/core:format',
6+
};
7+
}

0 commit comments

Comments
 (0)