Skip to content

Commit

Permalink
fix (vue/component-api-style): add spacing around comma in report mes…
Browse files Browse the repository at this point in the history
…sage (#2070)
  • Loading branch information
43081j authored Jan 7, 2023
1 parent 4a08c07 commit d339e2e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/component-api-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function buildAllowedPhrase(allowsOpt) {
phrases.push('Options API')
}
return phrases.length > 2
? `${phrases.slice(0, -1).join(',')} or ${phrases.slice(-1)[0]}`
? `${phrases.slice(0, -1).join(', ')} or ${phrases.slice(-1)[0]}`
: phrases.join(' or ')
}

Expand Down
25 changes: 25 additions & 0 deletions tests/lib/rules/component-api-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,31 @@ tester.run('component-api-style', rule, {
column: 9
}
]
},
{
filename: 'test.vue',
code: `
<script>
export default {
data () {
return {
msg: 'Hello World!',
// ...
}
},
// ...
}
</script>
`,
options: [['script-setup', 'composition', 'composition-vue2']],
errors: [
{
message:
'Options API is not allowed in your project. `data` option is part of the Options API. Use `<script setup>`, Composition API or Composition API (Vue 2) instead.',
line: 4,
column: 9
}
]
}
]
})

0 comments on commit d339e2e

Please sign in to comment.