]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-script-url.js
2 * @fileoverview Rule to flag when using javascript: urls
5 /* eslint no-script-url: 0 -- Code is checking to report such URLs */
9 const astUtils
= require("./utils/ast-utils");
11 //------------------------------------------------------------------------------
13 //------------------------------------------------------------------------------
20 description
: "disallow `javascript:` urls",
22 url
: "https://eslint.org/docs/rules/no-script-url"
28 unexpectedScriptURL
: "Script URL is a form of eval."
35 * Check whether a node's static value starts with "javascript:" or not.
36 * And report an error for unexpected script URL.
37 * @param {ASTNode} node node to check
40 function check(node
) {
41 const value
= astUtils
.getStaticStringValue(node
);
43 if (typeof value
=== "string" && value
.toLowerCase().indexOf("javascript:") === 0) {
44 context
.report({ node
, messageId
: "unexpectedScriptURL" });
49 if (node
.value
&& typeof node
.value
=== "string") {
53 TemplateLiteral(node
) {
54 if (!(node
.parent
&& node
.parent
.type
=== "TaggedTemplateExpression")) {