Skip to content

Commit 75904f0

Browse files
committed
initialising variable in the for loop instead of outside of it
1 parent 9595f13 commit 75904f0

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

src/binary-operator-printers/logical.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { shouldGroupOrIndent } from './utils/should-group-or-indent.js';
77
const { indent } = doc.builders;
88

99
const indentIfNecessaryBuilder = (path, options) => (document) => {
10-
let { node } = path;
11-
for (let i = 0; ; i += 1) {
10+
for (let i = 0, { node } = path; ; i += 1) {
1211
const parentNode = path.getParentNode(i);
1312
if (notIndentParentTypes.includes(parentNode.type)) return document;
1413
if (

src/binary-operator-printers/printers/create-indent-if-necessary-builder.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ export const notIndentParentTypes = [
1212

1313
export const createIndentIfNecessaryBuilder =
1414
(shouldIndentMatchers) => (path) => (document) => {
15-
let { node } = path;
16-
for (let i = 0; ; i += 1) {
15+
for (let i = 0, { node } = path; ; i += 1) {
1716
const parentNode = path.getParentNode(i);
1817
if (notIndentParentTypes.includes(parentNode.type)) return document;
1918
if (shouldGroupOrIndent(parentNode, shouldIndentMatchers))

0 commit comments

Comments
 (0)