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 Apr 26, 2024
1 parent ab9417b commit df85861
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 df85861

Please sign in to comment.