ampproject / ampproject/amphtml

Start using extension in imports

Open
#36,849 1 comment 0 reactions 0 assignees View on GitHub
Stale Type: Feature Request
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Part of being able to build ESM variants involves being strict about the import path.
I think that you should start using the full path when importing things.

That would mean setting `import/extensions` to always error in `.js` files

### Alternatives Considered

...

### Additional Context

Part of the reason extension-less is this is working right now is b/c you are compiling from esm to commonjs

https://nodejs.org/dist/latest-v17.x/docs/api/esm.html#mandatory-file-extensions

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the import paths in JavaScript files and the existing `import/extensions` lint configuration. Determine the scope of enforcing full extensions for ESM-compatible imports, then verify that the lint rule passes while preserving the CommonJS compilation path.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.