/*
 * Copyright (c) 2018, 2025, 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 path=require("path");const Utils=require("../jetwc-lib/jetwcutils-componentAuditUtils");const ruleDef=function(){};ruleDef.prototype.getName=function(){return"jetwc-oj-register"};ruleDef.prototype.getShortDescription=function(){return"Checks for usage of the deprecated oj.Register() syntax"};ruleDef.prototype.getDescription=function(){return"This rule ensures that components have been upgraded to remove references to the deprecated oj.Register() syntax"};ruleDef.prototype.register=function(context){return{CallExpression:this._doAudit}};ruleDef.prototype._doAudit=function(context,node){if(path.basename(context.filepath,".js")==="loader"||path.basename(context.filepath,".ts")==="loader"){const registerInfo=Utils.getLoaderRegisterInfo(context,node);if(registerInfo&&registerInfo.oldStyle){issue=new context.Issue(`Loader for Web Component registration uses deprecated oj.Register syntax`);context.reporter.addIssue(issue,context)}}};module.exports=ruleDef;