Skip to content

Commit

Permalink
feat(core): add lint config to generated projects
Browse files Browse the repository at this point in the history
Add lint configuration to all new projects for user convenience.
  • Loading branch information
Ben Callaghan committed May 19, 2021
1 parent 92afd05 commit d320ce8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/core/src/generators/utils/generate-project.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ describe('nx-dotnet project generator', () => {
expect(config.targets.serve).toBeDefined();
});

it('should include lint target', async () => {
await GenerateProject(appTree, options, dotnetClient, 'application');
const config = readProjectConfiguration(appTree, 'test');
expect(config.targets.lint).toBeDefined();
});

it('should include lint target in test project', async () => {
options.testTemplate = 'nunit';
await GenerateProject(appTree, options, dotnetClient, 'application');
const config = readProjectConfiguration(appTree, 'test-test');
expect(config.targets.lint).toBeDefined();
});

/**
* This test requires a live dotnet client.
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/generators/utils/generate-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {

import {
GetBuildExecutorConfiguration,
GetLintExecutorConfiguration,
GetServeExecutorConfig,
GetTestExecutorConfig,
NxDotnetProjectGeneratorSchema,
Expand Down Expand Up @@ -97,6 +98,7 @@ async function GenerateTestProject(
targets: {
build: GetBuildExecutorConfiguration(testRoot),
test: GetTestExecutorConfig(),
lint: GetLintExecutorConfiguration(),
},
tags: schema.parsedTags,
});
Expand Down Expand Up @@ -192,6 +194,7 @@ export async function GenerateProject(
...(projectType === 'application'
? { serve: GetServeExecutorConfig() }
: {}),
lint: GetLintExecutorConfiguration(),
},
tags: normalizedOptions.parsedTags,
};
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './build-executor-configuration';
export * from './project-generator-schema';
export * from './serve-executor-configuration';
export * from './test-executor-configuration';
export * from './lint-executor-configuration';
7 changes: 7 additions & 0 deletions packages/core/src/models/lint-executor-configuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { TargetConfiguration } from '@nrwl/devkit';

export function GetLintExecutorConfiguration(): TargetConfiguration {
return {
executor: '@nx-dotnet/core:format',
};
}

0 comments on commit d320ce8

Please sign in to comment.