no-with
JavaScript / TypeScriptsuspiciousno fixdefault: errorjs/eslint-recommendedjs/biome-recommendedjs/oxlint
What it does
Section titled “What it does”Reports a with statement.
Why it matters
Section titled “Why it matters”Inside with (obj) { ... } every name may be a property of obj or a variable, and which one it is depends on obj at run time, so neither a reader nor a tool can tell what b in with (a) { b } refers to. The statement is a syntax error in strict mode and in ES modules, so a file that uses it cannot be turned into a module later.
To fix, name the object in each access (a.b) or copy the properties you need into variables before the block.
Example
Section titled “Example”...with (a) { b; }...Configuration
Section titled “Configuration”js: lint: rules: no-with: error # off, warn, error (default)Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.
Suppress one line with sudsy-disable-next-line no-with in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint | no-with |
full |