/*
 * 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-register-css"};ruleDef.prototype.getShortDescription=function(){return"Checks for usage of the deprecated registration of CSS files "};ruleDef.prototype.getDescription=function(){return"This rule ensures that components have been upgraded to remove any passing of CSS information to the register() API"};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.registerCSS){issue=new context.Issue(`Loader for Web Component passes CSS information to the registration call. This is deprecated and the CSS! directive in the loader imports should be used instead`);context.reporter.addIssue(issue,context)}}};module.exports=ruleDef;