mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
docs(linter): improve docs for node/security/tree_shaking rules (#6097)
Related to #6050 As of this PR, all documents of that contain a few rules have been corrected.
This commit is contained in:
parent
d56264ee9a
commit
d4bed9a800
3 changed files with 15 additions and 2 deletions
|
|
@ -40,6 +40,7 @@ pub struct NoExportsAssign;
|
|||
|
||||
declare_oxc_lint!(
|
||||
/// ### What it does
|
||||
///
|
||||
/// Disallows assignment to `exports`.
|
||||
///
|
||||
/// ### Why is this bad?
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ declare_oxc_lint!(
|
|||
/// ```
|
||||
///
|
||||
/// ### What To Do Instead
|
||||
///
|
||||
/// :::warning
|
||||
/// The Oxc team are not security experts. We do not endorse any particular
|
||||
/// key management service or strategy. Do your research and choose the best
|
||||
|
|
|
|||
|
|
@ -116,12 +116,23 @@ declare_oxc_lint!(
|
|||
///
|
||||
/// ### Why is this bad?
|
||||
///
|
||||
/// ### Example
|
||||
/// Side-effects in module initialization can hinder tree-shaking, which aims to remove
|
||||
/// unused code. If side-effects exist, it's harder for the bundler to safely eliminate
|
||||
/// code, leading to larger bundles and potentially unexpected behavior. Ensuring minimal
|
||||
/// side-effects allows bundlers to optimize code effectively.
|
||||
///
|
||||
/// ### Examples
|
||||
///
|
||||
/// Examples of **incorrect** code for this rule:
|
||||
/// ```javascript
|
||||
/// myGlobal = 17; // Cannot determine side-effects of assignment to global variable
|
||||
/// const x = { [globalFunction()]: "myString" }; // Cannot determine side-effects of calling global function
|
||||
/// export default 42;
|
||||
/// ```
|
||||
///
|
||||
/// Examples of **correct** code for this rule:
|
||||
/// ```javascript
|
||||
/// const localVar = 17; // Local variable assignment, no global side-effects
|
||||
/// export default 42; // Pure export with no side-effects
|
||||
/// ```
|
||||
///
|
||||
/// ### Options
|
||||
|
|
|
|||
Loading…
Reference in a new issue