Skip to content

Commit

Permalink
add tests for computed-property-spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea committed Jun 13, 2020
1 parent 3de0a1c commit f2dc7f2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/lib/rules/computed-property-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1906,6 +1906,28 @@ ruleTester.run("computed-property-spacing", rule, {
endColumn: 19
}
]
},

// Optional chaining
{
code: "obj?.[1];",
output: "obj?.[ 1 ];",
options: ["always"],
parserOptions: { ecmaVersion: 2020 },
errors: [
{ messageId: "missingSpaceAfter", data: { tokenValue: "[" } },
{ messageId: "missingSpaceBefore", data: { tokenValue: "]" } }
]
},
{
code: "obj?.[ 1 ];",
output: "obj?.[1];",
options: ["never"],
parserOptions: { ecmaVersion: 2020 },
errors: [
{ messageId: "unexpectedSpaceAfter", data: { tokenValue: "[" } },
{ messageId: "unexpectedSpaceBefore", data: { tokenValue: "]" } }
]
}
]
});

0 comments on commit f2dc7f2

Please sign in to comment.