strict
Added in v0.5.0Configuration
rslint.config.ts
Rule Details
Require or disallow strict mode directives ("use strict").
The rule supports four options:
"safe"(default) — uses"function"semantics for scripts and"global"semantics for CommonJS files; module files always use"module"semantics."never"— disallows all strict mode directives."global"— requires exactly one strict directive in global scope and disallows all other directives."function"— requires one strict directive in each top-level function and disallows directives in the global scope or in nested functions / class bodies.
When languageOptions.sourceType is "module", the rule always uses module semantics: every "use strict" directive is reported as unnecessary and removed by autofix.
Differences from ESLint
The parserOptions.ecmaFeatures.impliedStrict and globalReturn options are
not supported.
Examples
"never"
Examples of incorrect code:
Examples of correct code:
"global"
Examples of incorrect code:
Examples of correct code:
"function"
Examples of incorrect code:
Examples of correct code: