I have javescript code like this. This code is for Vue. I understand that put the opening curly brace at the line end of a statement is a common practice in JS world.
<script>
export default
{
name: 'newUser',
data () {
return {
message: 'Hello World'
}
}
}
</script>
There is nothing wrong with this. However, just as a personal preference I found this style very annoying. I prefer following style:
<script>
export default
{
name: 'newUser',
data ()
{
return
{
message: 'Hello World'
}
}
}
</script>
However, if I change the style, Vue complains that "Opening curly brace does not appear on the same line as controlling statement". So my question here is that, is the first style mandated by javascript or just the Vue? Is there a way to bypass it and let me use the style I like? I guess not only Vue, but other JS frontend frameworks (e.g. React) also dislike the second style.