Skip to content

Qml and Lint warnings and errors, at least one causing error in Qml.  #1469

@Light-Wizzard

Description

@Light-Wizzard

I want to use this project in Qml JavaScript,
I get many warnings and errors, I would like to address the ones that can and should be fixed, if for no other reason to get rid of warnings, as long as there is no unwanted consequences.

Qml JavaScript Engine is not the same as Web Browser JavaScript Engines, it does not require the use of "use strict";, because it is the default behavior, but this is more than a warning, it crashes.

In the example code below, the use of:

"use strict";

Crashes the loading of this code, I get this error on import:

MathJs.js:11050: TypeError: Type error

That line is:

ArgumentsError.prototype.constructor = Error;

if I replace

"use strict";

with

;"use strict";

It will run, thanks to MikeMcl for figuring this out,
but on further investiation I wound that changing it to:

'use strict';

Note the single quote, the first error goes away, the library loads,
but I still get an error message, even though the program runs,
and returns the correct answer, now changing that to:

;'use strict';

Gets rid of all error messages.

Do you want me to limit this thread to one issue, and change the title to use strict, closing each ticket one at a time, or just list each warning, and work on all of them in this ticket, one at a time, considering that most warnings are just normal Lint warnings, for example, Qml gives errors if you use new before a lower case function, causing you to change to a Capital letter if you want to use new, and lower case if you do not, and it does not like the use of == over ===, and it does not like the syntax like:

var algorithm14 = function algorithm14(a, b, callback, inverse) {

it wants:

var algorithm14 = function (a, b, callback, inverse) {

This is just a sample of what I want to address, and doing do in this tread works for me, but does it work for you?

I tested this change on my code in a Web Browser and it works, so the change from:

"use strict";

to

;'use strict';

Will not cause any issues for any JavaScript Engine I tested, but it needs to be tested on more Engines than I have access to, considering I only tested this on Linux.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions