Skip to content

react/no-unknown-property stopped supporting imageSrcSet and imagSizes on <link /> tag #3401

@terrymun

Description

@terrymun

Version 7.31.6 will cause a linting error to be thrown when imageSrcSet or imageSizes are being used in a JSX <link /> element, even though this attribute is perfectly valid: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-imagesrcset

Combing through the rules reveal that these attributes are missing: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/no-unknown-property.js

It is also available in the LinkHTMLAttributes type:

interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
  as?: string | undefined;
  crossOrigin?: string | undefined;
  href?: string | undefined;
  hrefLang?: string | undefined;
  integrity?: string | undefined;
  media?: string | undefined;
  imageSrcSet?: string | undefined;
  imageSizes?: string | undefined;
  referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
  rel?: string | undefined;
  sizes?: string | undefined;
  type?: string | undefined;
  charSet?: string | undefined;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions