-
Notifications
You must be signed in to change notification settings - Fork 715
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
fix(demo/text): render 0 as number (#813) #814
Conversation
Pull Request Test Coverage Report for Build 138
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Looks good to me.
@ilariaventurini thanks for the fix! looks like the build is failing due to |
I edited the code using /Users/ilariaventurini/.../visx/packages/visx-text/src/Text.tsx
119:11 error Unexpected negated condition no-negated-condition
141:7 error Unexpected negated condition no-negated-condition So the build is failing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ilariaventurini , sorry for the misdirection in suggestiong eslint --fix
, it looks like that converted a lot of TypeScript any
s to unknown
which aren't equivalent, and now failed the build.
I think it's probably easiest to revert back to your first commit 9f98551, and then apply my suggested fix to reverse the negated condition. Then this should be good to go 🙏
packages/visx-text/src/Text.tsx
Outdated
@@ -138,7 +138,7 @@ class Text extends React.Component<TextProps, TextState> { | |||
} | |||
|
|||
updateWordsWithoutCalculate(props: TextProps) { | |||
const words = props.children ? props.children.toString().split(/(?:(?!\u00A0+)\s+)/) : []; | |||
const words = (props.children !== null && props.children !== undefined) ? props.children.toString().split(/(?:(?!\u00A0+)\s+)/) : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!=
I think is still ideal, but there is another lint rule which favors not having negated conditions (because they are harder to understand logically). So I think this should fix things:
const words = (props.children !== null && props.children !== undefined) ? props.children.toString().split(/(?:(?!\u00A0+)\s+)/) : []; | |
const words = props.children == null ? [] : props.children.toString().split(/(?:(?!\u00A0+)\s+)/); |
@ilariaventurini sorry looks like you still have all the auto lint fix stuff in here. when I said revert back to your first commit I meant run That commit had lint issues, so from there you should simply be able to make the change to |
e70c9b7
to
1d6b3f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ilariaventurini !
🐛 Bug Fix