File tree Expand file tree Collapse file tree 15 files changed +95
-77
lines changed
tools/angular/transformers
ngtools/webpack/src/transformers Expand file tree Collapse file tree 15 files changed +95
-77
lines changed Original file line number Diff line number Diff line change 100
100
],
101
101
102
102
/* TODO: evaluate usage of these rules and fix issues as needed */
103
- "no-case-declarations" : " off" ,
104
103
"@typescript-eslint/ban-types" : " off" ,
105
104
"@typescript-eslint/no-implied-eval" : " off" ,
106
105
"@typescript-eslint/no-var-requires" : " off" ,
124
123
"rules" : {
125
124
"import/no-extraneous-dependencies" : [" error" , { "devDependencies" : true }],
126
125
"max-lines-per-function" : " off" ,
126
+ "no-case-declarations" : " off" ,
127
127
"no-console" : " off"
128
128
}
129
129
}
Original file line number Diff line number Diff line change @@ -153,13 +153,16 @@ async function createSerializer(
153
153
case Format . LegacyMigrate :
154
154
return new LegacyMessageIdMigrationSerializer ( diagnostics ) ;
155
155
case Format . Arb :
156
- const fileSystem = {
157
- relative ( from : string , to : string ) : string {
158
- return path . relative ( from , to ) ;
159
- } ,
160
- } ;
161
-
162
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
163
- return new ArbTranslationSerializer ( sourceLocale , basePath as any , fileSystem as any ) ;
156
+ return new ArbTranslationSerializer (
157
+ sourceLocale ,
158
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
+ basePath as any ,
160
+ {
161
+ relative ( from : string , to : string ) : string {
162
+ return path . relative ( from , to ) ;
163
+ } ,
164
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
165
+ } as any ,
166
+ ) ;
164
167
}
165
168
}
Original file line number Diff line number Diff line change @@ -145,9 +145,8 @@ export function elideImports(
145
145
let symbol : ts . Symbol | undefined ;
146
146
switch ( node . kind ) {
147
147
case ts . SyntaxKind . Identifier :
148
- const parent = node . parent ;
149
- if ( parent && ts . isShorthandPropertyAssignment ( parent ) ) {
150
- const shorthandSymbol = typeChecker . getShorthandAssignmentValueSymbol ( parent ) ;
148
+ if ( node . parent && ts . isShorthandPropertyAssignment ( node . parent ) ) {
149
+ const shorthandSymbol = typeChecker . getShorthandAssignmentValueSymbol ( node . parent ) ;
151
150
if ( shorthandSymbol ) {
152
151
symbol = shorthandSymbol ;
153
152
}
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ function visitComponentMetadata(
210
210
211
211
return node ;
212
212
213
- case 'styleUrls' :
213
+ case 'styleUrls' : {
214
214
if ( ! ts . isArrayLiteralExpression ( node . initializer ) ) {
215
215
return node ;
216
216
}
@@ -234,6 +234,7 @@ function visitComponentMetadata(
234
234
235
235
// The external styles will be added afterwards in combination with any inline styles
236
236
return undefined ;
237
+ }
237
238
default :
238
239
// All other elements are passed through
239
240
return node ;
Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ export class InlineFontsProcessor {
145
145
}
146
146
break ;
147
147
148
- case 'link' :
148
+ case 'link' : {
149
149
const hrefAttr =
150
150
attrs . some ( ( { name, value } ) => name === 'rel' && value === 'stylesheet' ) &&
151
151
attrs . find ( ( { name, value } ) => name === 'href' && hrefsContent . has ( value ) ) ;
@@ -157,7 +157,7 @@ export class InlineFontsProcessor {
157
157
rewriter . emitStartTag ( tag ) ;
158
158
}
159
159
break ;
160
-
160
+ }
161
161
default :
162
162
rewriter . emitStartTag ( tag ) ;
163
163
Original file line number Diff line number Diff line change @@ -193,27 +193,25 @@ export abstract class SchematicsCommandModule
193
193
continue ;
194
194
}
195
195
196
- const choices = definition . items ?. map ( ( item ) => {
197
- return typeof item == 'string'
198
- ? {
199
- name : item ,
200
- value : item ,
201
- }
202
- : {
203
- name : item . label ,
204
- value : item . value ,
205
- } ;
206
- } ) ;
207
-
208
196
answers [ definition . id ] = await (
209
197
definition . multiselect ? prompts . checkbox : prompts . select
210
198
) ( {
211
199
message : definition . message ,
212
200
default : definition . default ,
213
- choices,
201
+ choices : definition . items ?. map ( ( item ) =>
202
+ typeof item == 'string'
203
+ ? {
204
+ name : item ,
205
+ value : item ,
206
+ }
207
+ : {
208
+ name : item . label ,
209
+ value : item . value ,
210
+ } ,
211
+ ) ,
214
212
} ) ;
215
213
break ;
216
- case 'input' :
214
+ case 'input' : {
217
215
let finalValue : JsonValue | undefined ;
218
216
answers [ definition . id ] = await prompts . input ( {
219
217
message : definition . message ,
@@ -258,6 +256,7 @@ export abstract class SchematicsCommandModule
258
256
answers [ definition . id ] = finalValue ;
259
257
}
260
258
break ;
259
+ }
261
260
}
262
261
}
263
262
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ import { logging } from '@angular-devkit/core';
10
10
import { NodeWorkflow } from '@angular-devkit/schematics/tools' ;
11
11
import { colors } from '../../utilities/color' ;
12
12
13
+ function removeLeadingSlash ( value : string ) : string {
14
+ return value [ 0 ] === '/' ? value . slice ( 1 ) : value ;
15
+ }
16
+
13
17
export function subscribeToWorkflow (
14
18
workflow : NodeWorkflow ,
15
19
logger : logging . LoggerApi ,
@@ -24,13 +28,14 @@ export function subscribeToWorkflow(
24
28
25
29
const reporterSubscription = workflow . reporter . subscribe ( ( event ) => {
26
30
// Strip leading slash to prevent confusion.
27
- const eventPath = event . path . charAt ( 0 ) === '/' ? event . path . substring ( 1 ) : event . path ;
31
+ const eventPath = removeLeadingSlash ( event . path ) ;
28
32
29
33
switch ( event . kind ) {
30
34
case 'error' :
31
35
error = true ;
32
- const desc = event . description == 'alreadyExist' ? 'already exists' : 'does not exist' ;
33
- logger . error ( `ERROR! ${ eventPath } ${ desc } .` ) ;
36
+ logger . error (
37
+ `ERROR! ${ eventPath } ${ event . description == 'alreadyExist' ? 'already exists' : 'does not exist' } .` ,
38
+ ) ;
34
39
break ;
35
40
case 'update' :
36
41
logs . push ( `${ colors . cyan ( 'UPDATE' ) } ${ eventPath } (${ event . content . length } bytes)` ) ;
@@ -45,8 +50,7 @@ export function subscribeToWorkflow(
45
50
files . add ( eventPath ) ;
46
51
break ;
47
52
case 'rename' :
48
- const eventToPath = event . to . charAt ( 0 ) === '/' ? event . to . substring ( 1 ) : event . to ;
49
- logs . push ( `${ colors . blue ( 'RENAME' ) } ${ eventPath } => ${ eventToPath } ` ) ;
53
+ logs . push ( `${ colors . blue ( 'RENAME' ) } ${ eventPath } => ${ removeLeadingSlash ( event . to ) } ` ) ;
50
54
files . add ( eventPath ) ;
51
55
break ;
52
56
}
Original file line number Diff line number Diff line change @@ -168,13 +168,16 @@ async function createSerializer(
168
168
case Format . LegacyMigrate :
169
169
return new LegacyMessageIdMigrationSerializer ( diagnostics ) ;
170
170
case Format . Arb :
171
- const fileSystem = {
172
- relative ( from : string , to : string ) : string {
173
- return path . relative ( from , to ) ;
174
- } ,
175
- } ;
176
-
177
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
178
- return new ArbTranslationSerializer ( sourceLocale , basePath as any , fileSystem as any ) ;
171
+ return new ArbTranslationSerializer (
172
+ sourceLocale ,
173
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
174
+ basePath as any ,
175
+ {
176
+ relative ( from : string , to : string ) : string {
177
+ return path . relative ( from , to ) ;
178
+ } ,
179
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
180
+ } as any ,
181
+ ) ;
179
182
}
180
183
}
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ function parseProject(
191
191
for ( const [ name , value ] of Object . entries < JsonValue > ( projectNodeValue ) ) {
192
192
switch ( name ) {
193
193
case 'targets' :
194
- case 'architect' :
194
+ case 'architect' : {
195
195
const nodes = findNodeAtLocation ( projectNode , [ name ] ) ;
196
196
if ( ! isJsonObject ( value ) || ! nodes ) {
197
197
context . error ( `Invalid "${ name } " field found; expected an object.` , value ) ;
@@ -201,6 +201,7 @@ function parseProject(
201
201
targets = parseTargetsObject ( projectName , nodes , context ) ;
202
202
jsonMetadata . hasLegacyTargetsName = name === 'architect' ;
203
203
break ;
204
+ }
204
205
case 'prefix' :
205
206
case 'root' :
206
207
case 'sourceRoot' :
Original file line number Diff line number Diff line change @@ -132,16 +132,18 @@ function normalizeValue(
132
132
switch ( type ) {
133
133
case 'project' :
134
134
return convertJsonProject ( value as ProjectDefinition ) ;
135
- case 'projectcollection' :
135
+ case 'projectcollection' : {
136
136
const projects = convertJsonProjectCollection ( value as Iterable < [ string , ProjectDefinition ] > ) ;
137
137
138
138
return isEmpty ( projects ) ? undefined : projects ;
139
+ }
139
140
case 'target' :
140
141
return convertJsonTarget ( value as TargetDefinition ) ;
141
- case 'targetcollection' :
142
+ case 'targetcollection' : {
142
143
const targets = convertJsonTargetCollection ( value as Iterable < [ string , TargetDefinition ] > ) ;
143
144
144
145
return isEmpty ( targets ) ? undefined : targets ;
146
+ }
145
147
default :
146
148
return value as JsonValue ;
147
149
}
You can’t perform that action at this time.
0 commit comments