JoshuaKGoldberg / JoshuaKGoldberg/create-typescript-app

🚀 Feature: Correct extension-less imports as part of hydration (lint --fix)

Open
#557 0 comments 0 reactions 0 assignees View on GitHub
status: blocked type: feature
Dominant language
TypeScript
Stars
1.4k
Forks
89
Avg merge
1m
Merged PRs (30d)
3

Description

### Bug Report Checklist

- [X] I have tried restarting my IDE and the issue persists.
- [X] I have pulled the latest `main` branch of the repository.
- [X] I have [searched for related issues](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aissue) and found none that matched my issue.

### Overview

Right now, this template uses [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import)'s [`import/extensions` rule](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/extensions.md) to make sure that relative file extensions include a `.js`:

```js
import { stuff } from "./file.js";
```

However, many repositories not using this template use extension-less imports:

```js
import { stuff } from "./file";
```

...and pending https://github.com/import-js/eslint-plugin-import/issues/2227, there isn't an auto-fixer available in the lint rule. But I would _really_ like that auto-fixer to be enabled!

Filing this tracking issue on this repo. The right way to solve this IMO is with the lint rule fixer, so marking it as blocked on that feature request to `eslint-plugin-import`.

### Additional Info

Hydration is explained here: https://github.com/JoshuaKGoldberg/template-typescript-node-package#repository-hydration

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.