27 lines
828 B
TypeScript
27 lines
828 B
TypeScript
// Static scanner fixtures. Never execute this file.
|
|
function dynamicCode(source: string) {
|
|
// ruleid: frontend-no-dynamic-code
|
|
eval(source);
|
|
// ruleid: frontend-no-dynamic-code
|
|
new Function(source);
|
|
// ruleid: frontend-no-dynamic-code
|
|
Function(source);
|
|
// ok: frontend-no-dynamic-code
|
|
JSON.parse(source);
|
|
}
|
|
|
|
function renderText(node: HTMLElement, text: string) {
|
|
// ruleid: frontend-no-document-write
|
|
document.write(text);
|
|
// ruleid: frontend-no-document-write
|
|
document.writeln(text);
|
|
// ruleid: frontend-no-inner-html-assignment
|
|
node.innerHTML = text;
|
|
// ruleid: frontend-no-inner-html-assignment
|
|
node.innerHTML += text;
|
|
// ok: frontend-no-inner-html-assignment, frontend-no-document-write
|
|
node.textContent = text;
|
|
// ok: frontend-no-inner-html-assignment
|
|
return <span>{text}</span>;
|
|
}
|