All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rules.jshint.E052.html Maven / Gradle / Ivy

Go to download

Consume reports generated by jshint for code quality. Also consume reports for code duplication (either simian or cpd). Consumes the unit/integration tests reports (generated by Jasmin) coverage report (lcov generated by Istanbul). The information generated by reports are added in Sonar

There is a newer version: 2.1.0
Show newest version

    

When do I get this error?

The "Unclosed mega literal" error is thrown when JSLint encounters an unclosed template string literal. JSHint raises the "Unclosed template literal" error in the same situation. Note that because template string literals are an ES2015 (ES6) feature this error should only appear when linting ES2015 code with the appropriate option set in the linter.

In the following example we attempt to assign an unclosed template string literal to a:

/*jslint es6: true */
let x = `unclosed;

Why do I get this error?

This error is raised to highlight a fatal JavaScript syntax error. Your code will not run unless you fix this issue. The ECMAScript grammar states that any template literal must be closed by the backtick character (ES2015 §11.8.68):

Template ::
    NoSubstitutionTemplate
    TemplateHead

NoSubstitutionTemplate ::
    ` TemplateCharactersopt `

The grammar for NoSubstitutionTemplate is straightforward and shows the necessary backticks. The second production is far more complicated and beyond the scope of this article but does also require an opening and closing backtick.

To fix the error, simply close any unclosed template strings:

/*jslint es6: true */
let x = `unclosed`;

In JSHint 1.0.0 and above you have the ability to ignore any warning with a special option syntax. Since this message relates to a fatal syntax error you cannot disable it.





© 2015 - 2025 Weber Informatics LLC | Privacy Policy