MCPcopy Create free account
hub / github.com/UI5/webcomponents / checkAttributeUsage

Function checkAttributeUsage

packages/base/src/jsx-dev-runtime.ts:28–41  ·  view source on GitHub ↗
(type: string | typeof UI5Element, props: Record<string, any>)

Source from the content-addressed store, hash-verified

26}
27
28function checkAttributeUsage(type: string | typeof UI5Element, props: Record<string, any>) {
29 if (!isUI5ElementClass(type)) {
30 return;
31 }
32
33 const tag = type.getMetadata().getTag();
34 const componentAttributes = type.getMetadata().getAttributesList();
35 Object.keys(props).forEach(prop => {
36 if (prop.includes("-") && componentAttributes.includes(prop)) {
37 // eslint-disable-next-line no-console
38 console.warn(`Avoid attribute usage in favour of properties ['${prop}' --> '${kebabToCamelCase(prop)}'] for tag [${tag}]. Check stack trace to find out which template causes this. Attributes are not type-checked and boolean conversion is manual and error-prone.`);
39 }
40 });
41}
42
43export function Fragment(props: Record<string, any>, context?: any) {
44 return _Fragment(props, context);

Callers 1

jsxDEVFunction · 0.85

Calls 5

isUI5ElementClassFunction · 0.90
kebabToCamelCaseFunction · 0.85
getTagMethod · 0.80
getMetadataMethod · 0.80
getAttributesListMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…