Skip to content

Dont-Use-With

Sourcery rule id: dont-use-with

Description

Avoid using with statements.

Match

with (thing) {
  y = 5;
  x = 2;
}

Explanation

The with statement is deprecated, and may cease to work in browsers at any time.

with gives short-hand access to an object's properties, but the scope is inconsistent and it's better just to use normal attribute setting.