Disabling jsx-a11y/alt-text for DatoCMS react Image component

Does anyone know how to disable this in the eslintrc.json file for entire Next.js project?

I have added this, but it does not work:

{
  "extends": ["next/core-web-vitals", "prettier"],
  "rules": {
    "prefer-const": "error",
    "indent": ["error", 2],
    "jsx-a11y/img-has-alt": "off"
  }
}

In case someone needs this. Solution is:

"jsx-a11y/alt-text": [0]

1 Like
// react-datocms - Image component has no alt property
    "jsx-a11y/alt-text": [ 2, {
      "elements": [ "img", "object", "area", "input[type=\"image\"]" ],
      "object": ["Object"],
      "area": ["Area"],
      "input[type=\"image\"]": ["InputImage"]
    }]

we did this so that it will still enforce it for other items vs disabling it completely. i believe in their docs its just says to remove "img": ["Image"], from the options above.

1 Like