File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` json 
2+     "CustomRequirement" : [
3+       {
4+         rule: "custom", 
5+         plugin: "My Plugin Name", 
6+         name: "checkThing", 
7+         otherStuff: "I like nachos" 
8+       }
9+     ]
10+ ``` 
11+ 
12+ plugin
13+ ``` js 
14+ const  addOptionalRules  =  require (' ./helpers/addOptionalRules'  )
15+ 
16+ module .exports  =  (context ) =>  {
17+   //  Register this plugin
18+   context .addPlugin ({
19+     name:  ' My Plugin Name'  ,
20+     description:  ' I do amazing things'  ,
21+     customChecks:  {
22+       checkThing:  async  (rule , context ) =>  {
23+         const  successObject  =  {
24+           pass:  true ,
25+           message:  ' Custom check succeeded!' 
26+         }
27+         const  failureObject  =  {
28+           pass:  false ,
29+           message:  ' Custom check failed!' 
30+         }
31+ 
32+         //  Randomly succeed or fail
33+         return  !! Math .floor (Math .random () *  2 ) ?  successObject :  failureObject
34+       }
35+     }
36+   })
37+ }
38+ ``` 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments