File tree Expand file tree Collapse file tree 20 files changed +121
-7
lines changed
packages/schematics/angular
tests/legacy-cli/e2e/tests/generate Expand file tree Collapse file tree 20 files changed +121
-7
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import {
29
29
import { InsertChange } from '../utility/change' ;
30
30
import { getWorkspace } from '../utility/config' ;
31
31
import { buildRelativePath , findModuleFromOptions } from '../utility/find-module' ;
32
+ import { applyLintFix } from '../utility/lint-fix' ;
32
33
import { parseName } from '../utility/parse-name' ;
33
34
import { buildDefaultPath } from '../utility/project' ;
34
35
import { validateHtmlSelector , validateName } from '../utility/validation' ;
@@ -164,6 +165,7 @@ export default function(options: ComponentOptions): Rule {
164
165
addDeclarationToNgModule ( options ) ,
165
166
mergeWith ( templateSource ) ,
166
167
] ) ) ,
168
+ options . lintFix ? applyLintFix ( options . path ) : noop ( ) ,
167
169
] ) ;
168
170
} ;
169
171
}
Original file line number Diff line number Diff line change @@ -71,4 +71,8 @@ export interface Schema {
71
71
* Specifies if the component is an entry component of declaring module.
72
72
*/
73
73
entryComponent ?: boolean ;
74
+ /**
75
+ * Specifies whether to apply lint fixes after generating the component.
76
+ */
77
+ lintFix ?: boolean ;
74
78
}
Original file line number Diff line number Diff line change 103
103
"type" : " boolean" ,
104
104
"default" : false ,
105
105
"description" : " Specifies if the component is an entry component of declaring module."
106
+ },
107
+ "lintFix" : {
108
+ "type" : " boolean" ,
109
+ "default" : false ,
110
+ "description" : " Specifies whether to apply lint fixes after generating the component."
106
111
}
107
112
},
108
113
"required" : [],
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { parseName } from '../utility/parse-name';
29
29
import { buildDefaultPath } from '../utility/project' ;
30
30
import { validateHtmlSelector } from '../utility/validation' ;
31
31
import { Schema as DirectiveOptions } from './schema' ;
32
+ import { applyLintFix } from "../utility/lint-fix" ;
32
33
33
34
34
35
function addDeclarationToNgModule ( options : DirectiveOptions ) : Rule {
@@ -137,6 +138,7 @@ export default function (options: DirectiveOptions): Rule {
137
138
addDeclarationToNgModule ( options ) ,
138
139
mergeWith ( templateSource ) ,
139
140
] ) ) ,
141
+ options . lintFix ? applyLintFix ( options . path ) : noop ( ) ,
140
142
] ) ;
141
143
} ;
142
144
}
Original file line number Diff line number Diff line change @@ -47,4 +47,8 @@ export interface Schema {
47
47
* Specifies if declaring module exports the directive.
48
48
*/
49
49
export ?: boolean ;
50
+ /**
51
+ * Specifies whether to apply lint fixes after generating the component.
52
+ */
53
+ lintFix ?: boolean ;
50
54
}
Original file line number Diff line number Diff line change 68
68
"type" : " boolean" ,
69
69
"default" : false ,
70
70
"description" : " Specifies if declaring module exports the directive."
71
+ },
72
+ "lintFix" : {
73
+ "type" : " boolean" ,
74
+ "default" : false ,
75
+ "description" : " Specifies whether to apply lint fixes after generating the directive."
71
76
}
72
77
},
73
78
"required" : [],
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import { getWorkspace } from '../utility/config';
24
24
import { parseName } from '../utility/parse-name' ;
25
25
import { buildDefaultPath } from '../utility/project' ;
26
26
import { Schema as GuardOptions } from './schema' ;
27
+ import { applyLintFix } from "../utility/lint-fix" ;
27
28
28
29
29
30
export default function ( options : GuardOptions ) : Rule {
@@ -55,6 +56,7 @@ export default function (options: GuardOptions): Rule {
55
56
branchAndMerge ( chain ( [
56
57
mergeWith ( templateSource ) ,
57
58
] ) ) ,
59
+ options . lintFix ? applyLintFix ( options . path ) : noop ( ) ,
58
60
] ) ;
59
61
} ;
60
62
}
Original file line number Diff line number Diff line change @@ -27,4 +27,8 @@ export interface Schema {
27
27
* The name of the project.
28
28
*/
29
29
project ?: string ;
30
+ /**
31
+ * Specifies whether to apply lint fixes after generating the component.
32
+ */
33
+ lintFix ?: boolean ;
30
34
}
Original file line number Diff line number Diff line change 34
34
"$default" : {
35
35
"$source" : " projectName"
36
36
}
37
+ },
38
+ "lintFix" : {
39
+ "type" : " boolean" ,
40
+ "default" : false ,
41
+ "description" : " Specifies whether to apply lint fixes after generating the guard."
37
42
}
38
43
},
39
44
"required" : [],
Original file line number Diff line number Diff line change @@ -15,10 +15,12 @@ import {
15
15
chain ,
16
16
mergeWith ,
17
17
move ,
18
+ noop ,
18
19
template ,
19
20
url ,
20
21
} from '@angular-devkit/schematics' ;
21
22
import { getWorkspace } from '../utility/config' ;
23
+ import { applyLintFix } from '../utility/lint-fix' ;
22
24
import { parseName } from '../utility/parse-name' ;
23
25
import { buildDefaultPath } from '../utility/project' ;
24
26
import { Schema as InterfaceOptions } from './schema' ;
@@ -55,6 +57,7 @@ export default function (options: InterfaceOptions): Rule {
55
57
branchAndMerge ( chain ( [
56
58
mergeWith ( templateSource ) ,
57
59
] ) ) ,
60
+ options . lintFix ? applyLintFix ( options . path ) : noop ( ) ,
58
61
] ) ;
59
62
} ;
60
63
}
You can’t perform that action at this time.
0 commit comments