--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.js --- # Input ```jsx // js module "use strict"; // Associated comment function foo() { "use strict"; } class C1 { // All code here is evaluated in strict mode test() { "use strict"; } } const C2 = class { // All code here is evaluated in strict mode test() { "use strict"; } }; ``` # Diagnostics ``` invalid.js:2:1 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 1 │ // js module > 2 │ "use strict"; // Associated comment │ ^^^^^^^^^^^^^ 3 │ 4 │ function foo() { i The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it. i Safe fix: Remove the redundant use strict directive. 1 1 │ // js module 2 │ - "use·strict";·//·Associated·comment 3 2 │ 4 3 │ function foo() { ``` ``` invalid.js:5:2 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 4 │ function foo() { > 5 │ "use strict"; │ ^^^^^^^^^^^^^ 6 │ } 7 │ i The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it. i Safe fix: Remove the redundant use strict directive. 3 3 │ 4 4 │ function foo() { 5 │ - → "use·strict"; 6 │ - } 5 │ + → } 7 6 │ 8 7 │ class C1 { ``` ``` invalid.js:11:3 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 9 │ // All code here is evaluated in strict mode 10 │ test() { > 11 │ "use strict"; │ ^^^^^^^^^^^^^ 12 │ } 13 │ } i The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it. i Safe fix: Remove the redundant use strict directive. 9 9 │ // All code here is evaluated in strict mode 10 10 │ test() { 11 │ - → → "use·strict"; 12 │ - → } 11 │ + → → → } 13 12 │ } 14 13 │ ``` ``` invalid.js:18:3 lint/suspicious/noRedundantUseStrict FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Redundant use strict directive. 16 │ // All code here is evaluated in strict mode 17 │ test() { > 18 │ "use strict"; │ ^^^^^^^^^^^^^ 19 │ } 20 │ }; i The entire contents of JavaScript modules are automatically in strict mode, with no statement needed to initiate it. i Safe fix: Remove the redundant use strict directive. 16 16 │ // All code here is evaluated in strict mode 17 17 │ test() { 18 │ - → → "use·strict"; 19 │ - → } 18 │ + → → → } 20 19 │ }; 21 20 │ ```