-
-
Notifications
You must be signed in to change notification settings - Fork 792
Description
Environment information
CLI:
Version: 1.9.4
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
NO_COLOR: unset
TERM: "xterm-256color"
JS_RUNTIME_VERSION: "v20.18.2"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: "yarn/4.6.0"
Biome Configuration:
Error: Found an unknown key `includes`.
Error: Found an unknown key `assist`.
Error: Found an unknown key `noAdjacentSpacesInRegex`.
Error: Found an unknown key `includes`.
Error: Found an unknown key `includes`.
Error: Found an unknown key `includes`.
Status: Loaded with errors
Formatter disabled: false
Linter disabled: false
Organize imports disabled: false
VCS disabled: true
Workspace:
Open Documents: 0
Also Tried with current beta:
CLI:
Version: 2.0.0-beta.1
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
NO_COLOR: unset
TERM: xterm-256color
JS_RUNTIME_VERSION: v20.18.2
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: yarn/4.6.0
Biome Configuration:
Status: Loaded successfully
Path: /home/justin.hanselman/test-yarn/biome.json
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: false
Workspace:
Open Documents: 0
What happened?
- In a typescript project that is CommonJS (I.e. package.json that does not have "type": "module")
- With a tsconfig that uses
nodenextformoduleandmoduleResolution - And an imported package that is ESM only (like
chalk) - Try importing the chalk type in a .ts file:
import type { ChalkInstance } from "chalk" with { "resolution-mode": "import" };
If you remove the import attribute, typescript will refuse to compile since it can't find a "require" version of types, so you have to have that to import the type.
Expected result
When I ran biome format and biome lint, I expected them to work. However, both of them fail at the unskippable syntax/correctness/noTypeOnlyImportAttributes. They also don't let me use the biome-ignore syntax, so I am effectively unable to lint and format, because build support requires that I have this.
I would have expected Biome not to care if I added type-only imports with a resolution-mode import attribute.
Note: I would be willing to contribute a fix if someone can confirm that we are fine with letting import type with "resolution-mode" pass. If there are more exotic use cases, let me know.
Note 2: this was previously brought up in #2115 - but the fix that was supplied seems to only do this for .cts files which isn't guaranteed, since typescript can require this if it finds a module mismatch.
Code of Conduct
- I agree to follow Biome's Code of Conduct