Skip to content

Commit

Permalink
prefer-at: Fix typo and variable name (#1491)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Aug 17, 2021
1 parent d51a197 commit 8da2aec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/rules/prefer-at.md
Expand Up @@ -85,7 +85,7 @@ Example:
// eslint unicorn/prefer-at: ["error", {"checkAllIndexAccess": true}]
const foo = bar[10]; // Fails, will fix to `bar.at(10)`
const foo = bar[unknownProperty]; // Passes
const foo = string.chatAt(unknownIndex); // Fails
const foo = string.charAt(unknownIndex); // Fails
```

### getLastElementFunctions
Expand Down
4 changes: 2 additions & 2 deletions rules/prefer-at.js
Expand Up @@ -175,8 +175,8 @@ function create(context) {
const openingBracketToken = sourceCode.getTokenBefore(indexNode, isOpeningBracketToken);
yield fixer.replaceText(openingBracketToken, '.at(');

const isClosingBraceToken = sourceCode.getTokenAfter(indexNode, isClosingBracketToken);
yield fixer.replaceText(isClosingBraceToken, ')');
const closingBracketToken = sourceCode.getTokenAfter(indexNode, isClosingBracketToken);
yield fixer.replaceText(closingBracketToken, ')');
},
};
},
Expand Down

0 comments on commit 8da2aec

Please sign in to comment.