Next.js Discord

Discord Forum

prettier problem

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
has anyone experienced the problem with prettier where they can format the code from CLI, but when trying to format with the VSC prettier extension you get the error:
Invalid prettier configuration file detected.
{}


this happens after I use the plugins inside my .prettierrc.cjs file:
/** @type {import("@ianvs/prettier-plugin-sort-imports").PrettierConfig} */
module.exports = {
  "semi": true,
  "trailingComma": "all",
  singleQuote: false,
  printWidth: 100,
  tabWidth: 2,
  endOfLine: "auto",

  plugins: [require("@ianvs/prettier-plugin-sort-imports"), require("prettier-plugin-tailwindcss")],
  
  importOrder: [
    "^(react/(.*)$)|^(react$)",
    "<THIRD_PARTY_MODULES>",
    "",
    "^types$",
    "^@/types/(.*)$",
    "^@/config/(.*)$",
    "^@/services/(.*)$",
    "^@/lib/(.*)$",
    "^@/utils/(.*)$",
    "^@/hooks/(.*)$",
    "^@/components/ui/(.*)$",
    "^@/components/(.*)$",
    "^@/registry/(.*)$",
    "^@/styles/(.*)$",
    "^@/app/(.*)$",
    "",
    "^[./]",
  ],
  importOrderParserPlugins: ["typescript", "jsx", "decorators-legacy"],

  tailwindFunctions: ["cn", "cva"],
};

0 Replies