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 24, 2024
1 parent 81437aa commit d8b49bd
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
@@ -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;
},
};
};

/**

0 comments on commit d8b49bd

Please sign in to comment.