Closed terrymun closed 1 year ago
Can you provide a minimal reproduction repo?
I get this error when no 'alt' tag is provided
Minimal reproduction:
<img alt="" src="https://via.placeholder.com/250x250" />
Workaround for now: move empty props to end:
<img src="https://via.placeholder.com/250x250" alt="" />
Initial checklist
Affected packages and versions
2.0.5
Link to runnable example
No response
Steps to reproduce
When using the
<img>
tag in a MDX file, certain props results in the error message "Parsing error: Expected value to be truthy" being encountered when linting, despite using the default setup for eslint:If an
<img>
tag only containssrc,
altand
title` attributes, then all is good:However, auditing any additional properties, such as
width
,height
,loading
,style
, and also events such asonClick
,onLoad
,onError
(the list is non-exhaustive) will all trigger the same parsing error message. Any props after the line break in the example below will trigger the error:Expected behavior
Valid uses of
<img>
props and handlers should not trigger eslint parsing error.Actual behavior
Valid uses of
<img>
props and handlers triggers eslint parsing error. Attributes that I have tested so far that will not trigger the error:src
srcSet
alt
title
Attributes that will trigger the error if one or more are present:
className
tabIndex
width
height
loading
style
onLoad
onError
onClick
Runtime
Node v16
Package manager
yarn v3
OS
macOS
Build and bundle tools
Next.js