We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm attempting an upgrade of XO from version 0.43 -> 0.47 and a particular lint rule is erroring wherever local code files are imported:
0.43
0.47
import { FOO } from "./constants"; => Missing file extension "ts" for "./constants" import/extensions import { logger } from "./logger"; => Missing file extension "ts" for "./logger" import/extensions etc...
Adding a .ts file extension to the import path causes a TypeScript (v4.5.4) compile error:
.ts
TS2691: An import path cannot end with a '.ts' extension. Consider importing './logger' instead.
Is there something obvious I'm missing or should this work out of the box with XO?
For context in case it matters, this is a monorepo where every package has a tsconfig.json that extends the root level one, eg:
tsconfig.json
./repo ├── packages │ ├── foo │ │ └── tsconfig.json | ├── bar │ │ └── tsconfig.json ├── tsconfig.json
Root level tsconfig.json:
{ "extends": "@tsconfig/node14/tsconfig.json", "compilerOptions": { "resolveJsonModule": true }, "exclude": [ "node_modules", "**/node_modules", "**/infra", "**/*.spec.ts", "**/*.test.ts", "**/jest.config.ts", "**/__mocks__" ] }
Package level tsconfig.json:
{ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./build", } }
The text was updated successfully, but these errors were encountered:
It's the TS error that is incorrect. It should say that you have to add a .js extension.
.js
Sorry, something went wrong.
You also have to ensure your project is native ESM. Make sure you read the release notes for all the XO versions you skipped.
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
For those using eslint-import-resolver-typescript, there’s an open issue for this problem:
eslint-import-resolver-typescript
No branches or pull requests
I'm attempting an upgrade of XO from version
0.43
->0.47
and a particular lint rule is erroring wherever local code files are imported:Adding a
.ts
file extension to the import path causes a TypeScript (v4.5.4) compile error:Is there something obvious I'm missing or should this work out of the box with XO?
For context in case it matters, this is a monorepo where every package has a
tsconfig.json
that extends the root level one, eg:Root level
tsconfig.json
:Package level
tsconfig.json
:The text was updated successfully, but these errors were encountered: