Skip to content

Commit

Permalink
Fix map-keys-quotes end positions (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous committed Dec 13, 2023
1 parent 11bae4f commit fb753d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/rules/map-keys-quotes/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,16 @@ testRule({
warnings: [
{
line: 2,
column: 9,
column: 17,
endLine: 2,
endColumn: 26,
message: messages.expected
},
{
line: 2,
column: 9,
column: 34,
endLine: 2,
endColumn: 39,
message: messages.expected
}
],
Expand Down
9 changes: 5 additions & 4 deletions src/rules/map-keys-quotes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,18 @@ function rule(primary) {
// Identify all of the map-keys and see if they're strings (not words).
const mapKeys = returnMapKeys(node.nodes);

mapKeys.forEach(map_key => {
if (mathOperators.includes(map_key.value)) {
mapKeys.forEach(mapKey => {
if (mathOperators.includes(mapKey.value)) {
return;
}

if (map_key.type === "word" && isNaN(map_key.value)) {
if (mapKey.type === "word" && isNaN(mapKey.value)) {
utils.report({
message: messages.expected,
node: decl,
result,
ruleName
ruleName,
word: mapKey.value
});
}
});
Expand Down

0 comments on commit fb753d0

Please sign in to comment.