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

Strict boolean expressions #1046

Closed
14 tasks done
relu91 opened this issue Jul 31, 2023 · 1 comment · Fixed by #1127
Closed
14 tasks done

Strict boolean expressions #1046

relu91 opened this issue Jul 31, 2023 · 1 comment · Fixed by #1127
Labels
enhancement New feature or request

Comments

@relu91
Copy link
Member

relu91 commented Jul 31, 2023

We probably need to scan the whole codebase for cases like these at some point – IIRC, there are a number of places where we check for "falsy" values instead of undefined or null. I think there is the possibility to make the eslint rules a bit stricter in this regard to help us with that.

Originally posted by @JKRhb in #1042 (comment)

As mentioned above, we are not currently verifying that our codebase uses the boolean expressions correctly. As we all know the nullish values can sometimes by tricked and led us to unwanted bugs (as the bugs that the PR above was solving). I tried to enable "@typescript-eslint/strict-boolean-expressions": "error" into our eslint file, but that requires strictNullChecks to be enabled in tsconfig.json. Therefore, I suggest first completing the long standing #758 and then looking back to this issue.

Packages to be fixed:

  • binding-coap
  • binding-modbus
  • browser-bundle
  • binding-file
  • binding-mqtt
  • cli
  • binding-netconf
  • core
  • binding-opcua
  • examples
  • binding-websocket
  • td-tools
  • binding-http
  • binding-mbus
@danielpeintner
Copy link
Member

I suggest to fix the issue step by step like in #758. That's why I added the "packages to be fixed list" above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants