Skip to content

Commit d339e2e

Browse files
authored
fix (vue/component-api-style): add spacing around comma in report message (#2070)
1 parent 4a08c07 commit d339e2e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/rules/component-api-style.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function buildAllowedPhrase(allowsOpt) {
162162
phrases.push('Options API')
163163
}
164164
return phrases.length > 2
165-
? `${phrases.slice(0, -1).join(',')} or ${phrases.slice(-1)[0]}`
165+
? `${phrases.slice(0, -1).join(', ')} or ${phrases.slice(-1)[0]}`
166166
: phrases.join(' or ')
167167
}
168168

tests/lib/rules/component-api-style.js

+25
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,31 @@ tester.run('component-api-style', rule, {
817817
column: 9
818818
}
819819
]
820+
},
821+
{
822+
filename: 'test.vue',
823+
code: `
824+
<script>
825+
export default {
826+
data () {
827+
return {
828+
msg: 'Hello World!',
829+
// ...
830+
}
831+
},
832+
// ...
833+
}
834+
</script>
835+
`,
836+
options: [['script-setup', 'composition', 'composition-vue2']],
837+
errors: [
838+
{
839+
message:
840+
'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.',
841+
line: 4,
842+
column: 9
843+
}
844+
]
820845
}
821846
]
822847
})

0 commit comments

Comments
 (0)