Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 Rome check: Cannot find ts files imported as js files #1632

Closed
1 task done
Conaclos opened this issue Jul 10, 2021 · 3 comments
Closed
1 task done

🐛 Rome check: Cannot find ts files imported as js files #1632

Conaclos opened this issue Jul 10, 2021 · 3 comments
Assignees
Labels
S-To triage Status: user report of a possible bug that needs to be triaged

Comments

@Conaclos
Copy link
Contributor

Conaclos commented Jul 10, 2021

What happened?

  1. create two files a.ts and b.ts in the same folder
  2. import b.ts as a js file in b.ts
  3. run rome linter rome check.

Rome check outputs Cannot find ./a.js from b.ts

@filename a.ts
export function f(){}

@filename b.ts
import {f} from "./a.js"

Expected result

Rome should identify js imports as ts imports if the js file does not exist.

The use of js extensions in imports is supported by TypeScript and enables direct execution of esm files in modern versions of nodejs.

Rome version

10.0.0

Configuration file of your project

name: "xxx"
root: true

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@Conaclos Conaclos added the S-To triage Status: user report of a possible bug that needs to be triaged label Jul 10, 2021
@Conaclos Conaclos changed the title 🐛 Cannot find ts files imported as js files 🐛 Rome check: Cannot find ts files imported as js files Jul 10, 2021
@ematipico ematipico assigned ematipico and unassigned ematipico Jul 12, 2021
@ematipico
Copy link
Contributor

Is it actually a bug? I'd say it's a feature request. Rome doesn't fully support ESM at the moment so I think it's expected as behaviour.

@Conaclos
Copy link
Contributor Author

Conaclos commented Jul 12, 2021

@ematipico
This makes sense. Should I close this issue and open a new one?

Is there any way to suppress a lint rule for an entire project? According to the docs a rule can be disabled for a given file.

@ematipico
Copy link
Contributor

ematipico commented Jul 12, 2021

Rome diagnostic (not a lint rule) should show you the type of error you're getting, called category.

Then add a suppression

If you're not happy with the result, you could use the latest nightly where we disabled this kind of errors.

About the issue, yes it would make sense to close it. About the feature, usually we tend to use a discussion to talk about it then open an actionable issue once the requirements are solid.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-To triage Status: user report of a possible bug that needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants