Skip to content

failed to format vite.config.mts #3962

@chenyuanrun

Description

@chenyuanrun

Preflight Checklist

Issue Summary

error while formatting vite.config.mts

["INFO" - 8:42:30 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 8:42:30 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 8:42:30 PM] Prettier Options:
{
  "filepath": "/data/build/chenyuanrun/ictrekstor-frontend/apps/web-antd/vite.config.mts",
  "parser": "typescript",
  "useTabs": false,
  "tabWidth": 2,
  "printWidth": 80,
  "singleQuote": true,
  "endOfLine": "auto",
  "plugins": [
    "file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs"
  ],
  "proseWrap": "never",
  "semi": true,
  "trailingComma": "all"
}
["ERROR" - 8:42:30 PM] Error formatting document.
["ERROR" - 8:42:30 PM] No package.json could be found upwards from directory /root
Error: No package.json could be found upwards from directory /root
	at findRootSync (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/@manypkg+find-root@3.1.0/node_modules/@manypkg/find-root/dist/manypkg-find-root.js:120:11)
	at getPackagesSync (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/@manypkg+get-packages@3.1.0/node_modules/@manypkg/get-packages/dist/manypkg-get-packages.js:38:51)
	at /data/build/chenyuanrun/ictrekstor-frontend/internal/tailwind-config/src/index.ts:14:55
	at eval_evalModule (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:155533)
	at jitiRequire (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150967)
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:157987
	at /data/build/chenyuanrun/ictrekstor-frontend/internal/tailwind-config/dist/index.cjs:16:18
	at eval_evalModule (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:155533)
	at jitiRequire (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150967)
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:157987
	at /data/build/chenyuanrun/ictrekstor-frontend/apps/web-antd/tailwind.config.mjs:1:365
	at eval_evalModule (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:155533)
	at jitiRequire (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150967)
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:157987
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/tailwindcss@3.4.19_yaml@2.8.2/node_modules/tailwindcss/lib/lib/load-config.js:53:30
	at loadConfig (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/tailwindcss@3.4.19_yaml@2.8.2/node_modules/tailwindcss/lib/lib/load-config.js:55:6)
	at qS (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:1724:4676)
	at file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:1783
	at Object.remember (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:1724:2260)
	at uB (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:1758)
	at async Object.parse (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11171)
	at async parse5 (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:16420:11)
	at async coreFormat (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:16952:7)
	at async formatWithCursor (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:17172:14)
	at async Module.format2 (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:18730:25)
	at async PrettierEditService.format (file:///root/.vscode-server/extensions/esbenp.prettier-vscode-12.3.0/dist/extension.js:3288:29)
	at async PrettierEditProvider.provideEdits (file:///root/.vscode-server/extensions/esbenp.prettier-vscode-12.3.0/dist/extension.js:3159:20)
	at async P3.provideDocumentFormattingEdits (file:///root/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622/out/vs/workbench/api/node/extensionHostProcess.js:144:155590)
["INFO" - 8:42:30 PM] Formatting completed in 33ms.

Reproduction Repository

https://github.com/vbenjs/vue-vben-admin/blob/main/apps/web-antd/vite.config.mts

Steps to Reproduce

  1. Clone repo and open it with vscode;
  2. vscode install prettier extension.
  3. format vite.config.mts using vscode right click Format Document.

Expected Behavior

File is formated

Actual Behavior

Extension reports errors

Operating System

Linux

IDE

VSCode

IDE Version

1.109.5

Prettier Extension Version

12.3.0

Prettier Version

3.8.1

Prettier Extension Logs

"INFO" - 8:52:45 PM] Formatting file:///data/build/chenyuanrun/ictrekstor-frontend/apps/web-antd/vite.config.mts
["INFO" - 8:52:45 PM] Using config file at /data/build/chenyuanrun/ictrekstor-frontend/.prettierrc.mjs
["INFO" - 8:52:45 PM] EditorConfig support is enabled, checking for .editorconfig files
["INFO" - 8:52:45 PM] Resolved config:
{
  "useTabs": false,
  "tabWidth": 2,
  "printWidth": 80,
  "singleQuote": true,
  "endOfLine": "auto",
  "plugins": [
    "prettier-plugin-tailwindcss"
  ],
  "proseWrap": "never",
  "semi": true,
  "trailingComma": "all"
}
["INFO" - 8:52:45 PM] PrettierInstance:
{
  "version": "3.8.1",
  "prettierModule": {
    "__debug": {},
    "util": {},
    "doc": {
      "builders": {
        "line": {
          "type": "line"
        },
        "softline": {
          "type": "line",
          "soft": true
        },
        "hardline": [
          {
            "type": "line",
            "hard": true
          },
          {
            "type": "break-parent"
          }
        ],
        "literalline": [
          {
            "type": "line",
            "hard": true,
            "literal": true
          },
          {
            "type": "break-parent"
          }
        ],
        "lineSuffixBoundary": {
          "type": "line-suffix-boundary"
        },
        "cursor": {
          "type": "cursor"
        },
        "breakParent": {
          "type": "break-parent"
        },
        "trim": {
          "type": "trim"
        },
        "hardlineWithoutBreakParent": {
          "type": "line",
          "hard": true
        },
        "literallineWithoutBreakParent": {
          "type": "line",
          "hard": true,
          "literal": true
        }
      },
      "printer": {},
      "utils": {}
    },
    "version": "3.8.1"
  },
  "modulePath": "/data/build/chenyuanrun/ictrekstor-frontend/node_modules/prettier"
}
["INFO" - 8:52:45 PM] Using ignore file (if present) at /data/build/chenyuanrun/ictrekstor-frontend/.prettierignore
["INFO" - 8:52:45 PM] Resolved plugins:
[
  "file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs"
]
["INFO" - 8:52:45 PM] File Info:
{
  "ignored": false,
  "inferredParser": "typescript"
}
["INFO" - 8:52:45 PM] Using local configuration (VS Code configuration will not be used)
["INFO" - 8:52:45 PM] Prettier Options:
{
  "filepath": "/data/build/chenyuanrun/ictrekstor-frontend/apps/web-antd/vite.config.mts",
  "parser": "typescript",
  "useTabs": false,
  "tabWidth": 2,
  "printWidth": 80,
  "singleQuote": true,
  "endOfLine": "auto",
  "plugins": [
    "file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs"
  ],
  "proseWrap": "never",
  "semi": true,
  "trailingComma": "all"
}
["ERROR" - 8:52:45 PM] Error formatting document.
["ERROR" - 8:52:45 PM] No package.json could be found upwards from directory /root
Error: No package.json could be found upwards from directory /root
	at findRootSync (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/@manypkg+find-root@3.1.0/node_modules/@manypkg/find-root/dist/manypkg-find-root.js:120:11)
	at getPackagesSync (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/@manypkg+get-packages@3.1.0/node_modules/@manypkg/get-packages/dist/manypkg-get-packages.js:38:51)
	at /data/build/chenyuanrun/ictrekstor-frontend/internal/tailwind-config/src/index.ts:14:55
	at eval_evalModule (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:155533)
	at jitiRequire (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150967)
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:157987
	at /data/build/chenyuanrun/ictrekstor-frontend/internal/tailwind-config/dist/index.cjs:16:18
	at eval_evalModule (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:155533)
	at jitiRequire (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150967)
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:157987
	at /data/build/chenyuanrun/ictrekstor-frontend/apps/web-antd/tailwind.config.mjs:1:365
	at eval_evalModule (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:155533)
	at jitiRequire (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:150967)
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.cjs:1:157987
	at /data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/tailwindcss@3.4.19_yaml@2.8.2/node_modules/tailwindcss/lib/lib/load-config.js:53:30
	at loadConfig (/data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/tailwindcss@3.4.19_yaml@2.8.2/node_modules/tailwindcss/lib/lib/load-config.js:55:6)
	at qS (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:1724:4676)
	at file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:1783
	at Object.remember (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:1724:2260)
	at uB (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:1758)
	at async Object.parse (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier-plugin-tailwindcss@0.7.2_prettier@3.8.1/node_modules/prettier-plugin-tailwindcss/dist/index.mjs:3512:11171)
	at async parse5 (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:16420:11)
	at async coreFormat (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:16952:7)
	at async formatWithCursor (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:17172:14)
	at async Module.format2 (file:///data/build/chenyuanrun/ictrekstor-frontend/node_modules/.pnpm/prettier@3.8.1/node_modules/prettier/index.mjs:18730:25)
	at async PrettierEditService.format (file:///root/.vscode-server/extensions/esbenp.prettier-vscode-12.3.0/dist/extension.js:3288:29)
	at async PrettierEditProvider.provideEdits (file:///root/.vscode-server/extensions/esbenp.prettier-vscode-12.3.0/dist/extension.js:3159:20)
	at async P3.provideDocumentFormattingEdits (file:///root/.vscode-server/bin/072586267e68ece9a47aa43f8c108e0dcbf44622/out/vs/workbench/api/node/extensionHostProcess.js:144:155590)
["INFO" - 8:52:45 PM] Formatting completed in 62ms.

Prettier Configuration

export default {
  endOfLine: 'auto',
  overrides: [
    {
      files: ['*.json5'],
      options: {
        quoteProps: 'preserve',
        singleQuote: false,
      },
    },
  ],
  plugins: ['prettier-plugin-tailwindcss'],
  printWidth: 80,
  proseWrap: 'never',
  semi: true,
  singleQuote: true,
  trailingComma: 'all',
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage-pendingAwaiting initial triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions