prettier-plugin-classnames icon indicating copy to clipboard operation
prettier-plugin-classnames copied to clipboard

Incompatible with prettier-plugin-twig

Open johnvanhulsen opened this issue 10 months ago • 1 comments

Dependency information

"scripts:" {
  ...
  "format": "prettier --write 'src/**/*.{js,ts,svelte,css,scss}' 'templates/**/*.{html,twig}'"
},
"devDependencies": {
  "@zackad/prettier-plugin-twig": "^0.15.2",
  "prettier": "^3.5.1",
  "prettier-plugin-classnames": "^0.7.6",
  "prettier-plugin-merge": "^0.7.2",
  "prettier-plugin-svelte": "^3.3.3",
  "prettier-plugin-tailwindcss": "^0.6.11",
  "tailwindcss": "^4.0.6",
}

Steps to reproduce

Used this plugin in Twig, where i use @zackad/prettier-plugin-twig for formatting. I think these two conflicting eachother. When i modify my file to .html, this plugin wins. With .twig all classnames are on the same line.

{
  "plugins": [
    "prettier-plugin-svelte",
    "prettier-plugin-tailwindcss",
    "@zackad/prettier-plugin-twig",
    "prettier-plugin-classnames",
    "prettier-plugin-merge"
  ],
  "overrides": [
    {
      "files": "*.svelte",
      "options": {
        "parser": "svelte"
      }
    },
    {
      "files": "*.twig",
      "options": {
        "tabWidth": 4
      }
    }
  ],
  "semi": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "printWidth": 100
}

Is there something miss in my config, or is it the plugin? :)

johnvanhulsen avatar Feb 18 '25 15:02 johnvanhulsen

Currently this plugin does not support twig parser.

If there is an official plugin that supports twig parser, twig parser support may be added to this plugin in the future.

ony3000 avatar Feb 19 '25 12:02 ony3000