dprint / dprint-plugin-prettier

Prettier wrapper plugin for dprint.
Other
96 stars 8 forks source link

Bug: Doesn't work "overrides" property for vue #39

Open doox911 opened 1 year ago

doox911 commented 1 year ago

I have the config:

{
  "typescript": {
    "quoteStyle": "preferSingle"
  },
  "json": {},
  "markdown": {},
  "toml": {},
  "dockerfile": {},
  "includes": [
    "**/*.{vue, ts,tsx,js,jsx,cjs,mjs,json,md,toml,dockerfile}"
  ],
  "prettier": {
    "printWidth": 100,
    "singleQuote": true,
    "trailingComma": "all",
    "overrides": [
      {
        "files": "*.vue",
        "options": {
          "vueIndentScriptAndStyle": true
        }
      }
    ]
  },
  "excludes": [
    "**/node_modules",
    "**/*-lock.json",
    "./dist"
  ],
  "plugins": [
    "https://plugins.dprint.dev/typescript-0.74.0.wasm",
    "https://plugins.dprint.dev/json-0.15.6.wasm",
    "https://plugins.dprint.dev/markdown-0.14.1.wasm",
    "https://plugins.dprint.dev/toml-0.5.4.wasm",
    "https://plugins.dprint.dev/dockerfile-0.3.0.wasm",
    "https://plugins.dprint.dev/prettier-0.15.0.json@ff80be22d9d596d17a1ca0767e2cbdddd518cf7d23773045ab90d12dfc63f5d5"
  ]
}

I have the component:

<template>
  <div />
</template>

<script setup lang="ts">
  import { computed } from 'vue';
</script>

I expect that after formatting, the indentation of the script section will be preserved, but it disappears:

<template>
  <div />
</template>

<script setup lang="ts">
import { computed } from 'vue';
</script>

That is, the overrides property is ignored.

davidbludlow commented 1 year ago

I also ran into this issue, when trying to override some settings for some json files. Maybe the name of this issue should be changed to not just be specific to vue files?

MaxWinterstein commented 1 year ago

same thing for me here, would love to integrate prettier into dprint, but sadly wildcard overrides are not possible:

  "prettier": {
    "overrides": [
      {
        "files": ["**/snapshots/*.json"],
        "options": { "printWidth": 160 }
      }
    ]
  },