Skip to content

fix(block-lang): use consistent quotation marks in error messages #2805

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

Merged
merged 4 commits into from
Jul 19, 2025
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