ampproject / ampproject/amp-toolbox
[linter] Misleading runtime preload recommendation when using ESM
- Dominant language
- HTML
- Stars
- 459
- Forks
- 242
- PR merge metrics
- No merged PRs in 30d
Description
The linter currently doesn't use a separate recommendation for ESM preloads:
https://github.com/ampproject/amp-toolbox/blob/153d76b722906aec1cb4a6c65d88f0c4d418630d/packages/linter/src/rules/RuntimeIsPreloaded.ts#L13
This is misleading, and might even lead to frustration if users blindly apply the recommendation and it doesn't solve the issue.
The linter should properly differentiate between:
1. `.js` with `rel=preload`
2. `.mjs` with `rel=preload`
3. `.mjs` with `rel=modulepreload`
The recommendation should then be generated accordingly so that applying the recommendation verbatim will actually fix the shown issue.
Contributor guide
Research direction
Start at packages/linter/src/rules/RuntimeIsPreloaded.ts around line 13 and trace how the preload recommendation is generated. Verify the three listed .js/.mjs combinations, then confirm that each recommendation matches its preload type and fixes the reported issue when applied verbatim.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100