Unknown directiveΒΆ
ID: js/unknown-directive
Kind: problem
Severity: warning
Precision: high
Tags:
- correctness
Query suites:
- javascript-security-and-quality.qls
Click to see the query in the CodeQL repository
If a directive is accidentally misspelled, it will have no effect.
RecommendationΒΆ
Correct the misspelling.
ExampleΒΆ
The following code snippet shows a function that contains a "usestrict" directive. Most likely, the programmer intended this to be a "use strict" directive, but due to the typo, the function will not execute in strict mode.
function f() {
"usestrict";
...
}
Correct the misspelling by replacing "usestrict" with "use strict".
ReferencesΒΆ
Mozilla Developer Network: βuse strictβ
asm.js: βuse asmβ