Closed plantago closed 1 year ago
Good catch, will add it in the next patch! Thx, @plantago
Hi @plantago ,
after looking into your problem and suggestion a bit more in detail, I think that's not what @r-murphy has intended with the sourceRoot
property. While trying your suggested fix, I found some tests which failed and this made me reconsidering and investigating how this option finally was meant to work.
In cases like controllers with the extension .controller.js
(even though if this is still valid or not) the plugin by default converts this class unless the option autoConvertAllExtendClasses
is set to false. In this case and without specifying the namespace with a decorator or a JSDoc annotation, the name is derived relative to the sourceRoot
. If we now change the behavior here, all classes will be auto converted just with the definition of the sourceRoot
property. This will change affect existing apps now so that all classes extending others will be converted. AFAICS this is not expected.
But in your case if you want to make this work, you can force your expected behavior by specifying the sourceRoot
and set the plugin option autoConvertAllExtendClasses
to true
.
HTH and BR, Peter
I tried not to use JSDoc
@namespace
or decorator@namespace()
and also specified thesourceRoot
setting in.babelrc
but my class was not converted toBaseClass.extend(...)
form.I have debugged the plugin and have found that
function shouldConvertClass
does not checkclassInfo.fileNamespace
in the followingif
statement:If I add
classInfo.fileNamespace
:then my class is converted.