Files
quantumbotx/node_modules/eslint/lib/rules/no-script-url.js
T
Reynov Christian 78737b6835 Refactor and update bot management and routing
- Update `.gitignore` to include `lab/` for backtesting and raw data.
- Refactor `app.py` to improve error handling and logging.
- Remove deprecated files: `core/bot_logic.py`, `core/bots/base_bot.py`, `core/bots/manager.py`, `core/db/database.py`, `core/routes/api_analysis.py`, `core/routes/api_bots_analysis.py`, `core/strategies/logic_ma.py`, `core/strategies/logic_rsi.py`.
- Modify multiple files to enhance bot management, routing, and strategy handling.
- Update JavaScript and HTML templates for better UI and functionality.
2025-07-31 21:33:44 +08:00

69 lines
1.5 KiB
JavaScript

/**
* @fileoverview Rule to disallow `javascript:` URLs
* @author Ilya Volodin
*/
/* eslint no-script-url: 0 -- Code is checking to report such URLs */
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow `javascript:` URLs",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-script-url",
},
schema: [],
messages: {
unexpectedScriptURL: "Script URL is a form of eval.",
},
},
create(context) {
/**
* 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") {
check(node);
}
},
TemplateLiteral(node) {
if (
!(
node.parent &&
node.parent.type === "TaggedTemplateExpression"
)
) {
check(node);
}
},
};
},
};