Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4832

Add typescript-eslint/no-unnecessary-condition to our src linting

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      Use Case

      As a node engineer
      I want to catch cases where I'm using a condition that is unnecessary
      So that I can find bugs related to if stmts that will always be entered, nullish coalescing that won't be used etc.

      User Impact

      • None, well only improvements if we detect bugs

      Dependencies

      • None

      Unknowns

      • How many bugs will this reveal? there are 188 errors when enabled but some might be caused by weak types rather than a real issue.
      • How do we want to handle bugs? Depending on severity we want to ignore the lint rule and file a follow up, so that the bug is captured the changelog

      Acceptance Criteria

      Implementation Requirements

      • Within the src/*/.ts override in our eslintrc.json file add the typescript-eslint/no-unnecessary-condition
      • Work through the errors, try to avoid code changes unless a very simple fix that doesn't actually correct a bug but refactors to avoid the reported issue
      • Consider adding the no-implicit-coercion rule as well, though this is a stylistic choice, so its change impact may be greater than the value it provides

      Testing Requirements

      • None

      Documentation Requirements

      • None

      Follow Up Requirements

      • File ticket for any real bugs uncovered by lint rule

            Assignee:
            Unassigned Unassigned
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: