Skip to content

Commit

Permalink
refactor: remove unneeded checks
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 22, 2024
1 parent dc10051 commit 3a9f997
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions src/rules/utils/padding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,26 +197,23 @@ const paddingTesters: { [T in PaddingType]: PaddingTester } = {
};

const createScopeInfo = (): ScopeInfo => {
return (() => {
let scope: Scope | null = null;
let scope: Scope | null = null;

return {
get prevNode() {
return scope?.prevNode ?? null;
},
set prevNode(node) {
if (scope) {
scope.prevNode = node;
}
},
enter() {
scope = { upper: scope, prevNode: null };
},
exit() {
scope = scope?.upper ?? null;
},
};
})();
// todo: explore seeing if we can refactor to a more TypeScript friendly structure
return {
get prevNode() {
return scope!.prevNode;
},
set prevNode(node) {
scope!.prevNode = node;
},
enter() {
scope = { upper: scope, prevNode: null };
},
exit() {
scope = scope!.upper;
},
};
};

/**
Expand Down

0 comments on commit 3a9f997

Please sign in to comment.