generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Improve Control Renderer lint (#392)
- Detect non static renderer objects in ES6/TS code - Detect apiVersion property that is not part of the variable initialization - Properly analyze SAPUI5 raw renderers that might be ambient modules and present in `@sapui5/types`
- Loading branch information
Showing
10 changed files
with
374 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import Control from "sap/ui/core/Control"; | ||
import RenderManager from "sap/ui/core/RenderManager"; | ||
import type {MetadataOptions} from "sap/ui/core/Element"; | ||
import ImportedRenderer from "./TSControlRenderer.js"; | ||
|
||
export class Test1 extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
tag: "string", | ||
}, | ||
aggregations: { | ||
children: { type: "sap.ui.core.Control", multiple: true }, | ||
}, | ||
defaultAggregation: "children", | ||
}; | ||
|
||
static renderer = { | ||
apiVersion: 1, | ||
render: (rm: RenderManager, control: HTMLElement) => {}, | ||
}; | ||
} | ||
|
||
export class Test2 extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
tag: "string", | ||
}, | ||
aggregations: { | ||
children: { type: "sap.ui.core.Control", multiple: true }, | ||
}, | ||
defaultAggregation: "children", | ||
}; | ||
|
||
static renderer = { | ||
render: (rm: RenderManager, control: HTMLElement) => {}, | ||
}; | ||
} | ||
|
||
export class Test3 extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
tag: "string", | ||
}, | ||
aggregations: { | ||
children: { type: "sap.ui.core.Control", multiple: true }, | ||
}, | ||
defaultAggregation: "children", | ||
}; | ||
|
||
static renderer = (rm: RenderManager, control: HTMLElement) => {}; | ||
} | ||
|
||
export class Test4 extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
tag: "string", | ||
}, | ||
aggregations: { | ||
children: { type: "sap.ui.core.Control", multiple: true }, | ||
}, | ||
defaultAggregation: "children", | ||
}; | ||
|
||
renderer = { | ||
apiVersion: 2, | ||
render: (rm: RenderManager, control: HTMLElement) => {}, | ||
}; | ||
} | ||
|
||
export class Test5 extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
tag: "string", | ||
}, | ||
aggregations: { | ||
children: { type: "sap.ui.core.Control", multiple: true }, | ||
}, | ||
defaultAggregation: "children", | ||
}; | ||
|
||
// Missing static keyword. Renderer won't be analyzed as such | ||
// until its defined explicitly as static property. | ||
renderer = ImportedRenderer; | ||
} | ||
|
||
export class Test6 extends Control { | ||
static readonly metadata: MetadataOptions = { | ||
properties: { | ||
text: "string", | ||
tag: "string", | ||
}, | ||
aggregations: { | ||
children: { type: "sap.ui.core.Control", multiple: true }, | ||
}, | ||
defaultAggregation: "children", | ||
}; | ||
|
||
static renderer = ImportedRenderer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
var myControlRenderer = {}; | ||
myControlRenderer.apiVersion = 1; | ||
myControlRenderer.render = (oRm, oMyControl) => { }; | ||
export default myControlRenderer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.