Skip to content

Commit

Permalink
refactor: Provide details for binding-syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Dec 11, 2024
1 parent 2df3150 commit 4187a51
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/linter/html/transpiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,15 @@ function checkBindingSyntaxAttr(attr: Attribute, report: HtmlReporter) {
if (attr.value.value.toLowerCase() === "complex") {
report.addMessage(MESSAGE.REDUNDANT_BOOTSTRAP_PARAM, {
name: attr.name.value,
messageDetails: "Only 'complex' is supported with UI5 2.X and automatically" +
" enforced by the UI5 runtime. Complex binding parser supports simple binding syntax per default.",
}, attr.name);
} else {
report.addMessage(MESSAGE.REDUNDANT_BOOTSTRAP_PARAM_ERROR, {
name: attr.name.value,
messageDetails: "Only 'complex' is supported with UI5 2.X and automatically" +
" enforced by the UI5 runtime. Check all bindings whether they will be " +
"misinterpreted in 2.0 with binding syntax 'complex'.",
}, attr.name);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/linter/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ export const MESSAGE_INFO = {

message: ({name}: {name: string}) =>
`Redundant bootstrap parameter '${name}' should be removed`,
details: () => undefined,
details: ({messageDetails}: {messageDetails?: string}) => messageDetails,
},

[MESSAGE.REDUNDANT_BOOTSTRAP_PARAM_ERROR]: {
Expand Down
5 changes: 5 additions & 0 deletions test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Generated by [AVA](https://avajs.dev).
column: 3,
line: 19,
message: 'Redundant bootstrap parameter \'data-sap-ui-binding-syntax\' should be removed',
messageDetails: 'Only \'complex\' is supported with UI5 2.X and automatically enforced by the UI5 runtime. Check all bindings whether they will be misinterpreted in 2.0 with binding syntax \'complex\'.',
ruleId: 'no-deprecated-api',
severity: 2,
},
Expand All @@ -94,6 +95,7 @@ Generated by [AVA](https://avajs.dev).
column: 3,
line: 20,
message: 'Redundant bootstrap parameter \'data-sap-ui-binding-syntax\' should be removed',
messageDetails: 'Only \'complex\' is supported with UI5 2.X and automatically enforced by the UI5 runtime. Complex binding parser supports simple binding syntax per default.',
ruleId: 'no-deprecated-api',
severity: 1,
},
Expand Down Expand Up @@ -460,6 +462,7 @@ Generated by [AVA](https://avajs.dev).
column: 3,
line: 18,
message: 'Redundant bootstrap parameter \'data-sap-ui-bindingsyntax\' should be removed',
messageDetails: 'Only \'complex\' is supported with UI5 2.X and automatically enforced by the UI5 runtime. Complex binding parser supports simple binding syntax per default.',
ruleId: 'no-deprecated-api',
severity: 1,
},
Expand All @@ -474,6 +477,7 @@ Generated by [AVA](https://avajs.dev).
column: 3,
line: 19,
message: 'Redundant bootstrap parameter \'data-sap-ui-xx-bindingsyntax\' should be removed',
messageDetails: 'Only \'complex\' is supported with UI5 2.X and automatically enforced by the UI5 runtime. Complex binding parser supports simple binding syntax per default.',
ruleId: 'no-deprecated-api',
severity: 1,
},
Expand All @@ -488,6 +492,7 @@ Generated by [AVA](https://avajs.dev).
column: 3,
line: 20,
message: 'Redundant bootstrap parameter \'data-sap-ui-xx-binding-syntax\' should be removed',
messageDetails: 'Only \'complex\' is supported with UI5 2.X and automatically enforced by the UI5 runtime. Complex binding parser supports simple binding syntax per default.',
ruleId: 'no-deprecated-api',
severity: 1,
},
Expand Down
Binary file modified test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap
Binary file not shown.

0 comments on commit 4187a51

Please sign in to comment.