icons: Do not allow fill property via the style tag in svgs.

We already had a lint rule for this, but we did not disallow setting it
from the style side. This was breaking the icons changed in this commit
in our new astro help center.
This commit is contained in:
Shubham Padia
2025-07-22 14:49:23 +00:00
committed by Tim Abbott
parent 81464c2812
commit d24f2972d4
5 changed files with 19 additions and 14 deletions

View File

@@ -980,6 +980,11 @@ svg_rules = RuleList(
"description": "System icons ignore fill values, so do not include the fill property.",
"include_only": {"web/shared/icons/", "web/images/icons/"},
},
{
"pattern": "fill:",
"description": "System icons ignore fill values, so do not include the fill property.",
"include_only": {"web/shared/icons/", "web/images/icons/"},
},
{
"pattern": r"fill-rule=(['\"])(.*?)\1",
"description": "System icons ignore fill-rule values, so do not include the fill-rule property.",

View File

@@ -7,27 +7,27 @@
<defs
id="defs5" />
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#000000;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="m 12,4 c -4.9587181,0 -9,4.0412819 -9,9 0,4.958718 4.0412819,9 9,9 4.958718,0 9,-4.041282 9,-9 0,-4.9587181 -4.041282,-9 -9,-9 z m 0,2 c 3.877838,0 7,3.1221621 7,7 0,3.877838 -3.122162,7 -7,7 C 8.1221621,20 5,16.877838 5,13 5,9.1221621 8.1221621,6 12,6 Z"
id="circle1" />
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#000000;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="m 12,8 a 1,1 0 0 0 -1,1 v 4 a 1.0001,1.0001 0 0 0 0.292969,0.707031 l 2,2 a 1,1 0 0 0 1.414062,0 1,1 0 0 0 0,-1.414062 L 13,12.585938 V 9 A 1,1 0 0 0 12,8 Z"
id="path1" />
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#000000;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 5,2 A 1,1 0 0 0 4.2929687,2.2929688 l -3,2.9999999 a 1,1 0 0 0 0,1.4140625 1,1 0 0 0 1.4140626,0 L 5.7070312,3.7070313 a 1,1 0 0 0 0,-1.4140625 A 1,1 0 0 0 5,2 Z"
id="path2" />
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#000000;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="m 18.292969,2.2929688 a 1,1 0 0 0 0,1.4140625 l 3,2.9999999 a 1,1 0 0 0 1.414062,0 1,1 0 0 0 0,-1.4140625 l -3,-2.9999999 a 1,1 0 0 0 -1.414062,0 z"
id="path3" />
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#000000;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="M 5.6855469,17.980469 3.3046875,20.28125 a 1,1 0 0 0 -0.023437,1.414062 1,1 0 0 0 1.4140625,0.02344 l 2.3789062,-2.298828 a 1,1 0 0 0 0.025391,-1.414063 1,1 0 0 0 -1.4140625,-0.02539 z"
id="path4" />
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#000000;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;stroke:none;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
d="m 18.341797,17.958984 a 1,1 0 0 0 -1.414063,0.0078 1,1 0 0 0 0.0098,1.414062 l 2.359375,2.330078 a 1,1 0 0 0 1.414062,-0.0078 1,1 0 0 0 -0.0078,-1.414063 z"
id="path5" />
</svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -1,6 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
id="path3"
style="baseline-shift:baseline;display:inline;overflow:visible;opacity:1;fill:#000000;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
style="baseline-shift:baseline;display:inline;overflow:visible;opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="m 4,8 a 1,1 0 0 0 -1,1 1,1 0 0 0 1,1 h 10.5 c 2.497126,0 4.5,2.002874 4.5,4.5 0,2.497126 -2.002874,4.5 -4.5,4.5 H 11 a 1,1 0 0 0 -1,1 1,1 0 0 0 1,1 h 3.5 C 18.078006,21 21,18.078006 21,14.5 21,10.921994 18.078006,8 14.5,8 Z M 9,3 A 1,1 0 0 0 8.2929688,3.2929688 L 3.3027344,8.2832031 A 1,1 0 0 1 4,8 H 6.4140625 L 9.7070313,4.7070312 a 1,1 0 0 0 0,-1.4140624 A 1,1 0 0 0 9,3 Z M 3.0234375,8.7949219 A 1.0001,1.0001 0 0 0 3,9 1,1 0 0 1 3.0234375,8.7949219 Z M 3,9 A 1.0001,1.0001 0 0 0 3.0234375,9.2050781 1,1 0 0 1 3,9 Z m 0.3027344,0.7167969 4.9902344,4.9902341 a 1,1 0 0 0 1.4140625,0 1,1 0 0 0 0,-1.414062 L 6.4140625,10 H 4 A 1,1 0 0 1 3.3027344,9.7167969 Z" />
</svg>

Before

Width:  |  Height:  |  Size: 1013 B

After

Width:  |  Height:  |  Size: 1000 B

View File

@@ -12,27 +12,27 @@
<g
id="users (1) 1">
<path
style="color:#000000;fill:#7575bd;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
style="color:#000000;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
d="m 11.333984,11.333984 c -0.883795,0 -1.7324971,0.349798 -2.3574215,0.97461 a 0.66673168,0.66673168 0 0 0 0,0.002 C 8.3516133,12.935496 8,13.782177 8,14.666016 V 16 A 0.66666502,0.66666502 0 0 0 8.6660156,16.666016 0.66666502,0.66666502 0 0 0 9.3339844,16 v -1.333984 c 0,-0.53076 0.2106876,-1.038813 0.5859375,-1.414063 0.3752541,-0.375187 0.8834591,-0.585937 1.4140621,-0.585937 h 5.332032 c 0.530728,0 1.038791,0.210741 1.414062,0.585937 0.375234,0.375234 0.585938,0.883271 0.585938,1.414063 V 16 A 0.66666502,0.66666502 0 0 0 19.333984,16.666016 0.66666502,0.66666502 0 0 0 20,16 v -1.333984 c 0,-0.883808 -0.351598,-1.730504 -0.976563,-2.355469 a 0.66673168,0.66673168 0 0 0 0,-0.002 c -0.624928,-0.624804 -1.473551,-0.97461 -2.357421,-0.97461 z"
id="Vector" />
<path
style="color:#000000;fill:#7575bd;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
style="color:#000000;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
d="m 14,3.3339844 c -1.833006,0 -3.333984,1.4989829 -3.333984,3.3320312 C 10.666016,8.4990639 12.166997,10 14,10 15.833079,10 17.333984,8.4990639 17.333984,6.6660156 17.333984,4.8329673 15.833082,3.3339844 14,3.3339844 Z m 0,1.3320312 c 1.112516,0 2,0.8875313 2,2 0,1.1124688 -0.887481,2 -2,2 -1.112394,0 -2,-0.8875312 -2,-2 0,-1.1124687 0.887609,-2 2,-2 z"
id="Vector_2" />
<path
style="color:#000000;fill:#7575bd;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
style="color:#000000;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
d="M 2.5,11.439453 C 1.7849312,11.624067 1.1516189,12.041488 0.69921875,12.625 0.24679543,13.208658 5.5118671e-4,13.9276 0,14.666016 V 16 A 0.66666502,0.66666502 0 0 0 0.66601562,16.666016 0.66666502,0.66666502 0 0 0 1.3339844,16 v -1.333984 c 3.308e-4,-0.443184 0.1464008,-0.872315 0.4179687,-1.222657 0.2715791,-0.350286 0.6529213,-0.602104 1.0820313,-0.71289 A 0.66666502,0.66666502 0 0 0 3.3125,11.919922 0.66666502,0.66666502 0 0 0 2.5,11.439453 Z"
id="Vector_3" />
<path
style="color:#000000;fill:#7575bd;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
style="color:#000000;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
d="M 5.1679687,3.4394531 C 4.4510548,3.6230029 3.8150956,4.0404152 3.3613281,4.625 2.9075561,5.2095907 2.6621094,5.92989 2.6621094,6.6699219 c 0,0.7400318 0.2454467,1.458378 0.6992187,2.0429687 0.4537675,0.5845849 1.0897267,1.0019971 1.8066406,1.1855469 A 0.66666502,0.66666502 0 0 0 5.9785156,9.4179688 0.66666502,0.66666502 0 0 0 5.4980469,8.6074219 C 5.0677419,8.4972519 4.6864343,8.2473786 4.4140625,7.8964844 4.1416953,7.545596 3.9941406,7.1141088 3.9941406,6.6699219 c 0,-0.444187 0.1475547,-0.8756741 0.4199219,-1.2265625 C 4.6864343,5.0924651 5.0677419,4.8425918 5.4980469,4.7324219 a 0.66666502,0.66666502 0 0 0 0.4804687,-0.8125 0.66666502,0.66666502 0 0 0 -0.8105469,-0.4804688 z"
id="Vector_4" />
<path
style="color:#000000;fill:#7575bd;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
style="color:#000000;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
d="M 6.5,11.439453 C 5.7849312,11.624067 5.1516189,12.041488 4.6992187,12.625 4.2467879,13.208661 4.0005499,13.927603 4,14.666016 V 16 A 0.66666502,0.66666502 0 0 0 4.6660156,16.666016 0.66666502,0.66666502 0 0 0 5.3339844,16 v -1.333984 c 3.3e-4,-0.443187 0.1464003,-0.872318 0.4179687,-1.222657 0.2715791,-0.350286 0.6529213,-0.602104 1.0820313,-0.71289 A 0.66666502,0.66666502 0 0 0 7.3125,11.919922 0.66666502,0.66666502 0 0 0 6.5,11.439453 Z"
id="Vector_5" />
<path
style="color:#000000;fill:#7575bd;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
style="color:#000000;stroke-linecap:round;stroke-linejoin:round;-inkscape-stroke:none"
d="M 9.1679688,3.4394531 C 8.4510548,3.6230029 7.8150956,4.0404152 7.3613281,4.625 6.9075561,5.2095907 6.6621094,5.92989 6.6621094,6.6699219 c 0,0.7400318 0.2454467,1.458378 0.6992187,2.0429687 0.4537675,0.5845849 1.0897267,1.0019971 1.8066407,1.1855469 A 0.66666502,0.66666502 0 0 0 9.9785156,9.4179688 0.66666502,0.66666502 0 0 0 9.4980469,8.6074219 C 9.0677419,8.4972519 8.6864343,8.2473786 8.4140625,7.8964844 8.1416953,7.545596 7.9941406,7.1141088 7.9941406,6.6699219 c 0,-0.444187 0.1475547,-0.8756741 0.4199219,-1.2265625 C 8.6864343,5.0924651 9.0677419,4.8425918 9.4980469,4.7324219 a 0.66666502,0.66666502 0 0 0 0.4804687,-0.8125 0.66666502,0.66666502 0 0 0 -0.8105468,-0.4804688 z"
id="Vector_6" />
</g>

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -10,5 +10,5 @@
<path
id="path21"
d="M 6 1.3339844 C 4.1590518 1.3339844 2.6660156 2.8250675 2.6660156 4.6660156 C 2.6660156 6.5069638 4.1590518 8 6 8 C 7.8409482 8 9.3339844 6.5069638 9.3339844 4.6660156 C 9.3339844 2.8250675 7.8409482 1.3339844 6 1.3339844 z M 10.632812 1.4199219 C 10.348988 1.4343809 10.095747 1.6320647 10.021484 1.921875 C 9.9301945 2.2785546 10.145253 2.641102 10.501953 2.7324219 C 10.932153 2.8425718 11.313638 3.0925497 11.585938 3.4433594 C 11.858237 3.794159 12.005859 4.2258423 12.005859 4.6699219 C 12.005859 5.1140114 11.858237 5.5456747 11.585938 5.8964844 C 11.313638 6.247284 10.932153 6.497272 10.501953 6.6074219 C 10.145253 6.6987518 9.9301945 7.0612891 10.021484 7.4179688 C 10.112884 7.7746584 10.475332 7.9897574 10.832031 7.8984375 C 11.549031 7.7148477 12.184872 7.2995132 12.638672 6.7148438 C 13.092471 6.1301643 13.337891 5.4100611 13.337891 4.6699219 C 13.337891 3.9297826 13.092471 3.2116325 12.638672 2.6269531 C 12.184872 2.0422837 11.549031 1.6249961 10.832031 1.4414062 C 10.76515 1.4242838 10.698311 1.4165852 10.632812 1.4199219 z M 6 2.6660156 C 7.1045689 2.6660156 8 3.5614467 8 4.6660156 C 8 5.7705845 7.1045689 6.6660156 6 6.6660156 C 4.8954311 6.6660156 4 5.7705845 4 4.6660156 C 4 3.5614467 4.8954311 2.6660156 6 2.6660156 z M 3.3339844 9.3339844 C 2.4499353 9.3339844 1.6016809 9.6854075 0.9765625 10.310547 C 0.35144213 10.935646 9.7474709e-18 11.782017 0 12.666016 L 0 14 C 7.4014794e-17 14.3682 0.29782599 14.666016 0.66601562 14.666016 C 1.0342083 14.666016 1.3339844 14.3682 1.3339844 14 L 1.3339844 12.666016 C 1.3339844 12.135616 1.5448523 11.627053 1.9199219 11.251953 C 2.2949915 10.876854 2.8035549 10.666016 3.3339844 10.666016 L 8.6660156 10.666016 C 9.1964451 10.666016 9.7049885 10.876854 10.080078 11.251953 C 10.455178 11.627053 10.666016 12.135616 10.666016 12.666016 L 10.666016 14 C 10.666016 14.3682 10.965785 14.666016 11.333984 14.666016 C 11.702184 14.666016 12 14.3682 12 14 L 12 12.666016 C 12 11.782017 11.648537 10.935646 11.023438 10.310547 C 10.398338 9.6854075 9.5500647 9.3339844 8.6660156 9.3339844 L 3.3339844 9.3339844 z M 13.300781 9.4199219 C 13.01692 9.4338032 12.762331 9.6302659 12.6875 9.9199219 C 12.5955 10.276382 12.809516 10.640422 13.166016 10.732422 C 13.595015 10.843222 13.976547 11.09306 14.248047 11.443359 C 14.519447 11.793459 14.665616 12.223016 14.666016 12.666016 L 14.666016 14 C 14.666016 14.3682 14.965785 14.666016 15.333984 14.666016 C 15.702184 14.666016 16 14.3682 16 14 L 16 12.666016 C 15.9994 11.927516 15.753281 11.210653 15.300781 10.626953 C 14.848282 10.043254 14.215099 9.6260461 13.5 9.4414062 C 13.433156 9.4241469 13.366288 9.4167185 13.300781 9.4199219 z "
style="fill:#262626;fill-opacity:1;opacity:0.99999999" />
style="fill-opacity:1;opacity:0.99999999" />
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB