Prettier plugin (v1.0.3) that forces TypeScript imports to remain on a single line, overriding Prettier's default multi-line import formatting. Requires Prettier >=3.0.0. It preserves comments inside imports by keeping them multi-line. Installation requires adding the plugin to the Prettier plugins array in config. Ships with TypeScript types. Release cadence: sporadic bug fixes. Key differentiator: solves an age-old Prettier issue (GitHub #5995) by offering a simple override without configuration options.
npm install prettier-plugin-one-line-importsVerified import paths — ran on the pinned version, not inferred.
Install the plugin, configure Prettier, and see single-line imports.
No action needed. If you want to force single-line default imports, consider other tools.
Remove any comments inside import braces to enable single-line formatting.
Upgrade Prettier to version 3 or later: npm install prettier@latest
Upgrade to 1.0.3: npm install prettier-plugin-one-line-imports@latest
Upgrade to version 1.0.3 or later: npm install prettier-plugin-one-line-imports@latest
Ensure the package is installed as a dev dependency: npm install --save-dev prettier-plugin-one-line-imports
Add the plugin string exactly as "prettier-plugin-one-line-imports" under the "plugins" array in your .prettierrc, package.json, or other config file.