WordPress / openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
https://openverse.org
MIT License
216 stars 176 forks source link

Add `svglint` and `svgo` to lint SVGs #633

Open dhruvkb opened 2 years ago

dhruvkb commented 2 years ago

Problem

The SVGs in the project are inconsistent and sometimes unformatted.

Description

Since the project contains a lot of SVG icons it might be a good idea to enforce

https://www.npmjs.com/package/svglint and https://github.com/svg/svgo are two tools that could be used for achieving consistency and optimisation in our SVGs.

Additional context

Simple Icons have a very comprehensive SVG linting solution for inspiration.

Configuration file is here:

https://github.com/simple-icons/simple-icons/blob/develop/svglint.config.mjs

Implementation

omkarg01 commented 2 years ago

I would like to work on this issue.

dhruvkb commented 2 years ago

@omkarg01 sure, please do!

sarayourfriend commented 2 years ago

@omkarg01 You're assigned! Please feel free to ask for assistance if you run into any roadblocks. Thanks in advance for the contribution!

sarayourfriend commented 1 month ago

Removing good first issue and help wanted, but I did add more specific instructions (to use svglint and svgo). This isn't a good first issue/help wanted under our more recent considerations of what is due to it needing a lot of changes to support a final PR. For example, it touches at least two new dependencies, is ambigious as to where it should go in the codebase (should it go into the monorepo packages or @openverse/eslint-plugin, despite the conflict in the name's scope, or a new package altogether?), and needs work to get it running in pre-commit and CI. Not to mention, we need to review the actual changes applied to SVGs in the course of implementing these tools to make sure they are really what we want.