Hi!
After looking at code for a little longer, it's seems that there are many introduced side-effects, which will be VERY tiring to find with the naked eye 👁️ . What do you think about adding eslint and looking what`s up? After linting with simple set of rules, there is indeed some interesting places, which can lead to bugs/side-effects, and also some code-style inconsistencies.
For example in addTextBackground of svg canvas:
|
if (s.fontBackgroundColor != null || s.fontBorderColor != null) { |
|
let bbox = null; |
There is checks for null, but when porting, null initialization replaced with NONE value, so this check will never work again, which lead to calling very time-consuming code of addTextBackground.
|
fontBackgroundColor: ColorValue; |
|
fontBorderColor: ColorValue; |
|
fontBackgroundColor: NONE, |
|
fontBorderColor: NONE, |
But with right set of rules eslint is able to find it and scream warning Unnecessary conditional, the types have no overlap
Will be happy to make PR with eslint configured, if you interested :)
Hi!
After looking at code for a little longer, it's seems that there are many introduced side-effects, which will be VERY tiring to find with the naked eye 👁️ . What do you think about adding eslint and looking what`s up? After linting with simple set of rules, there is indeed some interesting places, which can lead to bugs/side-effects, and also some code-style inconsistencies.
For example in
addTextBackgroundof svg canvas:maxGraph/packages/core/src/view/canvas/SvgCanvas2D.ts
Lines 1755 to 1756 in 02ea6f1
There is checks for
null, but when porting,nullinitialization replaced withNONEvalue, so this check will never work again, which lead to calling very time-consuming code ofaddTextBackground.maxGraph/packages/core/src/types.ts
Lines 232 to 233 in 02ea6f1
maxGraph/packages/core/src/view/canvas/AbstractCanvas2D.ts
Lines 166 to 167 in 02ea6f1
But with right set of rules
eslintis able to find it and scream warningUnnecessary conditional, the types have no overlapWill be happy to make PR with
eslintconfigured, if you interested :)