forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@angular/cli): add option to use lint to adjust generated files
- Loading branch information
1 parent
5cf395c
commit a3bf529
Showing
11 changed files
with
137 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { ng } from '../../utils/process'; | ||
import { writeFile } from '../../utils/fs'; | ||
import { expectToFail } from '../../utils/utils'; | ||
|
||
export default function () { | ||
const nestedConfigContent = ` | ||
{ | ||
"rules": { | ||
"quotemark": [ | ||
true, | ||
"double", | ||
"avoid-escape" | ||
] | ||
} | ||
}`; | ||
|
||
return Promise.resolve() | ||
// setup a double-quote tslint config | ||
.then(() => writeFile('src/app/tslint.json', nestedConfigContent)) | ||
|
||
// Generate a fixed new component but don't fix rest of app | ||
.then(() => ng('generate', 'component', 'test-component1', '--lint-fix')) | ||
.then(() => expectToFail(() => ng('lint'))) | ||
|
||
// Fix rest of app and generate new component | ||
.then(() => ng('lint', '--fix')) | ||
.then(() => ng('generate', 'component', 'test-component2', '--lint-fix')) | ||
.then(() => ng('lint')) | ||
|
||
// Enable default option and generate all other module related blueprints | ||
.then(() => ng('set', 'defaults.lintFix', 'true')) | ||
.then(() => ng('generate', 'directive', 'test-directive')) | ||
.then(() => ng('generate', 'service', 'test-service', '--module', 'app.module.ts')) | ||
.then(() => ng('generate', 'pipe', 'test-pipe')) | ||
.then(() => ng('generate', 'guard', 'test-guard', '--module', 'app.module.ts')) | ||
.then(() => ng('lint')); | ||
} |