Skip to content

Commit

Permalink
docs: better explanation of the directive "use strict" (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored May 3, 2024
1 parent 9db5f0e commit 4f795de
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ use biome_rowan::{declare_node_union, AstNode, BatchMutationExt};
declare_rule! {
/// Prevents from having redundant `"use strict"`.
///
/// The directive `"use strict"` **isn't** needed in `.mjs` files, or in `.js` files inside projects where the `package.json` defines library as module:
///
///
/// ```json,ignore
/// {
/// "type": "module"
/// }
/// ```
///
/// Instead, `.cjs` files are considered "scripts" and the directive `"use strict"` is accepted and advised.
///
/// Note that the leading trivia, e.g., comments or newlines preceding
/// the redundant `"use strict"` will also be removed. So that comment
/// directives won't be transferred to a wrong place.
Expand Down

0 comments on commit 4f795de

Please sign in to comment.