-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Describe the bug
The parser crashes when encountering unquoted attribute value containing at least one or more =
.
> html-eslint-minimal-repro@1.0.0 lint
> eslint
Oops! Something went wrong! :(
ESLint: 9.28.0
TypeError: Cannot read properties of undefined (reading 'value')
Occurred while linting /home/mathieu/dev/experiment/html-eslint-minimal-repro/index.js:5
Rule: "@html-eslint/attrs-newline"
at Object.fix (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/@html-eslint/eslint-plugin/lib/rules/attrs-newline.js:80:39)
at normalizeFixes (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/report-translator.js:205:25)
at /home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/report-translator.js:407:7
at FileContext.report (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/linter.js:1249:21)
at Tag (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/@html-eslint/eslint-plugin/lib/rules/attrs-newline.js:104:28)
at ruleErrorHandler (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/linter.js:1307:33)
at /home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/safe-emitter.js:45:46
at Array.forEach (<anonymous>)
at Object.emit (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/safe-emitter.js:45:26)
at #applySelector (/home/mathieu/dev/experiment/html-eslint-minimal-repro/node_modules/eslint/lib/linter/source-code-traverser.js:148:17)
To Reproduce
Link to minimal repro: https://github.com/Galimede/html-eslint-minimal-repro
Expected behavior
It shouldn't be mandatory to add quotes around an attribute value (in a template literal).
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested
Projects
Milestone
Relationships
Development
Select code repository
Activity
yeonjuan commentedon Jun 9, 2025
Hi. @Galimede
The
flat/recommend
contains settings for HTML files. (**/*.html)It contains
languageOptions
for html file so it was recognizing your JS code as HTML that was causing the problem.When parsing
JS or TS
that uses html in template literal, you need to apply the settings as follows.I think this should be added to our documentation. :) Thanks!
Galimede commentedon Jun 9, 2025
Hi,
Oh I didn't know about that, indeed it works fine now, thanks for the quick answer! 😄