Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdAttributePlugin throwing false error for duplicate IDs #3560

Closed
xplosionmind opened this issue Nov 25, 2024 · 3 comments
Closed

IdAttributePlugin throwing false error for duplicate IDs #3560

xplosionmind opened this issue Nov 25, 2024 · 3 comments

Comments

@xplosionmind
Copy link

Operating system

Fedora 41

Eleventy

3.0.0

Describe the bug

In some pages the IdAttribute plugin gives an error caused by duplicate IDs in a page, but that page does not have headings or might not have duplicates at all…

Reproduction steps

  1. Run bun run start or npm run start in the linked branch of the repository below
  2. See that the page that is reported to have a duplicate ID actually does not have duplicates.

Expected behavior

Plugin should not be throwing errors if there actually are not any.

Reproduction URL

https://github.com/xplosionmind/tommi.space/tree/idattr-bug

Screenshots

No response

@zachleat zachleat added on-hold needs-test-case Please submit a reproducible test case showcasing the issue! labels Dec 10, 2024
@zachleat
Copy link
Member

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: tommi.space@2.0.0
npm error Found: @11ty/eleventy@3.0.0
npm error node_modules/@11ty/eleventy
npm error   @11ty/eleventy@"^3.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @11ty/eleventy@"^1.0.0 || ^2.0.0-canary.12 || ^2.0.0-beta.1" from eleventy-sass@2.2.6
npm error node_modules/eleventy-sass
npm error   eleventy-sass@"^2.2.6" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /Users/zachleat/.npm/_logs/2024-12-10T23_02_22_805Z-eresolve-report.txt
npm error A complete log of this run can be found in: /Users/zachleat/.npm/_logs/2024-12-10T23_02_22_805Z-debug-0.log

It doesn’t look like I can npm install on your project—is there something in progress on that branch?

@zachleat zachleat added education and removed needs-test-case Please submit a reproducible test case showcasing the issue! on-hold needs-triage labels Dec 10, 2024
zachleat added a commit to 11ty/11ty-website that referenced this issue Dec 10, 2024
@zachleat
Copy link
Member

<dl id='tags' class='flex gap-2xs'><div id='tags'> is the culprit here: https://github.com/xplosionmind/tommi.space/blob/idattr-bug/layouts/page.liquid#L14

You can use the checkDuplicates option in the IdAttribute plugin to bypass this error (suspiciously missing from the docs 😭 update is deploying now): https://www.11ty.dev/docs/plugins/id-attribute/#with-options

I think we can do better on the error messaging here though, here’s what it’ll look like in v3.0.1-alpha.1:

Error: You have more than one HTML `id` attribute using the same value (id="tags") in your template (your-file-name.html). You can disable this error in the IdAttribute plugin by using the `checkDuplicates: false` option.

@xplosionmind
Copy link
Author

Thank you so much for addressing and trying to replicate this issue, @zachleat!

It doesn’t look like I can npm install on your project

You can remove eleventy-sass from the package.json dependencies. I never got this error because I use bun instead of npm.


Thanks also for pointing out the error! Now fixed! 💕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants