forked from MapComplete/MapComplete
		
	Add linting file
This commit is contained in:
		
							parent
							
								
									d326facf39
								
							
						
					
					
						commit
						0efd83c9b6
					
				
					 1 changed files with 30 additions and 0 deletions
				
			
		
							
								
								
									
										30
									
								
								scripts/lint.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								scripts/lint.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | |||
| 
 | ||||
| /* | ||||
|  * This script reads all theme and layer files and reformats them inplace | ||||
|  * Use with caution, make a commit beforehand! | ||||
|  */ | ||||
| 
 | ||||
| 
 | ||||
| import ScriptUtils from "./ScriptUtils"; | ||||
| import {readFileSync, writeFileSync} from "fs"; | ||||
| import {tag} from "@turf/turf"; | ||||
| 
 | ||||
| const layerFiles = ScriptUtils.getLayerFiles(); | ||||
| for (const layerFile of layerFiles) { | ||||
|     console.log("Handling ", layerFile.path) | ||||
| 
 | ||||
|     for (const tagRendering of layerFile.parsed.tagRenderings) { | ||||
|         if(tagRendering["#"] !== undefined){ | ||||
|             tagRendering["id"] = tagRendering["#"] | ||||
|             delete tagRendering["#"] | ||||
|         } | ||||
|         if(tagRendering["id"] === undefined){ | ||||
|             if(tagRendering["freeform"]?.key !== undefined ) { | ||||
|                 tagRendering["id"] = layerFile.parsed.id+"-"+tagRendering["freeform"]["key"] | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|      | ||||
|     writeFileSync(layerFile.path, JSON.stringify(layerFile.parsed, null, "    ")) | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue