Skip to content

Commit adf9424

Browse files
authored
Merge branch 'master' into feature/vapor
2 parents edb5273 + d46c0a8 commit adf9424

File tree

10 files changed

+921
-173
lines changed

10 files changed

+921
-173
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/array-bracket-newline.js

Lines changed: 110 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,70 +40,166 @@ tester.run('array-bracket-newline', rule, {
4040
{
4141
code: '<template><div :attr="[\na]" /></template>',
4242
output: '<template><div :attr="[a]" /></template>',
43-
errors: ["There should be no linebreak after '['."]
43+
errors: [
44+
{
45+
message: "There should be no linebreak after '['.",
46+
line: 1,
47+
column: 23,
48+
endLine: 1,
49+
endColumn: 24
50+
}
51+
]
4452
},
4553
{
4654
code: '<template><div :attr="[a\n]" /></template>',
4755
output: '<template><div :attr="[a]" /></template>',
48-
errors: ["There should be no linebreak before ']'."]
56+
errors: [
57+
{
58+
message: "There should be no linebreak before ']'.",
59+
line: 2,
60+
column: 1,
61+
endLine: 2,
62+
endColumn: 2
63+
}
64+
]
4965
},
5066
{
5167
code: '<template><div :attr="[\na\n]" /></template>',
5268
output: '<template><div :attr="[a]" /></template>',
5369
errors: [
54-
"There should be no linebreak after '['.",
55-
"There should be no linebreak before ']'."
70+
{
71+
message: "There should be no linebreak after '['.",
72+
line: 1,
73+
column: 23,
74+
endLine: 1,
75+
endColumn: 24
76+
},
77+
{
78+
message: "There should be no linebreak before ']'.",
79+
line: 3,
80+
column: 1,
81+
endLine: 3,
82+
endColumn: 2
83+
}
5684
]
5785
},
5886
{
5987
code: '<template><div :attr="[\na]" /></template>',
6088
output: '<template><div :attr="[a]" /></template>',
6189
options: ['never'],
62-
errors: ["There should be no linebreak after '['."]
90+
errors: [
91+
{
92+
message: "There should be no linebreak after '['.",
93+
line: 1,
94+
column: 23,
95+
endLine: 1,
96+
endColumn: 24
97+
}
98+
]
6399
},
64100
{
65101
code: '<template><div :attr="[a\n]" /></template>',
66102
output: '<template><div :attr="[a]" /></template>',
67103
options: ['never'],
68-
errors: ["There should be no linebreak before ']'."]
104+
errors: [
105+
{
106+
message: "There should be no linebreak before ']'.",
107+
line: 2,
108+
column: 1,
109+
endLine: 2,
110+
endColumn: 2
111+
}
112+
]
69113
},
70114
{
71115
code: '<template><div :attr="[\na\n]" /></template>',
72116
output: '<template><div :attr="[a]" /></template>',
73117
options: ['never'],
74118
errors: [
75-
"There should be no linebreak after '['.",
76-
"There should be no linebreak before ']'."
119+
{
120+
message: "There should be no linebreak after '['.",
121+
line: 1,
122+
column: 23,
123+
endLine: 1,
124+
endColumn: 24
125+
},
126+
{
127+
message: "There should be no linebreak before ']'.",
128+
line: 3,
129+
column: 1,
130+
endLine: 3,
131+
endColumn: 2
132+
}
77133
]
78134
},
79135
{
80136
code: '<template><div :attr="[\na]" /></template>',
81137
output: '<template><div :attr="[\na\n]" /></template>',
82138
options: ['always'],
83-
errors: ["A linebreak is required before ']'."]
139+
errors: [
140+
{
141+
message: "A linebreak is required before ']'.",
142+
line: 2,
143+
column: 2,
144+
endLine: 2,
145+
endColumn: 3
146+
}
147+
]
84148
},
85149
{
86150
code: '<template><div :attr="[a\n]" /></template>',
87151
output: '<template><div :attr="[\na\n]" /></template>',
88152
options: ['always'],
89-
errors: ["A linebreak is required after '['."]
153+
errors: [
154+
{
155+
message: "A linebreak is required after '['.",
156+
line: 1,
157+
column: 23,
158+
endLine: 1,
159+
endColumn: 24
160+
}
161+
]
90162
},
91163
{
92164
code: '<template><div :attr="[a]" /></template>',
93165
output: '<template><div :attr="[\na\n]" /></template>',
94166
options: ['always'],
95167
errors: [
96-
"A linebreak is required after '['.",
97-
"A linebreak is required before ']'."
168+
{
169+
message: "A linebreak is required after '['.",
170+
line: 1,
171+
column: 23,
172+
endLine: 1,
173+
endColumn: 24
174+
},
175+
{
176+
message: "A linebreak is required before ']'.",
177+
line: 1,
178+
column: 25,
179+
endLine: 1,
180+
endColumn: 26
181+
}
98182
]
99183
},
100184
{
101185
code: '<template><div :[[attr]]="[a]" /></template>',
102186
output: '<template><div :[[attr]]="[\na\n]" /></template>',
103187
options: ['always'],
104188
errors: [
105-
"A linebreak is required after '['.",
106-
"A linebreak is required before ']'."
189+
{
190+
message: "A linebreak is required after '['.",
191+
line: 1,
192+
column: 27,
193+
endLine: 1,
194+
endColumn: 28
195+
},
196+
{
197+
message: "A linebreak is required before ']'.",
198+
line: 1,
199+
column: 29,
200+
endLine: 1,
201+
endColumn: 30
202+
}
107203
]
108204
}
109205
]

tests/lib/rules/array-bracket-spacing.js

Lines changed: 110 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,70 +39,166 @@ tester.run('array-bracket-spacing', rule, {
3939
{
4040
code: '<template><div :attr="[ a]" /></template>',
4141
output: '<template><div :attr="[a]" /></template>',
42-
errors: ["There should be no space after '['."]
42+
errors: [
43+
{
44+
message: "There should be no space after '['.",
45+
line: 1,
46+
column: 24,
47+
endLine: 1,
48+
endColumn: 25
49+
}
50+
]
4351
},
4452
{
4553
code: '<template><div :attr="[a ]" /></template>',
4654
output: '<template><div :attr="[a]" /></template>',
47-
errors: ["There should be no space before ']'."]
55+
errors: [
56+
{
57+
message: "There should be no space before ']'.",
58+
line: 1,
59+
column: 25,
60+
endLine: 1,
61+
endColumn: 26
62+
}
63+
]
4864
},
4965
{
5066
code: '<template><div :attr="[ a ]" /></template>',
5167
output: '<template><div :attr="[a]" /></template>',
5268
errors: [
53-
"There should be no space after '['.",
54-
"There should be no space before ']'."
69+
{
70+
message: "There should be no space after '['.",
71+
line: 1,
72+
column: 24,
73+
endLine: 1,
74+
endColumn: 25
75+
},
76+
{
77+
message: "There should be no space before ']'.",
78+
line: 1,
79+
column: 26,
80+
endLine: 1,
81+
endColumn: 27
82+
}
5583
]
5684
},
5785
{
5886
code: '<template><div :attr="[ a]" /></template>',
5987
output: '<template><div :attr="[a]" /></template>',
6088
options: ['never'],
61-
errors: ["There should be no space after '['."]
89+
errors: [
90+
{
91+
message: "There should be no space after '['.",
92+
line: 1,
93+
column: 24,
94+
endLine: 1,
95+
endColumn: 25
96+
}
97+
]
6298
},
6399
{
64100
code: '<template><div :attr="[a ]" /></template>',
65101
output: '<template><div :attr="[a]" /></template>',
66102
options: ['never'],
67-
errors: ["There should be no space before ']'."]
103+
errors: [
104+
{
105+
message: "There should be no space before ']'.",
106+
line: 1,
107+
column: 25,
108+
endLine: 1,
109+
endColumn: 26
110+
}
111+
]
68112
},
69113
{
70114
code: '<template><div :attr="[ a ]" /></template>',
71115
output: '<template><div :attr="[a]" /></template>',
72116
options: ['never'],
73117
errors: [
74-
"There should be no space after '['.",
75-
"There should be no space before ']'."
118+
{
119+
message: "There should be no space after '['.",
120+
line: 1,
121+
column: 24,
122+
endLine: 1,
123+
endColumn: 25
124+
},
125+
{
126+
message: "There should be no space before ']'.",
127+
line: 1,
128+
column: 26,
129+
endLine: 1,
130+
endColumn: 27
131+
}
76132
]
77133
},
78134
{
79135
code: '<template><div :attr="[ a]" /></template>',
80136
output: '<template><div :attr="[ a ]" /></template>',
81137
options: ['always'],
82-
errors: ["A space is required before ']'."]
138+
errors: [
139+
{
140+
message: "A space is required before ']'.",
141+
line: 1,
142+
column: 26,
143+
endLine: 1,
144+
endColumn: 27
145+
}
146+
]
83147
},
84148
{
85149
code: '<template><div :attr="[a ]" /></template>',
86150
output: '<template><div :attr="[ a ]" /></template>',
87151
options: ['always'],
88-
errors: ["A space is required after '['."]
152+
errors: [
153+
{
154+
message: "A space is required after '['.",
155+
line: 1,
156+
column: 23,
157+
endLine: 1,
158+
endColumn: 24
159+
}
160+
]
89161
},
90162
{
91163
code: '<template><div :attr="[a]" /></template>',
92164
output: '<template><div :attr="[ a ]" /></template>',
93165
options: ['always'],
94166
errors: [
95-
"A space is required after '['.",
96-
"A space is required before ']'."
167+
{
168+
message: "A space is required after '['.",
169+
line: 1,
170+
column: 23,
171+
endLine: 1,
172+
endColumn: 24
173+
},
174+
{
175+
message: "A space is required before ']'.",
176+
line: 1,
177+
column: 25,
178+
endLine: 1,
179+
endColumn: 26
180+
}
97181
]
98182
},
99183
{
100184
code: '<template><div :[[attr]]="[a]" /></template>',
101185
output: '<template><div :[[attr]]="[ a ]" /></template>',
102186
options: ['always'],
103187
errors: [
104-
"A space is required after '['.",
105-
"A space is required before ']'."
188+
{
189+
message: "A space is required after '['.",
190+
line: 1,
191+
column: 27,
192+
endLine: 1,
193+
endColumn: 28
194+
},
195+
{
196+
message: "A space is required before ']'.",
197+
line: 1,
198+
column: 29,
199+
endLine: 1,
200+
endColumn: 30
201+
}
106202
]
107203
}
108204
]

0 commit comments

Comments
 (0)