Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: invert some conditionals for better readability (#335)
- a few `if (cond) { big block } return` could be inverted to `if (!cond) return` then the block unindented instead - generally speaking, this makes it a lot more readable (less indentation, etc) and follows the existing code style in much of the codebase, where it's a few quick one-line ifs and then just the rest of the code - shorten the resolvedFileName conditional by using optional chaining - prefer the simpler `x?.y` over the older `x && x.y` syntax - add a `resolved` variable for less repetition of the whole statement - add a comment to the `pathNormalize` line about why it's used in that one place and link to the longer description in the PR as well - shorten comment about `useTsconfigDeclarationDir` so it doesn't take up so much space or look so important as a result - and it's easier to read this way and I made the explanation less verbose and quicker to read too - remove the `else` there and just add an early return instead, similar to the inverted conditionals above - similarly makes it less unindented, more readable etc
- Loading branch information
Showing
2 changed files
with
62 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters