@@ -98,5 +98,81 @@ export function generateImportOverrideDiagnostics(
9898 }
9999 }
100100
101+ // Check for values/minValue-maxValue conflicts across import boundaries
102+ const valuesAndMinMaxConflicts = importsAndSymbolsAfter
103+ . map ( ( [ imp , s ] ) => {
104+ const importSpecifier = getPropertyValueFromNode ( imp ) ;
105+ if ( typeof importSpecifier !== "string" ) return undefined ;
106+ const resolvedImport = config . templates [ importSpecifier ] ;
107+ if ( ! resolvedImport ) return undefined ;
108+
109+ const properties = s
110+ . map ( ( s ) => config . getNodeFromSymbol ( s ) )
111+ . filter ( nodeIsPropertyNameOrValue )
112+ . map ( ( n ) => {
113+ return [
114+ getPropertyNameFromNode ( n ) ,
115+ n . parent . valueNode ,
116+ n ,
117+ ] as const ;
118+ } )
119+ . filter ( ( [ name ] ) => {
120+ if (
121+ name === "values" &&
122+ ( "minValue" in resolvedImport ||
123+ "maxValue" in resolvedImport )
124+ ) {
125+ return true ;
126+ }
127+
128+ if (
129+ ( name === "minValue" || name === "maxValue" ) &&
130+ "values" in resolvedImport
131+ ) {
132+ return true ;
133+ }
134+
135+ return false ;
136+ } ) ;
137+ return [ resolvedImport , properties ] as const ;
138+ } )
139+ . filter (
140+ ( conflict ) =>
141+ conflict && conflict [ 1 ] != undefined && conflict [ 1 ] . length > 0 ,
142+ ) ;
143+
144+ for ( const block of valuesAndMinMaxConflicts ) {
145+ if ( ! block ) continue ;
146+ const [ imp , properties ] = block ;
147+
148+ for ( const [ name , , propNode ] of properties ) {
149+ const templateHasMinMax = "minValue" in imp || "maxValue" in imp ;
150+ const templateHasValues = "values" in imp ;
151+
152+ // Template has minValue/maxValue, local has values -> error on values
153+ if ( templateHasMinMax && name === "values" ) {
154+ ret . push ( {
155+ type : DiagnosticType . ValuesMinMaxConflict ,
156+ range : rangeFromNode ( config . original , propNode ) ,
157+ localHasValues : true ,
158+ templateHasValues : false ,
159+ } ) ;
160+ }
161+
162+ // Template has values, local has minValue/maxValue -> error on minValue/maxValue
163+ if (
164+ templateHasValues &&
165+ ( name === "minValue" || name === "maxValue" )
166+ ) {
167+ ret . push ( {
168+ type : DiagnosticType . ValuesMinMaxConflict ,
169+ range : rangeFromNode ( config . original , propNode ) ,
170+ localHasValues : false ,
171+ templateHasValues : true ,
172+ } ) ;
173+ }
174+ }
175+ }
176+
101177 return ret ;
102178}
0 commit comments