Using img tag with external source must have referrerPolicy="no-referrer"
You'll first need to install ESLint:
Next, install eslint-plugin-jsx-img-no-referrer
:
$ npm install eslint-plugin-jsx-img-no-referrer --save-dev
$ yarn add eslint-plugin-jsx-img-no-referrer --dev
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"
}
}
If you have custom image components, you can define them under settings section.
{
"settings": {
"imageComponents": [
"Avatar",
{ "name": "Profile", "imageAttribute": "imageSrc" }
]
}
}
MIT