Why this matters
Exporting mutable variables allows other modules to modify their values, making it difficult to track changes and leading to potential bugs. Use immutable exports to ensure predictable behavior.
Check if modules export mutable variables. Mutable exports can be modified by other modules, leading to unpredictable behavior. Recommend exporting immutable values instead.
Exporting mutable variables allows other modules to modify their values, making it difficult to track changes and leading to potential bugs. Use immutable exports to ensure predictable behavior.
Side-by-side examples engineers can pattern-match during review.
let mutableVar = "initial value";
export { mutableVar }; // Noncompliantconst immutableVar = "constant value";
export { immutableVar };let mutableVar = "initial value";
export { mutableVar }; // Noncompliantconst immutableVar = "constant value";
export { immutableVar };From the same buckets as this rule.