airbnb / airbnb/babel-plugin-inline-react-svg

Warning: Invalid attribute name: `'data-name'`

Open
#108 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
474
Forks
90
PR merge metrics
No merged PRs in 30d

Description

So everytime I add a new .svg file to the project I get this warning and I have to fiddle around with the width/height/viewbox of the component with random values until it works. I can't see any fix online and it just takes hours to fix any new .svg. At some point I gave up and started to use .svg in img tags but we have a requirement that the colors should be overriden by CSS so I really need to use it like a component.

```
import { ReactComponent as FileIcon } from '../../../public/icons/file.svg';

```

![image](https://user-images.githubusercontent.com/10156878/118502286-db8e2480-b729-11eb-93b9-c72c5c085107.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the warning by importing '../../../public/icons/file.svg' as a ReactComponent and rendering it with width and height props. Investigate how the Babel plugin processes that SVG and confirm that the warning is gone while the SVG remains usable as a component with CSS-overridable colors.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, react
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.