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

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

Open doox911 opened this issue 3 years ago • 2 comments

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.

doox911 avatar Dec 02 '22 12:12 doox911

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?

davidbludlow avatar Mar 30 '23 00:03 davidbludlow

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 }
      }
    ]
  },

MaxWinterstein avatar Jun 16 '23 14:06 MaxWinterstein