| 
									
										
										
										
											2020-11-26 13:12:57 +01:00
										 |  |  | const fs = require('fs'); | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2021-08-02 15:39:40 +02:00
										 |  |  | const YAML = require('js-yaml'); | 
					
						
							| 
									
										
										
										
											2019-06-21 15:22:14 +02:00
										 |  |  | const argv = require('yargs').argv; | 
					
						
							| 
									
										
										
										
											2020-11-26 13:12:57 +01:00
										 |  |  | const linter = require('./linter'); | 
					
						
							| 
									
										
										
										
											2019-06-21 15:22:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-26 13:12:57 +01:00
										 |  |  | const CONFIG_PATH = path.resolve( | 
					
						
							|  |  |  |   __dirname, | 
					
						
							|  |  |  |   '../../../curriculum/challenges/.markdownlint.yaml' | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2019-06-21 15:22:14 +02:00
										 |  |  | const isMDRE = /.*\.md$/; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-26 13:12:57 +01:00
										 |  |  | const lintRules = fs.readFileSync(CONFIG_PATH, 'utf8'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const lint = linter(YAML.load(lintRules)); | 
					
						
							| 
									
										
										
										
											2019-06-21 15:22:14 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | const files = argv._.filter(arg => isMDRE.test(arg)); | 
					
						
							|  |  |  | files.forEach(path => lint({ path: path })); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = lint; |