--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.cjs --- # Input ```cjs "use strict"; "use strict"; function test() { "use strict"; function inner_a() { "use strict"; // redundant directive } function inner_b() { function inner_inner() { "use strict"; // additional redundant directive } } } ``` # Diagnostics ``` invalid.cjs:2:1 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 1 │ "use strict"; > 2 │ "use strict"; │ ^^^^^^^^^^^^^ 3 │ 4 │ function test() { i This outer use strict directive already enables strict mode. > 1 │ "use strict"; │ ^^^^^^^^^^^^^ 2 │ "use strict"; 3 │ i Safe fix: Remove the redundant use strict directive. 1 1 │ "use strict"; 2 │ - "use·strict"; 3 2 │ 4 3 │ function test() { ``` ``` invalid.cjs:5:2 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 4 │ function test() { > 5 │ "use strict"; │ ^^^^^^^^^^^^^ 6 │ function inner_a() { 7 │ "use strict"; // redundant directive i This outer use strict directive already enables strict mode. > 1 │ "use strict"; │ ^^^^^^^^^^^^^ 2 │ "use strict"; 3 │ i Safe fix: Remove the redundant use strict directive. 3 3 │ 4 4 │ function test() { 5 │ - → "use·strict"; 6 │ - → function·inner_a()·{ 5 │ + → → function·inner_a()·{ 7 6 │ "use strict"; // redundant directive 8 7 │ } ``` ``` invalid.cjs:7:3 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 5 │ "use strict"; 6 │ function inner_a() { > 7 │ "use strict"; // redundant directive │ ^^^^^^^^^^^^^ 8 │ } 9 │ function inner_b() { i This outer use strict directive already enables strict mode. > 1 │ "use strict"; │ ^^^^^^^^^^^^^ 2 │ "use strict"; 3 │ i Safe fix: Remove the redundant use strict directive. 5 5 │ "use strict"; 6 6 │ function inner_a() { 7 │ - → → "use·strict";·//·redundant·directive 8 │ - → } 7 │ + → → → } 9 8 │ function inner_b() { 10 9 │ function inner_inner() { ``` ``` invalid.cjs:11:4 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 9 │ function inner_b() { 10 │ function inner_inner() { > 11 │ "use strict"; // additional redundant directive │ ^^^^^^^^^^^^^ 12 │ } 13 │ } i This outer use strict directive already enables strict mode. > 1 │ "use strict"; │ ^^^^^^^^^^^^^ 2 │ "use strict"; 3 │ i Safe fix: Remove the redundant use strict directive. 9 9 │ function inner_b() { 10 10 │ function inner_inner() { 11 │ - → → → "use·strict";·//·additional·redundant·directive 12 │ - → → } 11 │ + → → → → → } 13 12 │ } 14 13 │ } ```