mirror of
				https://github.com/Mibew/simple-icons.git
				synced 2025-10-31 02:25:59 +03:00 
			
		
		
		
	Add SVGLint rule to check invalid characters after final closepath (#11053)
This commit is contained in:
		
							parent
							
								
									346d4743ad
								
							
						
					
					
						commit
						74ddcc1797
					
				| @ -1 +1 @@ | |||||||
| <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>FreeCAD</title><path d="M0 0v24h5.6v-9.6h4.8V8.8H5.6V5.6h8V0Zm15.552 6.4-1.638.086a.4.4 0 0 0-.363.295l-.702 2.576-.714.342L10.9 9.16v5.74H6.404l.092 1.59a.4.4 0 0 0 .293.363l2.576.7.344.714-1.076 2.437a.4.4 0 0 0 .097.46l1.225 1.1a.4.4 0 0 0 .467.052l2.312-1.329.752.268.967 2.488a.4.4 0 0 0 .394.256l1.65-.092a.4.4 0 0 0 .366-.297l.691-2.578.713-.341 2.446 1.08a.4.4 0 0 0 .46-.1l1.102-1.225a.4.4 0 0 0 .049-.466l-1.328-2.315.261-.751 2.487-.967a.4.4 0 0 0 .256-.393l-.084-1.648a.4.4 0 0 0-.295-.365l-2.578-.692-.344-.714 1.072-2.45a.4.4 0 0 0-.1-.459l-1.224-1.101a.4.4 0 0 0-.467-.049l-2.314 1.326-.744-.258-.975-2.49a.4.4 0 0 0-.395-.253zm2.249 8.801a2.6 2.6 0 0 1-2.6 2.6 2.6 2.6 0 0 1-2.6-2.6 2.6 2.6 0 0 1 2.6-2.6 2.6 2.6 0 0 1 2.6 2.6z55"/></svg> | <svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>FreeCAD</title><path d="M0 0v24h5.6v-9.6h4.8V8.8H5.6V5.6h8V0Zm15.552 6.4-1.638.086a.4.4 0 0 0-.363.295l-.702 2.576-.714.342L10.9 9.16v5.74H6.404l.092 1.59a.4.4 0 0 0 .293.363l2.576.7.344.714-1.076 2.437a.4.4 0 0 0 .097.46l1.225 1.1a.4.4 0 0 0 .467.052l2.312-1.329.752.268.967 2.488a.4.4 0 0 0 .394.256l1.65-.092a.4.4 0 0 0 .366-.297l.691-2.578.713-.341 2.446 1.08a.4.4 0 0 0 .46-.1l1.102-1.225a.4.4 0 0 0 .049-.466l-1.328-2.315.261-.751 2.487-.967a.4.4 0 0 0 .256-.393l-.084-1.648a.4.4 0 0 0-.295-.365l-2.578-.692-.344-.714 1.072-2.45a.4.4 0 0 0-.1-.459l-1.224-1.101a.4.4 0 0 0-.467-.049l-2.314 1.326-.744-.258-.975-2.49a.4.4 0 0 0-.395-.253zm2.249 8.801a2.6 2.6 0 0 1-2.6 2.6 2.6 2.6 0 0 1-2.6-2.6 2.6 2.6 0 0 1 2.6-2.6 2.6 2.6 0 0 1 2.6 2.6"/></svg> | ||||||
| Before Width: | Height: | Size: 832 B After Width: | Height: | Size: 829 B | 
| @ -964,6 +964,27 @@ const config = { | |||||||
|           } |           } | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|  |       (reporter, $, ast, {filepath}) => { | ||||||
|  |         reporter.name = 'final-closepath'; | ||||||
|  | 
 | ||||||
|  |         const iconPath = getIconPath($, filepath); | ||||||
|  |         const segments = getIconPathSegments(iconPath); | ||||||
|  | 
 | ||||||
|  |         // Unnecessary characters after the final closepath
 | ||||||
|  |         const lastSegment = segments.at(-1); | ||||||
|  |         const endsWithZ = ['z', 'Z'].includes(lastSegment.params.at(0)); | ||||||
|  |         if (endsWithZ && lastSegment.end - lastSegment.start > 1) { | ||||||
|  |           const ending = iconPath.slice(lastSegment.start + 1); | ||||||
|  |           const closepath = iconPath.at(lastSegment.start); | ||||||
|  |           const pathDIndex = getPathDIndex(ast.source); | ||||||
|  |           const index = pathDIndex + lastSegment.start + 2; | ||||||
|  |           const errorMessage = | ||||||
|  |             `Invalid character(s) "${ending}" after the final` + | ||||||
|  |             ` closepath command "${closepath}" at index ${index}` + | ||||||
|  |             ` (should be removed)`; | ||||||
|  |           reporter.error(errorMessage); | ||||||
|  |         } | ||||||
|  |       }, | ||||||
|       (reporter, $, ast, {filepath}) => { |       (reporter, $, ast, {filepath}) => { | ||||||
|         reporter.name = 'path-format'; |         reporter.name = 'path-format'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user