-
Notifications
You must be signed in to change notification settings - Fork 147
Open
Labels
Description
Your Environment
- Prettier version: 3.6.2
- node version: 22.15.0
- package manager: pnpm@10
- IDE: VScode
Describe the bug
Using export import xyz =
syntax (microsoft/TypeScript#57704) causes Prettier to crash due to a parsing error stemming from Babel. Disabling the importing sorting plugin resolves the error.
To Reproduce
import type { jest as jestGlobals } from '@jest/globals';
declare global {
const jest: typeof jestGlobals;
export import jest = jestGlobals;
}
Expected behavior
It formats without error.
Screenshots, code sample, etc
N/A
Configuration File (cat .prettierrc, prettier.config.js, .prettier.js)
export default {
plugins: ["@trivago/prettier-plugin-sort-imports"],
};
Error log
types/jest.d.ts
[error] types/jest.d.ts: TypeError: Cannot read properties of undefined (reading 'buildError')
[error] at Scope.checkBlockScopedCollisions ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/scope/index.js:437:27)
[error] at Scope.registerBinding ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/scope/index.js:538:16)
[error] at Scope.registerDeclaration ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/scope/index.js:506:12)
[error] at Object.TSImportEqualsDeclaration ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/scope/index.js:214:12)
[error] at NodePath._call ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/path/context.js:49:20)
[error] at NodePath.call ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/path/context.js:39:18)
[error] at NodePath.visit ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/path/context.js:88:31)
[error] at TraversalContext.visitQueue ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/context.js:90:16)
[error] at TraversalContext.visitMultiple ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/context.js:62:17)
[error] at TraversalContext.visit ([snip]/node_modules/.pnpm/@[email protected]/node_modules/@babel/traverse/lib/context.js:111:19)
Contribute to @trivago/prettier-plugin-sort-imports
- I'm willing to fix this bug 🥇