@@ -147,9 +147,12 @@ const plugin = (isEnabled: boolean, _options: never, context: {fix: boolean}) =>
147
147
}
148
148
149
149
const expectedProperty = type === 'density' ? '$density-scale' : '$config' ;
150
- const expectedValue = type === 'typography' ?
151
- `mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme))` :
152
- `mat-get-${ type } -config($config-or-theme)` ;
150
+ const expectedValues = [ `mat-get-${ type } -config($config-or-theme)` ] ;
151
+ if ( type === 'typography' ) {
152
+ expectedValues . unshift (
153
+ 'mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme))'
154
+ ) ;
155
+ }
153
156
let configExtractionNode : Declaration | null = null ;
154
157
let nonCommentNodeCount = 0 ;
155
158
@@ -159,7 +162,7 @@ const plugin = (isEnabled: boolean, _options: never, context: {fix: boolean}) =>
159
162
nonCommentNodeCount ++ ;
160
163
}
161
164
162
- if ( currentNode . type === 'decl' && currentNode . value === expectedValue ) {
165
+ if ( currentNode . type === 'decl' && expectedValues . includes ( currentNode . value ) ) {
163
166
configExtractionNode = currentNode ;
164
167
break ;
165
168
}
@@ -168,12 +171,14 @@ const plugin = (isEnabled: boolean, _options: never, context: {fix: boolean}) =>
168
171
169
172
if ( ! configExtractionNode && nonCommentNodeCount > 0 ) {
170
173
if ( context . fix ) {
171
- node . insertBefore ( 0 , { prop : expectedProperty , value : expectedValue } ) ;
174
+ node . insertBefore ( 0 , { prop : expectedProperty , value : expectedValues [ 0 ] } ) ;
172
175
} else {
173
176
reportError (
174
177
node ,
175
178
`Config is not extracted. Consumers could pass a theme object. ` +
176
- `Extract the configuration by using: ${ expectedProperty } : ${ expectedValue } ` ) ;
179
+ `Extract the configuration by using one of the following:` +
180
+ expectedValues . map ( expectedValue => `${ expectedProperty } : ${ expectedValue } ` )
181
+ . join ( '\n' ) ) ;
177
182
}
178
183
} else if ( configExtractionNode && configExtractionNode . prop !== expectedProperty ) {
179
184
reportError (
0 commit comments