Skip to content

Commit 8a0e673

Browse files
ST-DDTFloEdelmann
andauthored
fix(block-lang): use consistent quotation marks in error messages (#2805)
Co-authored-by: Flo Edelmann <[email protected]>
1 parent 18dc6db commit 8a0e673

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.changeset/strong-masks-fetch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-vue': patch
3+
---
4+
5+
Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages

lib/rules/block-lang.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const DEFAULT_LANGUAGES = {
4040
* @param {NonNullable<BlockOptions['lang']>} lang
4141
*/
4242
function getAllowsLangPhrase(lang) {
43-
const langs = [...lang].map((s) => `"${s}"`)
43+
const langs = [...lang].map((s) => `'${s}'`)
4444
switch (langs.length) {
4545
case 1: {
4646
return langs[0]
@@ -157,7 +157,7 @@ module.exports = {
157157
missing: "The 'lang' attribute of '<{{tag}}>' is missing.",
158158
unexpected: "Do not specify the 'lang' attribute of '<{{tag}}>'.",
159159
useOrNot:
160-
"Only {{allows}} can be used for the 'lang' attribute of '<{{tag}}>'. Or, not specifying the `lang` attribute is allowed.",
160+
"Only {{allows}} can be used for the 'lang' attribute of '<{{tag}}>'. Or, not specifying the 'lang' attribute is allowed.",
161161
unexpectedDefault:
162162
"Do not explicitly specify the default language for the 'lang' attribute of '<{{tag}}>'."
163163
}

tests/lib/rules/block-lang.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ tester.run('block-lang', rule, {
4242
options: [{ script: { lang: 'ts' } }],
4343
errors: [
4444
{
45-
message: `Only "ts" can be used for the 'lang' attribute of '<script>'.`,
45+
message:
46+
"Only 'ts' can be used for the 'lang' attribute of '<script>'.",
4647
line: 2,
4748
column: 15,
4849
endLine: 2,
@@ -56,7 +57,8 @@ tester.run('block-lang', rule, {
5657
options: [{ script: { lang: ['ts'] } }],
5758
errors: [
5859
{
59-
message: `Only "ts" can be used for the 'lang' attribute of '<script>'.`,
60+
message:
61+
"Only 'ts' can be used for the 'lang' attribute of '<script>'.",
6062
line: 2,
6163
column: 15,
6264
endLine: 2,
@@ -84,7 +86,8 @@ tester.run('block-lang', rule, {
8486
options: [{ script: { lang: 'ts' } }],
8587
errors: [
8688
{
87-
message: `Only "ts" can be used for the 'lang' attribute of '<script>'.`,
89+
message:
90+
"Only 'ts' can be used for the 'lang' attribute of '<script>'.",
8891
line: 2,
8992
column: 15,
9093
endLine: 2,
@@ -153,7 +156,7 @@ tester.run('block-lang', rule, {
153156
errors: [
154157
{
155158
message:
156-
"Only \"json\" can be used for the 'lang' attribute of '<i18n>'. Or, not specifying the `lang` attribute is allowed.",
159+
"Only 'json' can be used for the 'lang' attribute of '<i18n>'. Or, not specifying the 'lang' attribute is allowed.",
157160
line: 2,
158161
column: 13,
159162
endLine: 2,
@@ -168,7 +171,7 @@ tester.run('block-lang', rule, {
168171
errors: [
169172
{
170173
message:
171-
'Only "json", and "yaml" can be used for the \'lang\' attribute of \'<i18n>\'. Or, not specifying the `lang` attribute is allowed.',
174+
"Only 'json', and 'yaml' can be used for the 'lang' attribute of '<i18n>'. Or, not specifying the 'lang' attribute is allowed.",
172175
line: 2,
173176
column: 13,
174177
endLine: 2,

0 commit comments

Comments
 (0)