Is your feature request related to a problem? Please describe.
Commit d77c863 in sap.ui.core made the runtime log an error when a string value assigned to a boolean, int, or float property in an XML View cannot be parsed, e.g., width="abc" on an int property now triggers a console error instead of silently falling back to false/NaN.
Describe the solution you'd like
The UI5 linter should detect the same class of invalid values statically at lint time, before the app is run, so that:
- Developers get early feedback during development
- The
ui5-modernization plugin can auto-correct these values
Affected types and invalid value examples
| Type |
Invalid example |
Runtime behavior after d77c863 |
| boolean |
"yes", "1", "TRUE" |
error log, value ignored |
| int |
"abc", "2fA", "123,8", "123.8" |
error log, value ignored |
| float |
"abc", "2.5fA", "123,8" |
error log, value ignored |
Note on partial-parse cases ("2fA", "123,8"): these were not caught by d77c863 itself, but a follow-up fix tightened parseValue to use Number(), so they will also fail on a legacy-free runtime. The linter rule should cover both the fully-unparseable and the partial-parse cases.
Detection approach
For a property whose DataType is int or float or boolean, when the XML attribute value is a string literal:
boolean: flag any value other than "true" or "false"
float: flag when isNaN(Number(value))
int: flag when isNaN(Number(value)) or !Number.isInteger(Number(value))
Is your feature request related to a problem? Please describe.
Commit d77c863 in sap.ui.core made the runtime log an error when a string value assigned to a
boolean,int, orfloatproperty in an XML View cannot be parsed, e.g.,width="abc"on anintproperty now triggers a console error instead of silently falling back tofalse/NaN.Describe the solution you'd like
The UI5 linter should detect the same class of invalid values statically at lint time, before the app is run, so that:
ui5-modernizationplugin can auto-correct these valuesAffected types and invalid value examples
Note on partial-parse cases ("2fA", "123,8"): these were not caught by d77c863 itself, but a follow-up fix tightened parseValue to use
Number(), so they will also fail on a legacy-free runtime. The linter rule should cover both the fully-unparseable and the partial-parse cases.Detection approach
For a property whose DataType is int or float or boolean, when the XML attribute value is a string literal:
boolean: flag any value other than"true"or"false"float: flag whenisNaN(Number(value))int: flag whenisNaN(Number(value))or!Number.isInteger(Number(value))