⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
node_modules
/
eslint
/
lib
/
rules
/
View File Name :
no-undefined.js
/** * @fileoverview Rule to flag references to the undefined variable. * @author Michael Ficarra */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { type: "suggestion", docs: { description: "disallow the use of `undefined` as an identifier", category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-undefined" }, schema: [], messages: { unexpectedUndefined: "Unexpected use of undefined." } }, create(context) { /** * Report an invalid "undefined" identifier node. * @param {ASTNode} node The node to report. * @returns {void} */ function report(node) { context.report({ node, messageId: "unexpectedUndefined" }); } /** * Checks the given scope for references to `undefined` and reports * all references found. * @param {eslint-scope.Scope} scope The scope to check. * @returns {void} */ function checkScope(scope) { const undefinedVar = scope.set.get("undefined"); if (!undefinedVar) { return; } const references = undefinedVar.references; const defs = undefinedVar.defs; // Report non-initializing references (those are covered in defs below) references .filter(ref => !ref.init) .forEach(ref => report(ref.identifier)); defs.forEach(def => report(def.name)); } return { "Program:exit"() { const globalScope = context.getScope(); const stack = [globalScope]; while (stack.length) { const scope = stack.pop(); stack.push(...scope.childScopes); checkScope(scope); } } }; } };