Why this matters
Reassigning imported variables causes runtime errors and is prohibited in TypeScript. Modify properties on the imported object instead of reassigning the variable itself.
Ensure that imported variables are not reassigned. This can cause runtime errors, especially in TypeScript. Modify object properties instead of reassigning variables.
Reassigning imported variables causes runtime errors and is prohibited in TypeScript. Modify properties on the imported object instead of reassigning the variable itself.
Side-by-side examples engineers can pattern-match during review.
import { exportedObject } from 'module.js';
exportedObject = 'hello world!'; // Noncompliant: TypeError: Assignment to constant variable.import { exportedObject } from 'module.js';
exportedObject.newAttribute = 'hello world!'; // exportedObject now contains newAttribute and can be seen from all other modules importing it
import { exportedObject } from 'module.js';
exportedObject = 'hello world!'; // Noncompliant: TypeError: Assignment to constant variable.import { exportedObject } from 'module.js';
exportedObject.newAttribute = 'hello world!'; // exportedObject now contains newAttribute and can be seen from all other modules importing it
From the same buckets as this rule.
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.