Lint rules
Every rule the icon lint enforces, generated from the script itself, with how baselines and exceptions work.
Last updated
uv run scripts/lint.py checks every source icon. The table below is read from tooling/generator/scripts/lint.py when this site is built, so it always matches the code.
| Rule | What it checks |
|---|---|
| stroke | line/detail groups must use stroke-width 16 with round caps and joins |
| role | every shape sits in a <g data-role> group with a known role |
| meta | data-category from the category list and at least 3 data-tags |
| no-fill | has a closed shape but no area/detail/hole/dotcut, so the fill weight is just the outline (letters, numbers and symbols that should stay outlined say so with data-fill="outline") |
| live-area | geometry leaves the 32..224 live area |
| small | larger side spans less than 144 units, so it looks smaller than its neighbours (symbols meant to sit small, such as carets, say so with data-size="symbol") |
| off-grid | straight-segment endpoints, circle centres or rect corners are not whole numbers |
| detail | more than 8 stroked elements; simplify it, or check it at 16 px and mark it data-detail="reviewed" if it still reads clearly |
| extremes | a curve bulges past its ends with no anchor at its top, bottom, left or right extreme |
| tessellated | a path is more than 40 straight segments; draw curves with arcs and cubics |
| keyline | a container is bigger than its keyline: circle 192, square 176, other rectangle 192 on the long side |
| badge | a <base>-<modifier> icon (plus, minus, x, check, ...) is its base icon unchanged plus the standard badge group from BADGES, or is marked data-badge="custom" when the modifier is drawn into the icon |
| slash | a -slash icon is its base icon unchanged plus one slash group with M48 48 L208 208 (or the mirrored M208 48 L48 208); no other icon has a slash group |
| name | names are lowercase ascii words joined by hyphens, at most 40 characters, and never end in a style word (-fill, -filled, -outlined, -duotone, -bold, -thin, -regular): weights are not part of the name |
| root | the <svg> root has xmlns, viewBox="0 0 256 256" and, if present, width and height of 256 |
| svg-safe | no scripts, event handlers, external references, raster images, filters, gradients, styles, ids or transforms in a source icon |
| tags | tags are lowercase, unique, at most 12, with no double spaces or markup characters |
| dup | the same drawing as another icon. Reuse the existing icon and list the new name in aliases.json, or, if the concept really is different, record the pair in scripts/duplicates-baseline.json with a reason |
| alias | aliases.json maps a retired name to an icon that exists, and the retired name is no longer an icon |
Running it
cd tooling/generator
uv run scripts/lint.py # everything, as CI runs it
uv run scripts/lint.py house bell # only these icons
uv run scripts/lint.py --all # also the problems recorded in the baseline
uv run scripts/lint.py --rules # this table, as JSON
A rule is checked on the icon’s source file. dup and alias look at the whole set, so they run only when no names are given (icon.py check <name> filters them to your icon).
Baselines
The set predates some rules. Old problems are recorded in scripts/lint-baseline.json so a rule can be switched on without fixing everything first. The baseline only ever shrinks: a new problem fails CI, and --update-baseline refuses to add one. Fix the icon instead.
| File | Records |
|---|---|
scripts/lint-baseline.json |
icons with a known problem in a rule, per rule |
scripts/duplicates-baseline.json |
pairs of identical drawings, each with a status and reason |
scripts/audit-baseline.json |
reviewed size and centring outliers for audit.py --check |
aliases.json |
retired icon names and the icon that replaced each |
Switches on an icon
A few rules can be answered by a decision on the icon, written on the <svg> root:
| Attribute | Meaning | Rule it answers |
|---|---|---|
data-fill="outline" |
the fill weight stays outlined (letters, numbers, symbols) | no-fill |
data-size="symbol" |
a small mark, meant to be small | small |
data-detail="reviewed" |
more than eight strokes, checked at 16 px | detail |
data-badge="custom" |
the modifier is drawn into the icon, not the standard badge | badge |
Use them after looking at the icon at 16 px, never to make the lint go quiet.
Adding a rule
- Add the check to
lint.pyand a line toRULES. - Run it on the whole set. If it fails on existing icons, either fix them or, if that is a large job, adopt the rule with a baseline entry per icon and file an issue to clear it.
- Add a test in
tests/tooling.test.mjs. - Say what it enforces in the design specification.
The consistency audit
uv run scripts/audit.py --check compares each icon with the whole set for stroke, size, centring and corners, and fails on outliers that are not in audit-baseline.json. uv run scripts/audit.py report.md writes the full list.