Closed xor-gate closed 2 years ago
This is strange, because we do lint the source code. It's part of the build process. I have no idea why you are seeing those errors. Perhaps Qt doesn't know how to deal with minified source?
I have tried with the non-minified released js (same 3.1.6 version). The result the same:
QWARN : TestJTemplate::simpleTemplate() qt.qml.compiler: file:file:ejs.min.js:1:499 Variable "u" is used before its declaration at 1:737.
QWARN : TestJTemplate::simpleTemplate() qt.qml.compiler: file:file:ejs.min.js:1:508 Variable "u" is used before its declaration at 1:737.
QWARN : TestJTemplate::simpleTemplate() qt.qml.compiler: file:file:ejs.min.js:1216:23 Variable "substr" is used before its declaration at 1422:5.
If i look in the sourcecode on line 1422:
var substr = 'ab'.substr(-1) === 'b'
indeed on line 1216 substr
is used:
trailingSlash = substr(path, -1) === '/';
Probably the build file is not linted and Qt javascript engine is right.
I'm not experienced with javascript and according to the reference <text>.substr()
function is available and the substr function is declared by ejs.
The weird thing is the variable "u" could not be found by manually looking at those reported warning lines.
It's no big deal, probably it is due to some oddities with the Qt 6 javascript engine. Thanks for your time, I will close it as its only a warning.
I'm using ejs.min.js latest v3.1.6 release in combination with the Qt 6 QJSEngine (written in C++) and we get the following warnings:
As the file is minified it is difficult to point to the correct line in the source file. But this warning should be easy fixed if running a javascript linter over the ejs sourcecode. I'm not experienced in the javascript development ecosystem so not sure which linters are available. Hope this is issue information is clear enough.