sfcc/rhino-const-compat
Enforces let instead of const in Rhino-unsafe loop-related scopes.
What it checks
- Flags
constdeclarations in Rhino-critical scopes - Targets loop headers and declarations inside loop bodies where Rhino compatibility is a concern
Fix behavior
- Automatically rewrites the keyword from
consttolet
Why this rule exists
Rhino does not handle const reliably in some loop-related contexts. This rule keeps the code valid in those places and prevents the fixers from producing code that works in modern JavaScript but not on SFCC sandboxes.
Default behavior
- Severity:
error - Auto-fix: yes
Example
Invalid
js
for (const item of items) {
process(item)
}Valid
js
for (let item of items) {
process(item)
}