lloyAlloy on GitHub
prefer_new
Docs

prefer_new

Updated
stylewarn

X.new(...) in place of new X(...).

Flux. new X(...) is the constructor call, and it emits X.new(...). The lint fires when each part of the type path starts with a capital letter: Vector3.new(1, 2, 3), Net.Route.new(r), and HashMap.new<<string, number>>(). In an .alx file it also reads the markup: an attribute such as Size={UDim2.new(1, 0, 0, 24)}, and a {...} hole. A call that an ingot writes stays quiet. A lowercase name such as t.new() or self.new() may hold no class, so it stays quiet. X:new(), X.New(...), and a .new that nothing calls stay quiet too. The lint also stays quiet where new X does not build the same value: a call inside typeof(...), a call that a { ... } table follows, and an enum. So does a struct whose impl writes no new or writes New, and X.new() with no arguments inside the impl of X. alloy flux --fix writes new X over X.new and keeps the rest: X.new(a):m() becomes new X(a):m().

Set its level in the [lint] table of alloy.toml, or for one file with --@alloy-lint.