0.0.4 • Published 4 years ago

eslint-plugin-react-svg v0.0.4

Weekly downloads
487
License
MIT
Repository
github
Last release
4 years ago

eslint-plugin-react-svg Build Status

SVG specific rules for react

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-react-svg:

$ npm install eslint-plugin-react-svg --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-react-svg globally.

Configuration

Using the preset

  "extends": [
    "eslint:recommended",
    "plugin:react-svg/recommended"
  ]

Using manual configuration

Add react-svg to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "react-svg"
    ]
}

Enable JSX support

{
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    }
  }
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "react-svg/no-unused-ids-in-svg": 2,
        "react-svg/no-unused-empty-tag-in-svg": 2,
        "react-svg/no-metadata-in-svg": 2
    }
}

Supported Rules