Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
65 changes: 47 additions & 18 deletions tests/lib/rules/block-lang.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ 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
column: 15,
endLine: 2,
endColumn: 24
}
]
},
Expand All @@ -54,9 +57,12 @@ 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
column: 15,
endLine: 2,
endColumn: 24
}
]
},
Expand All @@ -68,7 +74,9 @@ tester.run('block-lang', rule, {
{
message: "The 'lang' attribute of '<script>' is missing.",
line: 2,
column: 7
column: 7,
endLine: 2,
endColumn: 15
}
]
},
Expand All @@ -78,9 +86,12 @@ 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
column: 15,
endLine: 2,
endColumn: 22
}
]
},
Expand All @@ -91,7 +102,9 @@ tester.run('block-lang', rule, {
{
message: "Do not specify the 'lang' attribute of '<script>'.",
line: 1,
column: 30
column: 30,
endLine: 1,
endColumn: 39
}
]
},
Expand All @@ -103,7 +116,9 @@ tester.run('block-lang', rule, {
message:
"Do not explicitly specify the default language for the 'lang' attribute of '<script>'.",
line: 1,
column: 30
column: 30,
endLine: 1,
endColumn: 39
}
]
},
Expand All @@ -114,7 +129,9 @@ tester.run('block-lang', rule, {
{
message: "Do not specify the 'lang' attribute of '<script>'.",
line: 1,
column: 30
column: 30,
endLine: 1,
endColumn: 39
}
]
},
Expand All @@ -126,7 +143,9 @@ tester.run('block-lang', rule, {
{
message: "The 'lang' attribute of '<i18n>' is missing.",
line: 1,
column: 1
column: 1,
endLine: 1,
endColumn: 7
}
]
},
Expand All @@ -137,9 +156,11 @@ 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
column: 13,
endLine: 2,
endColumn: 24
}
]
},
Expand All @@ -150,9 +171,11 @@ 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
column: 13,
endLine: 2,
endColumn: 24
}
]
},
Expand All @@ -165,17 +188,23 @@ tester.run('block-lang', rule, {
{
message: "Do not specify the 'lang' attribute of '<template>'.",
line: 1,
column: 11
column: 11,
endLine: 1,
endColumn: 21
},
{
message: "Do not specify the 'lang' attribute of '<script>'.",
line: 2,
column: 15
column: 15,
endLine: 2,
endColumn: 24
},
{
message: "Do not specify the 'lang' attribute of '<style>'.",
line: 3,
column: 14
column: 14,
endLine: 3,
endColumn: 27
}
]
}
Expand Down