In JavaScript, assigning to a const variable is an error and causes an exception to be thrown at runtime. This rule disallows assigning to constant variable declarations.
Non-Compliant Code Examples
consta=0;a=1;constb=0;b+=1;constc=0;++c;
Compliant Code Examples
consta=0;console.log(a);for(constain[1,2,3]){// `a` is re-defined (not modified) on each loop step.
console.log(a);}
Seamless integrations. Try Datadog Code Analysis
Datadog Code Analysis
Try this rule and analyze your code with Datadog Code Analysis
How to use this rule
1
2
rulesets:- javascript-best-practices # Rules to enforce JavaScript best practices.
Create a static-analysis.datadog.yml with the content above at the root of your repository
Use our free IDE Plugins or add Code Analysis scans to your CI pipelines