/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const RULENAME="oj-ts-noconsole";const DESCRIPTION="All uses of console.log() should be removed before general release";const SHORT_DESCRIPTION="console.log() should be removed before general release";const CONSOLE="Console";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{CallExpression:this._onCall,file:this._onNewFile}}_onCall(ruleCtx,node){var callee,meth,isCons;callee=node.callee;if(callee&&callee.object){if(callee.object.name==="console"){isCons=true}else{let t=this._scopes.getVarType(callee.object);isCons=t===CONSOLE}if(isCons){meth=callee.property&&callee.property.type==="Identifier"?": method "+callee.property.name+"()":"";let issue=new ruleCtx.Issue(`Use of console object found ${meth} - strip before shipping!`);issue.setPosition(null,null,callee.property.range[0],callee.property.range[1]);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}_onNewFile(ruleCtx){this._scopes=ruleCtx.utils.AstUtils.getScopes()}}module.exports=Rule;