diff --git a/.svglint-ignored.json b/.svglint-ignored.json index a09a4d93..1c0439a8 100644 --- a/.svglint-ignored.json +++ b/.svglint-ignored.json @@ -162,6 +162,17 @@ "M4.78 24c-.88 0-1.36-.2-1.62-.36-.36-.21-1.02-.75-1.62-2.33A27.06 27.06 0 0 1 0 12V12c.02-3.66.59-6.76 1.54-9.3C2.14 1.1 2.8.56 3.16.35 3.42.21 3.9 0 4.78 0c.33 0 .72.03 1.18.1a26.1 26.1 0 0 1 8.7 3.3h.01a26.4 26.4 0 0 1 7.16 6.01c1.06 1.32 1.19 2.17 1.19 2.59 0 .42-.13 1.27-1.19 2.59a26.4 26.4 0 0 1-7.16 6h-.01a26.03 26.03 0 0 1-8.7 3.3c-.46.08-.85.11-1.18.11z": "Zalando", "M7.014 4.984A7.02 7.02 0 0 0 0 12.002a7.017 7.017 0 0 0 13.271 3.174h2.915c.696 0 1.324-.044 1.962-.553.461-.365.749-.884.883-1.56v2.103h1.336v-2.473h3.153v-1.1h-3.16l.02-.445c.005-.724.226-1.162 1.277-1.162H24V8.873h-2.818c-1.517 0-2.141.85-2.141 2.18v.129c-.254-1.565-1.185-2.309-2.889-2.309h-2.855a7.018 7.018 0 0 0-6.283-3.889zM8.02 8.873h3.436c1.742 0 1.992 1.219 1.992 1.9 0 .725-.298 1.873-1.992 1.873h-.844c-1.056 0-1.281.38-1.281 1.104v.336h3.945v1.074H7.982v-1.558c0-1.335.625-2.123 2.137-2.123h.873c.691 0 1.1-.14 1.1-.725 0-.605-.409-.772-1.12-.772h-2.95V8.873zm6.63 1.113h1.472c1.157 0 1.574.496 1.574 2.041 0 1.541-.412 2.035-1.574 2.035H14.65V9.986z": "ZDF" }, + "icon-precision": { + "M 12,0 A 12.007568,12.007568 0 0 0 0,12 12.034059,12.034059 0 0 0 12,24.030275 12.034059,12.034059 0 0 0 24,12 12.007568,12.007568 0 0 0 12.003784,0 Z m 0,0.90444656 A 11.09177,11.09177 0 0 1 23.099338,11.996216 c 0,6.130558 -4.964995,11.125828 -11.099338,11.125828 A 11.118259,11.118259 0 0 1 0.90823086,12 11.09177,11.09177 0 0 1 11.996216,0.90823086 Z M 12.08704,2.0662252 11.65563,3.3188269 5.9754032,19.402081 5.7710512,20.007569 H 18.440871 L 18.210029,19.402081 12.526017,3.3150427 Z m 0,2.8003785 2.009461,5.6499533 -3.027437,8.563859 H 7.050142 Z m 2.505204,7.0463573 2.535478,7.163671 h -5.097446 z": "Audio-Technica", + "m14.574 1.0203c-0.097-0.096997-0.29099-0.58198-0.97097-0.58198h-6.7038s0.97097 0.096997 1.36 1.068c0 0 1.069 2.5269 2.0399 4.9558 2.8179 6.6068 7.1898 17.099 7.1898 17.099h6.5108c0.097-0.097-9.3267-22.443-9.4247-22.54zm-8.8407 0.87497-5.3438 12.631c-0.29199 0.87497-0.097997 1.9439 1.457 1.9439h4.1779l3.6919-8.8417c-1.166-2.9149-2.1359-5.2478-2.1359-5.2478-0.096997-0.29199-0.38899-1.069-0.97197-1.069-0.58298 0-0.77698 0.48598-0.87397 0.58298zm-0.097997 15.643h-4.4689c-0.77698 0-1.166-0.48598-1.166-0.48598 0.77698 1.36 3.0119 5.6358 3.0119 5.6358 0.38899 0.48598 0.77698 0.77698 1.36 0.77698 1.263 0 3.2069-1.263 3.2069-1.263l7.4808-4.6639z": "Autodesk", + "M1.74219 17.9588C0.78125 17.9588 0 18.7528 0 19.7294C0 20.6981 0.78125 21.5 1.74219 21.5C2.70312 21.5 3.48438 20.6981 3.48438 19.7294C3.48438 18.7528 2.71094 17.9588 1.74219 17.9588ZM23.1797 2.5L12.2188 6.05704V2.54764L0.390624 6.38257V16.5694L10.5938 13.2585V16.752L24 12.4089L20.3672 8.80422L23.1797 2.5ZM10.5938 11.5117L2.02344 14.2906V7.58943L10.5938 4.81049V11.5117ZM20.9688 11.6546L12.2188 14.4971V7.8038L20.2734 5.18366L18.4219 9.15357L20.9688 11.6546Z": "Clubhouse", + "M 16.046875 5.039062 L 24 12.992188 L 21.292969 15.703125 L 16.046875 10.457031 L 14.203125 12.308594 L 11.488281 9.597656 Z M 10.652344 10.4375 L 13.359375 13.152344 L 15.90625 15.691406 L 13.191406 18.398438 L 7.953125 13.160156 L 3.777344 17.335938 L 2.707031 18.398438 L 0 15.691406 L 7.953125 7.738281 Z M 10.652344 10.4375": "Code Climate", + "M10.2 20.4H13.799999999999999V24H10.2zM9 0H15V18H9z": "Highly", + "M19.486468 20.122872c-.102115.242867-.268302.649317-.374421.909245a6.1929584 6.2081525 0 01-.225253.511826c-.05606.07326-.298335.709532-.298335.782793.004.08832 2.290574 1.67297 2.413712 1.67297.07709 0 .574646-.26896.863971-.465662.06007-.04215.243273-.149533.404454-.242866.166187-.09032.387435-.222795.494556-.295053.110124-.06824.293329-.174623.416468-.234838.120135-.06021.217244-.132473.217244-.16258a1.7820022 1.7863743 0 00-.11513-.341218 26.389651 26.454397 0 01-.289325-.819925c-.09811-.29405-.272306-.80688-.38343-1.144083l-.208234-.606163h-2.733071zM3.8033473 1.1931548c-.3466858.0938338-1.7260133.4297052-2.7391887.6682354-.42177018.0964643-.83519765.1973136-.91398988.2236221L0 2.1271065V21.075351h.24842727c.1334833 0 .98165843.02631 1.87988993.05613.8991584.02981 1.7501145.05613 1.8882327.05613h.2521351l-.023174-3.297328L4.22141 14.5912l.5005624-.462153c1.2458441-1.156697 2.0337665-1.865271 2.0458171-1.835455.090843.271853.2447193.783116.3819106 1.245268.095477.317455.2169103.71296.2725284.876949.055619.164867.1455338.473554.2048598.691036.063034.21573.1260675.420937.1418259.455138.019466.03333.114017.342009.2132026.690158.098258.342886.1965171.660344.2169104.70156.018539.04034.1177248.35078.2159834.689281l.3985959 1.324196c.1177249.388488.283652.937459.370787 1.220712.0825.279748.189102.619126.2363773.754178l.090843.245544h1.8835982c1.485928 0 1.888232-.0114 1.888232-.04823 0-.04912-.153877-.597204-.472753-1.667959-.111236-.380596-.283653-.966398-.37913-1.305778a16.522267 15.630746 0 00-.228034-.7647c-.03152-.08243-.129775-.418304-.21691-.745406-.09084-.328857-.177051-.631402-.201152-.67262-.01946-.04122-.11031-.342888-.197445-.670866a9.7720906 9.2448012 0 00-.196517-.671745c-.01946-.04122-.111236-.343763-.197443-.671743a26.451015 25.023752 0 00-.255844-.876949c-.05099-.15259-.157584-.506876-.236376-.783116a145.16309 137.33028 0 00-.335562-1.156699c-.366153-1.2496523-.4727541-1.6223553-.4727541-1.6679565 0-.040339.9974171-1.0891713 3.6698651-3.8533159 1.403428-1.4557361 1.453484-1.508353 1.453484-1.56097 0-.040339-.232669-.137681-.725816-.3016705a6.8493623 6.4797793 0 01-.472753-.171882 7.54088 7.1339835 0 00-.516321-.1867904 9.0342245 8.546749 0 01-.512613-.190298 14.590467 13.803185 0 00-.551546-.1973136 14.852799 14.051361 0 01-.610871-.2236221c-.241011-.1052344-.279944-.1008493-.456994.0596328l-.571939.5147693-1.0993842.9883221c-.3782033.3393777-.7489903.6752494-.8277826.7462823-.0787922.0701553-.4690455.4253204-.8676414.7831158-.4013769.3586724-.9139899.8208246-1.1429509 1.0304156-.228034.205206-.8314897.7497918-1.3403948 1.2049286a52.790794 49.94227 0 00-.9909282.9076425c-.0667417.0701553-.0713765-.1122495-.0713765-3.9217178v-3.99539l-.086208.0035c-.050983 0-.2132025.037709-.3670791.074541zM17.208369.0662374c0 .03813608.04205.25089527.0921.47569743.111125.47971177.197221.88917287.336378 1.54651847.200225.9523984.460517 2.1516778.514578 2.3794907.03204.1274548.121136.5449445.200225.9283125.07809.383368.224252 1.0597816.317356 1.5083823.09711.44559.264297 1.2303904.375422 1.7412132.110124.5108228.271305 1.2765551.360405 1.702074.0901.425518.175197.815911.193217.870104.01802.05419.100113.437562.182205.851037.07909.414479.16018.788815.179201.831969.01702.04215.103116.433547.196221.870105.150169.74265.314353 1.501357.735827 3.462354.0931.444587.236265 1.101932.310348 1.458204.118133.565016.190214.788814.233262.722578.003-.007.07008-.493762.146165-1.07885.07809-.584084.153172-1.105946.168189-1.160139.01702-.05419.09611-.592113.174195-1.19928.08309-.607166.161181-1.164154.179202-1.237415.01802-.07326.10712-.684443.19622-1.354835.0901-.668385.172194-1.24444.182205-1.275551.01001-.03111.100112-.622221.200225-1.314691.09611-.692471.253284-1.7994214.350394-2.456767l.353397-2.4567664c.09711-.692471.186209-1.3116805.200225-1.3728989.06407-.3181352.385433-2.6273753.40045-2.8632168l.01402-.2709669-.635714-.1274548c-.350395-.0732615-1.047178-.2127592-1.54774-.31713165-.500562-.10437244-1.225377-.25089527-1.607807-.3291746-.381428-.07727574-.849955-.17361952-1.036164-.21275918a42.17739 42.280871 0 00-.946063-.19268757c-.332373-.06623635-.636715-.13548345-.668751-.15455149a.48053993.48171892 0 00-.207233-.03913966c-.110124 0-.14216.01505372-.14216.06623635z": "Kahoot", + "M 7.401726,2.3422378 C 5.1778223,3.3264335 3.7866995,4.9257515 3.0012356,6.0897522 2.1495278,7.3578505 1.8183081,8.4082905 1.8183081,8.4177535 v 0.01893 c -0.2460489,0.700293 -0.473171,1.7980495 -0.473171,1.8075135 -0.2649758,1.343805 -0.1419513,2.592977 -0.1419513,2.611904 0.00946,0.08517 0.018927,0.170341 0.02839,0.246049 0.02839,-0.33122 0.066244,-0.671903 0.1324879,-1.012586 0.018927,-0.132488 0.3690734,-2.015709 1.6939522,-3.5109295 0.1419513,-0.217658 1.6750254,-2.2333668 4.4951247,-2.2333668 0.6056589,0 1.239708,0.094634 1.8737572,0.2839026 h 0.018927 c 0.037854,0.00946 0.8706352,0.3122929 1.1734642,0.4637076 0.283903,0.1419513 0.785464,0.3596099 0.794927,0.3596099 h 0.01893 c 2.716002,1.3248787 5.06293,1.7507327 5.081857,1.7601967 0.671903,0.113561 1.277562,0.170341 1.816977,0.170341 1.078829,0 1.85483,-0.236585 2.261757,-0.69083 C 20.924954,8.3231195 20.8871,7.9161923 20.8871,7.9161923 V 7.8783387 C 20.906027,6.894143 20.101636,5.8342399 19.42027,5.1244834 18.663196,4.3295561 17.887196,3.7806777 17.877732,3.7806777 15.833634,2.2665305 13.647583,1.4999934 11.357436,1.4999934 9.0105075,1.5094568 7.4206529,2.3327744 7.401726,2.3422378 Z m 7.419322,2.6592211 c 0.283902,0 0.511024,0.2271221 0.511024,0.5110247 0,0.2839026 -0.227122,0.5110247 -0.511024,0.5110247 -0.283903,0 -0.511025,-0.2271221 -0.511025,-0.5110247 0,-0.2839026 0.227122,-0.5110247 0.511025,-0.5110247 z M 8.2155802,3.0614578 c 0.075707,0 0.1230244,0.018927 0.1419513,0.018927 L 11.584558,4.0835071 11.461533,4.3390195 9.9189959,3.8563851 8.2818241,3.3453604 c -0.00946,0 -0.00946,0 -0.018927,-0.00946 -0.00946,0 -0.02839,-0.00946 -0.047317,-0.00946 -0.018927,0 -0.047317,0 -0.066244,0.00946 -0.293366,0.075707 -1.0977567,0.35961 -1.3343422,0.7854639 -0.066244,0.1230245 -0.075707,0.2460489 -0.037854,0.3785368 0,0.00946 0.1703416,0.539415 0.5961955,1.0882934 L 9.5120688,5.4840933 10.941045,5.4178494 10.799094,5.7112154 7.2503113,5.881557 C 6.7203598,5.2380444 6.5121645,4.5945318 6.5121645,4.5945318 6.1809448,3.5535556 8.0830923,3.0709212 8.0830923,3.0709212 c 0.037854,0 0.094634,-0.00946 0.1324879,-0.00946 z M 19.439197,18.808589 c 2.176586,-0.946342 3.104002,-2.583514 3.104002,-2.583514 2.034635,-2.772782 1.343805,-5.696979 1.343805,-5.696979 -1.296488,2.8201 -2.479416,3.5961 -2.479416,3.5961 3.189173,-4.8547345 0.01893,-7.7883948 0.01893,-7.7883948 1.296489,2.7633183 -0.425854,6.1322968 -0.425854,6.1322968 -1.447903,3.047221 -3.501465,4.135514 -3.501465,4.135514 2.290147,0.425854 3.974636,-1.116683 3.974636,-1.116683 -3.283807,3.548782 -6.842053,3.378441 -6.842053,3.378441 1.495221,1.675025 3.738051,1.533074 3.738051,1.533074 -2.93366,0.690829 -5.687515,-0.283903 -7.949273,-2.167124 -0.4258537,-0.350146 -0.8327808,-0.728683 -1.2113177,-1.13561 0,0 -0.3406831,-0.35961 -0.4069271,-0.454244 l -0.00946,-0.0095 c -0.047317,1.750733 1.7791228,3.378441 1.7791228,3.378441 -2.2901475,-0.946342 -3.3405871,-2.999904 -3.3405871,-2.999904 0,0 -1.5425375,-2.630831 -0.4258539,-5.630735 1.1072201,-2.9620505 4.409953,-3.6244898 4.495124,-3.6434166 0.01893,0.00946 0.02839,0.018927 0.04732,0.018927 -0.01893,-0.00946 -0.02839,-0.018927 -0.04732,-0.02839 0,0 -0.511024,-0.2176586 -0.80439,-0.3596099 C 10.202899,7.2253627 9.3511906,6.9130698 9.3511906,6.9130698 8.707678,6.7238014 8.1020191,6.6386306 7.5531408,6.6386306 c -2.791709,0 -4.277466,2.1103429 -4.277466,2.1103429 -1.3154154,1.4762935 -1.6277083,3.3879045 -1.6277083,3.3879045 -0.3690734,1.82644 0.02839,3.747514 0.02839,3.747514 0,0 0.037854,0.151415 0.047317,0.217659 0.3028294,0.71922 0.6908297,1.428976 1.1450738,2.100879 2.4604893,3.671807 6.4540526,4.939906 6.4540526,4.939906 5.9146381,2.006245 9.9555191,-0.946342 9.9555191,-0.946342 3.719124,-2.555124 4.466734,-5.507711 4.466734,-5.507711 -3.009368,2.337465 -4.305856,2.119806 -4.305856,2.119806 z M 1.5060152,15.534246 Z M 1.3072834,14.947514 c 0,0 -0.2365855,-0.71922 -0.35960995,-1.816977 v 0.03785 c 0,-0.01893 0,-0.03785 -0.009463,-0.06624 -0.009463,-0.07571 -0.0189268,-0.160878 -0.0283903,-0.236586 0,0 -0.13248788,-1.287025 0.15141475,-2.697075 0,0 0.00946,-0.03785 0.018927,-0.09463 0.037854,-0.1798055 0.075707,-0.3690735 0.1230245,-0.5488785 0,-0.0095 0,-0.01893 0.00946,-0.02839 0.085171,-0.369073 0.2081952,-0.813854 0.3312197,-1.173464 0,0 1.305952,-4.2869294 5.7253693,-6.2458574 0,0 1.5236106,-0.8043907 3.8232216,-0.8611712 0,0 -0.312293,-0.30282945 -0.511025,-0.43531735 C 9.5026054,0.06155355 7.8938239,-0.17503195 6.9190916,0.83755405 6.6257256,1.1403834 6.3796767,1.4716032 6.1052375,1.7744326 5.7929446,2.1151157 5.4144078,2.3990183 4.9790905,2.5598965 4.6005536,2.7018478 4.2220168,2.6734575 3.8340166,2.7397015 3.436553,2.8059454 3.0296259,2.9478967 2.7078696,3.2034091 2.357723,3.4873117 2.2157717,3.8658485 2.1779181,4.3011658 2.1400644,4.6418489 2.1495278,4.9919955 2.130601,5.3326786 2.0832839,6.3358012 1.7615276,6.6197038 1.0423076,7.1780456 0.7394782,7.4051676 0.48396585,7.7079971 0.29469744,8.0297534 c -0.56780521,1.0031221 0.34068313,2.0440986 0.38800023,3.0566846 0.009463,0.208195 -0.009463,0.416391 -0.0851708,0.615122 -0.0757074,0.217659 -0.22712208,0.35961 -0.35014655,0.539415 -0.17034156,0.236586 -0.2839026,0.520489 -0.2365855,0.813855 0.0473171,0.293366 0.19873182,0.567805 0.34068313,0.823317 0.27443918,0.454244 0.61512232,0.861171 0.97473225,1.249172 0.018927,0.01893 0.037854,0.03785 0.056781,0.06624 0,-0.0095 -0.00946,-0.01893 -0.00946,-0.02839 l 0.02839,0.08517 c -0.02839,-0.104098 -0.05678,-0.198732 -0.094634,-0.302829 z M 0.90035634,11.550146 Z m 0.17034156,2.422635 c 0,0.01893 0.00946,0.03785 0.00946,0.04732 0,0.0095 0,0.01893 0.00946,0.03785 -0.00946,-0.02839 -0.00946,-0.05678 -0.018927,-0.08517 z": "ReactiveX", + "M 24,4.5167394 A 2.1169833,2.1169833 0 0 1 21.883017,6.6337226 2.1169833,2.1169833 0 0 1 19.766033,4.5167394 2.1169833,2.1169833 0 0 1 21.883017,2.3997561 2.1169833,2.1169833 0 0 1 24,4.5167394 Z M 1.1397405,7.7475086 H 6.8452135 C 7.4094414,7.7475086 7.8258416,7.9246762 7.9917247,8.7191088 8.1767914,9.6026898 8.1045702,10.217699 7.1058868,10.287663 L 5.3150273,10.419692 C 6.6330638,18.749954 14.342674,21.465019 18.537145,12.492666 19.232274,11.007618 19.459093,10.737917 20.219673,10.926369 21.251081,11.182529 21.392138,11.716288 20.896746,13.209235 17.273274,24.265846 5.0780515,25.375118 2.685725,10.604759 L 1.2311454,10.709706 C 0.04626669,10.79434 0,9.7956558 0,9.2404558 0,8.1413397 0.40737258,7.7475086 1.1397405,7.7475086 Z": "TUI", + "M9.818182 15.136364l5.318182-3.272728-5.318182-3zM12 6.278182c3.155455 0 5.721818 2.566363 5.721818 5.721818S15.155455 17.721818 12 17.721818 6.278182 15.155455 6.278182 12 8.844545 6.278182 12 6.278182m0-.550909C8.535 5.727273 5.727273 8.535 5.727273 12S8.535 18.272727 12 18.272727 18.272727 15.465 18.272727 12 15.465 5.727273 12 5.727273zM24 12a12 12 0 01-12 12A12 12 0 010 12 12 12 0 0112 0a12 12 0 0112 12": "YouTube Music" + }, "icon-size": { "M24 12.46a9.6 9.6 0 01-19.2 0h1.07a8.53 8.53 0 108.53-8.53V2.86a9.6 9.6 0 019.6 9.6zm-9.6-3.2a3.2 3.2 0 103.2 3.2 3.2 3.2 0 00-3.2-3.2zm-2 0l-.6-6.67-2.46 1.92-1.46-1.44a4.67 4.67 0 00-5.62-.37L.24 4a.54.54 0 00-.15.74.54.54 0 00.74.15l2-1.31a3.64 3.64 0 014.29.22l1.37 1.38L6.2 7z": "ABB RobotStudio", "M18.078,16.345c-0.209-0.261-8.709-11.13-9.005-11.496 c-0.279-0.366-0.209-0.47-0.157-0.523c0.105-0.122,0.261-0.105,0.871-0.105c0.366,0,3.989-0.017,4.372-0.017 c0.784,0,0.906,0.07,0.993,0.087c0.087,0.035,0.296,0.209,0.453,0.383c0.087,0.105,7.699,9.214,7.768,9.301 c0.087,0.105,0.209,0.279,0.314,0.435c0.087,0.157,0.105,0.366-0.035,0.453c-0.087,0.052-4.302,1.794-4.424,1.829 c-0.122,0.052-0.348,0.139-0.523,0.105C18.618,16.798,18.357,16.676,18.078,16.345 M22.38,16.136l0.314,0.052 c0,0,1.01,0.192,1.115,0.226C23.913,16.432,24,16.519,24,16.554c0,0.087-0.052,0.122-0.139,0.174 c-0.07,0.052-4.633,2.856-4.72,2.909c-0.087,0.052-0.192,0.105-0.435,0.139c-0.453,0.087-1.306-0.157-1.585-0.209 c-0.261-0.052-11.461-2.543-11.548-2.578c-0.105-0.035-0.174-0.035-0.174-0.139c-0.017-0.157,0.226-0.209,0.418-0.279 c0.192-0.07,5.452-1.968,5.643-2.055c0.192-0.087,0.418-0.105,0.54-0.105s0.853,0.105,1.184,0.157s1.271,0.192,1.271,0.192 l2.142,2.769c0.366,0.435,0.61,0.61,0.923,0.627c0.157,0.017,0.331-0.035,0.453-0.087C18.061,18.035,22.38,16.136,22.38,16.136 M10.153,9.343c0,0,1.846,2.369,1.864,2.386c0.017,0.035,0.035,0.07,0.07,0.087v0.035c-0.07,0.052-3.362,3.1-3.379,3.118 l-3.466,1.271c0,0-0.105,0.035-0.157,0.07c-0.052,0.035-0.122,0.105-0.105,0.261c0,0.052,0.017,0.853,0.035,1.045 c-0.017,0.017,0,0-0.017,0.017c0,0-4.267,1.359-4.302,1.359c-0.209,0.07-0.61,0.209-0.662,0.174 c-0.087-0.07,0.017-0.174,0.07-0.244c0.052-0.07,8.796-8.674,9.127-9.022C9.7,9.395,10.153,9.343,10.153,9.343": "Accusoft", diff --git a/.svglintrc.js b/.svglintrc.js index 7ef73c31..370525b7 100644 --- a/.svglintrc.js +++ b/.svglintrc.js @@ -3,12 +3,14 @@ const fs = require('fs'); const data = require("./_data/simple-icons.json"); const { htmlFriendlyToTitle } = require("./scripts/utils.js"); const getBounds = require("svg-path-bounding-box"); +const parsePath = require("svgpath/lib/path_parse"); const titleRegexp = /(.+) icon$/; const svgRegexp = /^.*<\/title><path d=".*"\/><\/svg>\r?\n?$/; const iconSize = 24; const iconFloatPrecision = 3; +const iconMaxFloatPrecision = 5; const iconTolerance = 0.001; // set env SI_UPDATE_IGNORE to recreate the ignore file @@ -30,6 +32,11 @@ function sortObjectByValue(obj) { .reduce((r, k) => Object.assign(r, { [k]: obj[k] }), {}); } +if (Array.prototype.flat === undefined) { + console.error(`Minimum NodeJS v11.15.0 is required, but you are running ${process.version}.`); + process.exit(1); +} + if (updateIgnoreFile) { process.on('exit', () => { // ensure object output order is consistent due to async svglint processing @@ -129,6 +136,38 @@ module.exports = { } } }, + function(reporter, $, ast) { + reporter.name = "icon-precision"; + + const iconPath = $.find("path").attr("d"); + if (!updateIgnoreFile && isIgnored(reporter.name, iconPath)) { + return; + } + + const { segments } = parsePath(iconPath); + const segmentParts = segments.flat().filter((num) => (typeof num === 'number')); + + const countDecimals = (num) => { + if (num && num % 1) { + let [base, op, trail] = num.toExponential().split(/e([+-])/); + let elen = parseInt(trail, 10); + let idx = base.indexOf('.'); + return idx == -1 ? elen : base.length - idx - 1 + (op === '+' ? -elen : elen); + } + return 0; + }; + const precisionArray = segmentParts.map(countDecimals); + const precisionMax = precisionArray && precisionArray.length > 0 ? + Math.max(...precisionArray) : + 0; + + if (precisionMax > iconMaxFloatPrecision) { + reporter.error(`Maximum precision should not be greater than ${iconMaxFloatPrecision}; it is currently ${precisionMax}`); + if (updateIgnoreFile) { + ignoreIcon(reporter.name, iconPath, $); + } + } + }, function(reporter, $, ast) { reporter.name = "extraneous"; diff --git a/.travis.yml b/.travis.yml index f5acf182..961eff44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ jobs: - stage: "Test" name: "Lint" language: node_js - node_js: 10 + node_js: 12 git: depth: 1 script: @@ -27,7 +27,7 @@ jobs: - jekyll build - name: "Test package" language: node_js - node_js: 10 + node_js: 12 git: depth: 1 script: @@ -51,7 +51,7 @@ jobs: cleanup: false - name: "NPM Package" language: node_js - node_js: 10 + node_js: 12 git: depth: 1 if: branch = master diff --git a/package-lock.json b/package-lock.json index 7718025f..61f7e63e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7014,9 +7014,9 @@ } }, "svgpath": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/svgpath/-/svgpath-2.2.3.tgz", - "integrity": "sha512-xA0glXYpJ9SYT4JeMp3c0psbqdZsG1c0ywGvdJUPY2FKEgwJV7NgkeYuuQiOxMp+XsK9nCqjm3KDw0LkM1YLXw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/svgpath/-/svgpath-2.3.0.tgz", + "integrity": "sha512-N/4UDu3Y2ICik0daMmFW1tplw0XPs1nVIEVYkTiQfj9/JQZeEtAKaSYwheCwje1I4pQ5r22fGpoaNIvGgsyJyg==", "dev": true }, "symbol-tree": { diff --git a/package.json b/package.json index 11c9822f..44bbda93 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "svg-path-bounding-box": "1.0.4", "svglint": "1.0.6", "svgo": "1.3.2", + "svgpath": "2.3.0", "uglify-js": "3.11.6" }, "scripts": {