You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/types/Config.ts should have a new property customRules?: string[] // Array of paths to custom rule files They can sit at /vue-mess-detector/ folder by default.
In analyze we should load the custom rules
importtype{CustomRule}from'./types/CustomRule'constloadCustomRules=async(customRulePaths: string[]): Promise<CustomRule[]>=>{constcustomRules: CustomRule[]=[]for(constpathofcustomRulePaths){try{constmodule=awaitimport(path)if(typeofmodule.default==='function'){construle=module.default()if(isValidCustomRule(rule)){customRules.push(rule)}else{console.warn(`Invalid custom rule in ${path}`)}}}catch(error){console.error(`Error loading custom rule from ${path}:`,error)}}returncustomRules}constisValidCustomRule=(rule: any): rule is CustomRule=>{return(typeofrule.name==='string'&&typeofrule.description==='string'&&typeofrule.check==='function'&&typeofrule.report==='function')}
So anyone can create and use their own rules
The text was updated successfully, but these errors were encountered: