Skip to content

Unquote numeric properties for Vue (if it's indeed safe to do that) #10127

@thorn0

Description

@thorn0

Unquoted numeric property names seem to be supported in Vue expressions.
But first, before fixing this, it'd be good to find some solid confirmation that it's 100% safe to do that.

Prettier 2.2.1
Playground link

--parser vue

Input:

<template>
  <div id="app">
    <HelloWorld :msg="{ '0': 'Hello Vue!' }[0]"/>
  </div>
</template>

Output:

<template>
  <div id="app">
    <HelloWorld :msg="{ '0': 'Hello Vue!' }[0]" />
  </div>
</template>

Expected (?):

<template>
  <div id="app">
    <HelloWorld :msg="{ 0: 'Hello Vue!' }[0]"/>
  </div>
</template>

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:vueIssues affecting Vuestatus:needs investigationIssues that need additional investigation, e.g. to understand whether the reported behavior is a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions