[Solved] VSCode Prettier extension not working when using prettier.config.cjs with prettier-plugin-tailwindcss and pnpm – Prettier

by
Ali Hasan
pnpm prettier tailwind-css

Quick Fix: Update your VSCode Prettier extension to version 9.16.0 or higher to resolve the issue with the prettier.config.cjs file, prettier-plugin-tailwindcss, and pnpm.

The Solutions:

Solution 1: Update VSCode Prettier extension version

Upgrade the VSCode Prettier extension to version 9.16.0 or later to resolve the compatibility issue with the prettier-config.cjs file and prettier-plugin-tailwindcss.

Solution 2: Downgrading Prettier Extension

Revert your VSCode Prettier extension to version 9.14.0 to resolve the issue. This version doesn’t have the issues with Prettier 9.15.0.

Steps:

  1. Right-click on the Prettier extension in VSCode.
  2. Click "Install other version…"
  3. Select version 9.14.0 from the list.
  4. Reload VSCode.
  5. Search for "Extensions: Auto Update" in the VSCode settings.
  6. Set the "Extensions: Auto Update" setting to "none" to prevent the extension from updating automatically in the future.

Q&A

Is this bug already fixed?

Yes, it works with v9.16.0.

Any alternative solution?

Downgrade to Prettier 9.14.0 with auto update disable.

Video Explanation:

The following video, titled "Error: Could not find a declaration file for module - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Fix error: Could not find a declaration file for module ... implicitly has an 'any' type. Try npm install library-name if it exists or add a ...