Conversation
✅ Deploy Preview for selfoss canceled.
|
`confirm` always returns bool.
The zero check was introduced in 9ace777. But the property type is `string | null` on the client and my personal selfoss instance with pretty old database only seems to return valid icon file names or null. In theory, a database could contain a literal `'0'` string but again, I have used selfoss for ages, and my database only contains `NULL`, empty string (mapped to NULL since 980882b) or a file name in the `items.icon` column.
It can be an empty sting sometimes, normalize it to `null`. This should probably be done in migration once but we should check that we will not reintroduce it.
Using weak comparison is overly confusing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness https://dorey.github.io/JavaScript-Equality-Table/ Let’s switch to strict one where the value domain is clear and enforce this with an eslint rule: https://eslint.org/docs/latest/rules/eqeqeq In places where the correctness was not obvious, adding a suppression comment until it is cleared.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using weak comparison is overly confusing:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Equality_comparisons_and_sameness
https://dorey.github.io/JavaScript-Equality-Table/
Let’s switch to strict one where the value domain is clear and enforce this with an eslint rule:
https://eslint.org/docs/latest/rules/eqeqeq
In places where the correctness was not obvious, adding a suppression comment until it is cleared.
Marked as WIP since the normalization in items dao should be part of migration.