Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-masks-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-vue': patch
---

Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages
4 changes: 2 additions & 2 deletions lib/rules/block-lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const DEFAULT_LANGUAGES = {
* @param {NonNullable<BlockOptions['lang']>} lang
*/
function getAllowsLangPhrase(lang) {
const langs = [...lang].map((s) => `"${s}"`)
const langs = [...lang].map((s) => `'${s}'`)
switch (langs.length) {
case 1: {
return langs[0]
Expand Down Expand Up @@ -157,7 +157,7 @@ module.exports = {
missing: "The 'lang' attribute of '<{{tag}}>' is missing.",
unexpected: "Do not specify the 'lang' attribute of '<{{tag}}>'.",
useOrNot:
"Only {{allows}} can be used for the 'lang' attribute of '<{{tag}}>'. Or, not specifying the `lang` attribute is allowed.",
"Only {{allows}} can be used for the 'lang' attribute of '<{{tag}}>'. Or, not specifying the 'lang' attribute is allowed.",
unexpectedDefault:
"Do not explicitly specify the default language for the 'lang' attribute of '<{{tag}}>'."
}
Expand Down
13 changes: 8 additions & 5 deletions tests/lib/rules/block-lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ tester.run('block-lang', rule, {
options: [{ script: { lang: 'ts' } }],
errors: [
{
message: `Only "ts" can be used for the 'lang' attribute of '<script>'.`,
message:
"Only 'ts' can be used for the 'lang' attribute of '<script>'.",
line: 2,
column: 15,
endLine: 2,
Expand All @@ -56,7 +57,8 @@ tester.run('block-lang', rule, {
options: [{ script: { lang: ['ts'] } }],
errors: [
{
message: `Only "ts" can be used for the 'lang' attribute of '<script>'.`,
message:
"Only 'ts' can be used for the 'lang' attribute of '<script>'.",
line: 2,
column: 15,
endLine: 2,
Expand Down Expand Up @@ -84,7 +86,8 @@ tester.run('block-lang', rule, {
options: [{ script: { lang: 'ts' } }],
errors: [
{
message: `Only "ts" can be used for the 'lang' attribute of '<script>'.`,
message:
"Only 'ts' can be used for the 'lang' attribute of '<script>'.",
line: 2,
column: 15,
endLine: 2,
Expand Down Expand Up @@ -153,7 +156,7 @@ tester.run('block-lang', rule, {
errors: [
{
message:
"Only \"json\" can be used for the 'lang' attribute of '<i18n>'. Or, not specifying the `lang` attribute is allowed.",
"Only 'json' can be used for the 'lang' attribute of '<i18n>'. Or, not specifying the 'lang' attribute is allowed.",
line: 2,
column: 13,
endLine: 2,
Expand All @@ -168,7 +171,7 @@ tester.run('block-lang', rule, {
errors: [
{
message:
'Only "json", and "yaml" can be used for the \'lang\' attribute of \'<i18n>\'. Or, not specifying the `lang` attribute is allowed.',
"Only 'json', and 'yaml' can be used for the 'lang' attribute of '<i18n>'. Or, not specifying the 'lang' attribute is allowed.",
line: 2,
column: 13,
endLine: 2,
Expand Down