Skip to content

Unable to format when using a typescript prettier config #136

@FinnDore

Description

@FinnDore
prettier-plugin-tailwindcss: ^0.2.5
tailwindcss: 3.3.0
node: 18.13.0
package manager: pnpm
os: mac

Reproduction URL

When trying to use the ts tailwind config introduced in tailwind 3.3.0 the formatting always fails. its worth noting it only fails when we point directly to the tailwind.config.ts file inside our prettier.config.cjs

command output ( sorry its rather long )


> [email protected] format /Users/finn/Documents/GitHub/tailwind-ts-config-prettier
> prettier --write .

.eslintrc.cjs
[error] .eslintrc.cjs: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
next-env.d.ts
[error] next-env.d.ts: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
next.config.mjs
[error] next.config.mjs: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
package.json 5ms
pnpm-lock.yaml 252ms
postcss.config.cjs
[error] postcss.config.cjs: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
prettier.config.cjs
[error] prettier.config.cjs: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
README.md 43ms
src/env.mjs
[error] src/env.mjs: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
src/pages/_app.tsx
[error] src/pages/_app.tsx: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
src/pages/index.tsx
[error] src/pages/index.tsx: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
src/styles/globals.css
[error] src/styles/globals.css: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
tailwind.config.ts
[error] tailwind.config.ts: Error: Cannot find module '/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/tailwind.config.cjs'
[error] Require stack:
[error] - /Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/noop.js
[error]     at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
[error]     at i (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1582)
[error]     at K0 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1694)
[error]     at Xf.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:1717)
[error]     at rb.exports (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:129:2426)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.js:134:4322)
[error]     at Object.parse (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7515:23)
[error]     at coreFormat (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8829:18)
[error]     at formatWithCursor2 (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:9021:18)
[error]     at Object.formatWithCursor (/Users/finn/Documents/GitHub/tailwind-ts-config-prettier/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:38183:12)
tsconfig.json 5ms
 ELIFECYCLE  Command failed with exit code 2.
 ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions