Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: invert some conditionals for better readability #335

Merged
merged 1 commit into from
Jun 1, 2022

Commits on May 31, 2022

  1. refactor: invert some conditionals for better readability

    - 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
    agilgur5 committed May 31, 2022
    Configuration menu
    Copy the full SHA
    e75807d View commit details
    Browse the repository at this point in the history