This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/eslint/lib/rules/no-script-url.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
/**
* @fileoverview Rule to flag when using javascript: urls
* @author Ilya Volodin
*/
/* jshint scripturl: true */
/* eslint no-script-url: 0 */
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "disallow `javascript:` urls",
category: "Best Practices",
recommended: false,
url: "https://eslint.org/docs/rules/no-script-url"
},
schema: []
},
create(context) {
return {
Literal(node) {
if (node.value && typeof node.value === "string") {
const value = node.value.toLowerCase();
if (value.indexOf("javascript:") === 0) {
context.report({ node, message: "Script URL is a form of eval." });
}
}
}
};
}
};