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