Skip to content

test(array-bracket-newline): make tests more strict #2799

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 1 commit into from
Jul 18, 2025
Merged
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
124 changes: 110 additions & 14 deletions tests/lib/rules/array-bracket-newline.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,70 +40,166 @@ tester.run('array-bracket-newline', rule, {
{
code: '<template><div :attr="[\na]" /></template>',
output: '<template><div :attr="[a]" /></template>',
errors: ["There should be no linebreak after '['."]
errors: [
{
message: "There should be no linebreak after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
}
]
},
{
code: '<template><div :attr="[a\n]" /></template>',
output: '<template><div :attr="[a]" /></template>',
errors: ["There should be no linebreak before ']'."]
errors: [
{
message: "There should be no linebreak before ']'.",
line: 2,
column: 1,
endLine: 2,
endColumn: 2
}
]
},
{
code: '<template><div :attr="[\na\n]" /></template>',
output: '<template><div :attr="[a]" /></template>',
errors: [
"There should be no linebreak after '['.",
"There should be no linebreak before ']'."
{
message: "There should be no linebreak after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
},
{
message: "There should be no linebreak before ']'.",
line: 3,
column: 1,
endLine: 3,
endColumn: 2
}
]
},
{
code: '<template><div :attr="[\na]" /></template>',
output: '<template><div :attr="[a]" /></template>',
options: ['never'],
errors: ["There should be no linebreak after '['."]
errors: [
{
message: "There should be no linebreak after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
}
]
},
{
code: '<template><div :attr="[a\n]" /></template>',
output: '<template><div :attr="[a]" /></template>',
options: ['never'],
errors: ["There should be no linebreak before ']'."]
errors: [
{
message: "There should be no linebreak before ']'.",
line: 2,
column: 1,
endLine: 2,
endColumn: 2
}
]
},
{
code: '<template><div :attr="[\na\n]" /></template>',
output: '<template><div :attr="[a]" /></template>',
options: ['never'],
errors: [
"There should be no linebreak after '['.",
"There should be no linebreak before ']'."
{
message: "There should be no linebreak after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
},
{
message: "There should be no linebreak before ']'.",
line: 3,
column: 1,
endLine: 3,
endColumn: 2
}
]
},
{
code: '<template><div :attr="[\na]" /></template>',
output: '<template><div :attr="[\na\n]" /></template>',
options: ['always'],
errors: ["A linebreak is required before ']'."]
errors: [
{
message: "A linebreak is required before ']'.",
line: 2,
column: 2,
endLine: 2,
endColumn: 3
}
]
},
{
code: '<template><div :attr="[a\n]" /></template>',
output: '<template><div :attr="[\na\n]" /></template>',
options: ['always'],
errors: ["A linebreak is required after '['."]
errors: [
{
message: "A linebreak is required after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
}
]
},
{
code: '<template><div :attr="[a]" /></template>',
output: '<template><div :attr="[\na\n]" /></template>',
options: ['always'],
errors: [
"A linebreak is required after '['.",
"A linebreak is required before ']'."
{
message: "A linebreak is required after '['.",
line: 1,
column: 23,
endLine: 1,
endColumn: 24
},
{
message: "A linebreak is required before ']'.",
line: 1,
column: 25,
endLine: 1,
endColumn: 26
}
]
},
{
code: '<template><div :[[attr]]="[a]" /></template>',
output: '<template><div :[[attr]]="[\na\n]" /></template>',
options: ['always'],
errors: [
"A linebreak is required after '['.",
"A linebreak is required before ']'."
{
message: "A linebreak is required after '['.",
line: 1,
column: 27,
endLine: 1,
endColumn: 28
},
{
message: "A linebreak is required before ']'.",
line: 1,
column: 29,
endLine: 1,
endColumn: 30
}
]
}
]
Expand Down