unnecessaryUseStricts
Reports unnecessary "use strict" directives in ES modules and classes.
✅ This rule is included in the ts logical presets.
ECMAScript modules and class bodies are automatically in strict mode.
The "use strict" directive has no effect in these contexts and is redundant.
This rule reports on "use strict" directives that can be safely removed.
Examples
Section titled “Examples”"use strict";
export function function calculate(value: number): number
calculate(value: number
value: number) { return value: number
value * 2;}
export class class Calculator
Calculator { Calculator.add(a: number, b: number): number
add(a: number
a: number, b: number
b: number) { return a: number
a + b: number
b; }}export function function calculate(value: number): number
calculate(value: number
value: number) { return value: number
value * 2;}
export class class Calculator
Calculator { Calculator.add(a: number, b: number): number
add(a: number
a: number, b: number
b: number) { return a: number
a + b: number
b; }}Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”If you are working in a JavaScript environment with non-standard semantics, or otherwise have tooling that requires you to use seemingly redundant "use strict" directives, this rule might not be for you.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noRedundantUseStrict
Made with ❤️🔥 around the world by
the Flint team and contributors.