eslint-plugin-jsx-img-no-referrer

Using img tag with external source must have referrerPolicy='no-referrer'

Usage no npm install needed!

<script type="module">
  import eslintPluginJsxImgNoReferrer from 'https://cdn.skypack.dev/eslint-plugin-jsx-img-no-referrer';
</script>

README

eslint-plugin-jsx-img-no-referrer

Node.js CI

Using img tag with external source must have referrerPolicy="no-referrer"

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-jsx-img-no-referrer:

$ npm install eslint-plugin-jsx-img-no-referrer --save-dev

Usage

Add jsx-img-no-referrer to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
  "plugins": ["jsx-img-no-referrer"]
}

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

{
  "rules": {
    "jsx-img-no-referrer/jsx-img-no-referrer": "error"
  }
}

Custom image components

{
  "settings": {
    "react": {
      "version": "detect"
    },
    "imageComponents": [
      "Image",
      { "name": "Gravatar", "imageAttribute": "imageSrc" }
    ]
  }
}

License

MIT