Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix (vue/component-api-style): add spacing around comma in report message #2070

Merged
merged 1 commit into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
}
]
}
]
})