Dprint plugin vue

Overview

dprint-plugin-vue

Format Vue SFC.

This plugin only parses root-level blocks, extract their content, and format them through dprint according to the lang attribute or a default:

Block Default
script js
template html
style css

This means you also need to install plugins for languages contained in your Vue SFC, such as dprint-plugin-typescript for JavaScript / TypeScript.

Usage

Install and setup dprint, then:

  1. Run
    dprint config add malobre/vue
  2. Install plugins for the languages contained in your vue files.
  3. Ensure .vue file extensions are matched in an includes pattern:
    {
      // -- snip --
      "includes": [
        "**/*.vue"
      ]
    }
  4. Add a vue configuration property if desired:
    {
      // -- snip --
      "vue": {
        // vue config goes here
      }
    }

Configuration

Key Default Description
indentTemplate true Indent the content of the tag
indentWidth 2 Width of the indentation
useTabs false Use tabs for indentation
You might also like...
Making Token Exchange program with Solana(Rust), Web3, and Vue
Making Token Exchange program with Solana(Rust), Web3, and Vue

Escrow program for Solana blockchain Tech stack Program (Smart Contract) Rust crates: solana-program, spl-token Solana CLI for test validator UI Types

An open source artifact manager. Written in Rust back end and an Vue front end to create a fast and modern experience

nitro_repo Nitro Repo is an open source free artifact manager. Written with a Rust back end and a Vue front end to create a fast and modern experience

Open-source Rewind.ai clone written in Rust and Vue running 100% locally with whisper.cpp

