@@ -147,7 +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 = `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
+ }
151
156
let configExtractionNode : Declaration | null = null ;
152
157
let nonCommentNodeCount = 0 ;
153
158
@@ -157,7 +162,7 @@ const plugin = (isEnabled: boolean, _options: never, context: {fix: boolean}) =>
157
162
nonCommentNodeCount ++ ;
158
163
}
159
164
160
- if ( currentNode . type === 'decl' && currentNode . value === expectedValue ) {
165
+ if ( currentNode . type === 'decl' && expectedValues . includes ( currentNode . value ) ) {
161
166
configExtractionNode = currentNode ;
162
167
break ;
163
168
}
@@ -166,12 +171,14 @@ const plugin = (isEnabled: boolean, _options: never, context: {fix: boolean}) =>
166
171
167
172
if ( ! configExtractionNode && nonCommentNodeCount > 0 ) {
168
173
if ( context . fix ) {
169
- node . insertBefore ( 0 , { prop : expectedProperty , value : expectedValue } ) ;
174
+ node . insertBefore ( 0 , { prop : expectedProperty , value : expectedValues [ 0 ] } ) ;
170
175
} else {
171
176
reportError (
172
177
node ,
173
178
`Config is not extracted. Consumers could pass a theme object. ` +
174
- `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' ) ) ;
175
182
}
176
183
} else if ( configExtractionNode && configExtractionNode . prop !== expectedProperty ) {
177
184
reportError (
0 commit comments