Update checked-in dependencies
This commit is contained in:
parent
6b0d45a5c6
commit
cc1adb825a
4247 changed files with 144820 additions and 149530 deletions
28
node_modules/eslint/lib/rules/no-script-url.js
generated
vendored
28
node_modules/eslint/lib/rules/no-script-url.js
generated
vendored
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -31,18 +33,30 @@ module.exports = {
|
|||
|
||||
create(context) {
|
||||
|
||||
return {
|
||||
/**
|
||||
* Check whether a node's static value starts with "javascript:" or not.
|
||||
* And report an error for unexpected script URL.
|
||||
* @param {ASTNode} node node to check
|
||||
* @returns {void}
|
||||
*/
|
||||
function check(node) {
|
||||
const value = astUtils.getStaticStringValue(node);
|
||||
|
||||
if (typeof value === "string" && value.toLowerCase().indexOf("javascript:") === 0) {
|
||||
context.report({ node, messageId: "unexpectedScriptURL" });
|
||||
}
|
||||
}
|
||||
return {
|
||||
Literal(node) {
|
||||
if (node.value && typeof node.value === "string") {
|
||||
const value = node.value.toLowerCase();
|
||||
|
||||
if (value.indexOf("javascript:") === 0) {
|
||||
context.report({ node, messageId: "unexpectedScriptURL" });
|
||||
}
|
||||
check(node);
|
||||
}
|
||||
},
|
||||
TemplateLiteral(node) {
|
||||
if (!(node.parent && node.parent.type === "TaggedTemplateExpression")) {
|
||||
check(node);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue