Skip to content

Commit ed84c3d

Browse files
Address code review feedback: use getTokenAfter() for whitespace handling, fix .gitignore comment
Co-authored-by: NullVoxPopuli <[email protected]>
1 parent e2e2e1f commit ed84c3d

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ npm-debug.log
1515
# eslint-remote-tester
1616
eslint-remote-tester-results
1717

18-
# Lock file (project uses pnpm)
18+
# Lock file generated by npm install (project uses pnpm)
1919
package-lock.json

lib/rules/no-tracked-built-ins.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ module.exports = {
127127
fix(fixer) {
128128
const sourceCode = context.getSourceCode();
129129
const newKeyword = sourceCode.getFirstToken(node);
130+
const calleeToken = sourceCode.getTokenAfter(newKeyword);
130131
const fixes = [
131-
// Remove the `new` keyword and the space after it
132-
fixer.removeRange([newKeyword.range[0], newKeyword.range[1] + 1]),
132+
// Remove the `new` keyword and any whitespace up to the callee
133+
fixer.removeRange([newKeyword.range[0], calleeToken.range[0]]),
133134
];
134135
// Only rename the callee if it's not aliased
135136
if (!isAliased) {

0 commit comments

Comments
 (0)