Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

security.language

Avoid `with` statements

`with` statements make binding resolution unpredictable and are disallowed in strict mode.

#Metadata

Rule ID
ts.security.no-with-statement
Severity
high
Confidence
0.98
Languages
javascript, typescript
Presets
recommended, security, strict
Stability
stable
Applies to
block
Tags
language, rules-catalog, security

#Why it matters

The `with` statement introduces dynamic scope and makes static analysis, optimization, and security review unreliable.

#Remediation

Replace the `with` block with explicit property access on a named object.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.security.no-with-statement.rule.yaml.