mind-overflow Open-source Rewind.AI clone built with Tauri and Vue. Leverages whisper.cpp for Speech-to-Text and (wip: llama.cpp for Text generation a

A powerful desktop widget app for windows, built with Vue and Tauri.
A powerful desktop widget app for windows, built with Vue and Tauri.

DashboardX Widgets A powerful desktop widget app for windows, built with Vue and Tauri. Still in development Currently only runs on windows (uses nati

Plugin to request a relaunch when uploading a Skyline plugin through cargo skyline

restart-plugin A skyline plugin for allowing cargo-skyline (or other tools) to restart your game without you having to touch your controller. Install

NetBeans Rust plugin

Rust NetBeans Plugin A NetBeans plugin for Rust. Linux / OSX Windows Requirements NetBeans 8.2.x Java 8+ Rust Cargo Rustup Features So far, it include

Rust plugin for the IntelliJ Platform

Rust plugin for the IntelliJ Platform Build Status Check Stable Beta Nightly Installation & Usage Available installation options and features are desc

A Bevy plugin for loading the LDtk 2D tile map format.
A Bevy plugin for loading the LDtk 2D tile map format.

bevy_ldtk ( Tileset from "Cavernas" by Adam Saltsman ) A Bevy plugin for loading LDtk tile maps. Usage use bevy::prelude::*; use bevy_ldtk::*; fn mai

Inspector plugin for the bevy game engine
Inspector plugin for the bevy game engine

bevy-inspector-egui This crate provides the ability to annotate structs with a #[derive(Inspectable)], which opens a debug interface using egui where

A plugin for Egui integration into Bevy
A plugin for Egui integration into Bevy

bevy_egui This crate provides a Egui integration for the Bevy game engine. Features: Desktop and web (bevy_webgl2) platforms support Clipboard (web su

Crossterm plugin for the bevy game engine
Crossterm plugin for the bevy game engine

What is bevy_crossterm? bevy_crossterm is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users

A Bevy plugin to use Kira for game audio

Bevy Kira audio This bevy plugin is intended to try integrating Kira into Bevy. The end goal would be to replace or update bevy_audio, if Kira turns o

A prototype plugin providing a simple line drawing api for bevy.
A prototype plugin providing a simple line drawing api for bevy.

bevy_debug_lines A prototype plugin providing a simple line drawing api for bevy. See docs.rs for documentation. Expect breakage on master. Click on t

 Obsidian Plugin: Convert a URL into markdown
Obsidian Plugin: Convert a URL into markdown

Obsidian Plugin: Convert a URL into markdown Transforms a URL to markdown view if the website allows it. Installation Available in the community plugi

Bevy plugin helping with asset loading and organisation

Bevy asset loader This Bevy plugin reduces boilerplate when loading game assets. The crate offers the AssetCollection trait and can automatically load

Foreign Function Interface Plugin for Deno.

Deno FFI Plugin to call dynamic library functions in Deno. Usage import { Library } from "https://deno.land/x/[email protected]/mod.ts"; const lib = new

GStreamer HTTP Live Streaming Plugin

A highly configurable GStreamer HLS sink plugin. Based on the hlssink2 element. The flexhlssink is written in Rust and has various options to configure the HLS output playlist generation.

A sprite-sheet animation plugin for bevy
A sprite-sheet animation plugin for bevy

Benimator A sprite sheet animation plugin for bevy Features A SpriteSheetAnimation component to automatically update the indices of the TextureAtlasSp

Bevy plugin for the GGRS P2P rollback networking library.

Bevy_GGRS Bevy plugin for the đŸ‘‰ GGRS P2P rollback networking library. The plugin creates a custom stage with a separate schedule, which handles corre

Comments
  • ER: Don't strip EOF on Vue files, allow possibility to have a new line at EOF

    ER: Don't strip EOF on Vue files, allow possibility to have a new line at EOF

    It looks like with v0.3.2, the end of the .Vue file is always trimmed,

    ~and therefore even though my dprint.json config looks like~

    ~{~ ~"newLineKind": "lf",~ ~....~ ~"vue"~ ~....~ ~}~

    ~When I run dprint on a Vue file, the end of the line is always stripped.~

    ~I can get a reproducer up for this.~

    Update: newLineKind is specific to the typescript/javascript plugin https://dprint.dev/plugins/typescript/config/ so it only makes sense that the config isn't used by this plugin. I am re-naming this issue to be an ER to enable adding a newline / keeping the existing newline to EOF.

    enhancement 
    opened by voool 3
  • Nested tags

    Nested tags

    <template>
      <template>
      </template>
    </template>
    

    is parsed as

    [
      "<template><template></template>",
      "</template>",
    ]
    
    opened by malobre 0
  • Regression in 0.4.2 causing indentTemplate: false to break dprint

    Regression in 0.4.2 causing indentTemplate: false to break dprint

    Hello,

    I noticed this error output when I was using v0.4.2 with indentTemplate: false. This went away when I downgraded to 0.4.1 and the option worked as expected.

    yarn dprint fmt                         [18:02]
    yarn run v1.22.19
    $ .....node_modules/.bin/dprint fmt
    Critical error formatting ....AComponent.vue. Cannot continue. Message: Originally panicked in dprint-plugin-vue, then failed reinitialize. This may be a bug in the plugin, the dprint cli is out of date, or the plugin is out of date.
    Original error: RuntimeError: unreachable
        at __rust_start_panic (<module>[364]:0x207fe)
        at rust_panic (<module>[360]:0x207b5)
        at std::panicking::rust_panic_with_hook::h47a0e203360b6c10 (<module>[355]:0x204fd)
        at std::panicking::begin_panic_handler::{{closure}}::h888144d5e9a03cec (<module>[348]:0x1fedd)
        at std::sys_common::backtrace::__rust_end_short_backtrace::h81961607fd97e28e (<module>[347]:0x1fe2c)
        at rust_begin_unwind (<module>[354]:0x203d6)
        at core::panicking::panic_fmt::h4ca53049f45e3264 (<module>[440]:0x26a26)
        at core::str::slice_error_fail::hc8f76ed1263d932a (<module>[458]:0x27a51)
        at dprint_plugin_vue::format::format::h779901301d6afa9b (<module>[169]:0xef4f)
        at format (<module>[136]:0xb3dd)
    Reinitialize error: RuntimeError: unreachable
        at __rust_start_panic (<module>[364]:0x207fe)
        at rust_panic (<module>[360]:0x207b5)
        at std::panicking::rust_panic_with_hook::h47a0e203360b6c10 (<module>[355]:0x204fd)
        at std::panicking::begin_panic_handler::{{closure}}::h888144d5e9a03cec (<module>[348]:0x1fedd)
        at std::sys_common::backtrace::__rust_end_short_backtrace::h81961607fd97e28e (<module>[347]:0x1fe2c)
        at rust_begin_unwind (<module>[354]:0x203d6)
        at core::panicking::panic_fmt::h4ca53049f45e3264 (<module>[440]:0x26a26)
        at core::str::slice_error_fail::hc8f76ed1263d932a (<module>[458]:0x27a51)
        at dprint_plugin_vue::format::format::h779901301d6afa9b (<module>[169]:0xef4f)
        at format (<module>[136]:0xb3dd)
    Had 1 error(s) formatting.
    error Command failed with exit code 1.
    
    

    I can help with a reproducer if need-be. Thanks a bunch for this plugin!

    bug 
    opened by voool 2
Releases(v0.5.0)
Owner
Malobre
Malobre
Configurable HTML/Vue/Svelte/Jinja/Twig formatter, with dprint integration.

markup_fmt markup_fmt is a configurable HTML/Vue/Svelte/Jinja/Twig formatter. Notes for Vue and Svelte Users This formatter provides some options such

Pig Fang 17 Nov 15, 2023
Adapter plugin to use Ruff in dprint's CLI and with JavaScript via Wasm

dprint-plugin-ruff Adapter for Ruff for use as a formatting plugin in dprint. Formats .py and .pyi files. Note: For formatting .ipynb files, use the J

null 3 Nov 28, 2023
A node API for the dprint TypeScript and JavaScript code formatter

dprint-node A node API for the dprint TypeScript and JavaScript code formatter. It's written in Rust for blazing fast speed. Usage Pass a file path an

Devon Govett 431 Dec 24, 2022
Monorepo for dprint—a pluggable and configurable code formatting platform

dprint Monorepo for dprint—a pluggable and configurable code formatting platform. This project is under active early development. I recommend you chec

null 1.7k Jan 8, 2023
Example application using a Vue frontend with Rust backend that has authentication + authorization.

This project contains a Rust server that serves a single page application and has authentication + JWT-based authorization.

null 43 Dec 9, 2022
Vue, React, Solid, Angular, Svelte, and Liquid From JS Objects.

Vue, React, Solid, Angular, Svelte, and Liquid From JS Objects.

JSX One 11 Sep 21, 2022
Vue, React, Solid, Angular, Svelte, and Liquid From JS Objects.

Vue, React, Solid, Angular, Svelte, and Liquid From JS Objects.

JSX One 18 Jul 17, 2021
Vue's template compiler reimplemented in Rust!

vue template compiler in Rust https://github.com/vuejs/rfcs/discussions/369#discussioncomment-1192421 Maybe in the long run we want the whole transfor

Herrington Darkholme 687 Jan 1, 2023
Vue's template compiler reimplemented in Rust!

Vue's template compiler reimplemented in Rust!

Herrington Darkholme 686 Jan 3, 2023
Auritia is a DAW coded in Rust and Vue in hopes of having cross platform compatability, while also providing enough features for anyone to use professionally

Steps Install WebView if you're not on Windows 11 Install Node deps npm i To run the dev server do npm run tauri dev Compiling Linux You will need to

Auritia 20 Aug 27, 2022