Unknown directive¶
ID: js/unknown-directiveKind: problemSecurity severity: Severity: warningPrecision: highTags: - quality - reliability - correctnessQuery 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"usestrict" directive, but due to the typo, the function will not execute in strict mode.
functionf(){"usestrict";...}
Correct the misspelling by replacing"usestrict" with"usestrict".
References¶
Mozilla Developer Network:“use strict”
asm.js:“use asm”