Skip to content

Styleguide: Template / Options consistancy #1246

Closed
@MachinisteWeb

Description

@MachinisteWeb

Hi @chrisvfritz.

In the Styleguide, the rules about options order said the correct order in a normal case is:

module.exports = {
    ...,
    data: function () {
        return {}
    },
    ...,
    template: `<div>
        <div></div>
    </div>`
}

but, the rules about top-level element order in SFC said:

Single-file components should always order template, script, and style tags consistently, with <style> last.

So the way this sentence is written suggest that order:

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

<script>
module.exports = {
    data: function () {
        return {}
    }
}
</script>

This is exactly the inverse of previous rules.

So I suggest changing this sentence by:

Single-file components should always order script, template, and style tags consistently, with <style> last.

and change good example order place:

<!-- ComponentA.vue -->
<script>/* ... */</script>
<template>...</template>
<style>/* ... */</style>

<!-- ComponentB.vue -->
<script>/* ... */</script>
<template>...</template>
<style>/* ... */</style>

example before:

<!-- ComponentA.vue -->
<template>...</template>
<script>/* ... */</script>
<style>/* ... */</style>

<!-- ComponentB.vue -->
<template>...</template>
<script>/* ... */</script>
<style>/* ... */</style>

That not said the others order is not possible, but that bring consistency in rules

What is your thought? (Yeah I know is not a horrible problem, but if it's just little better, why not?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions