In IJulia notebooks, you can set IJulia.SOFTSCOPE[] = false to use the non-interactive scoping rules. (This is documented.)
In the REPL, you can do
empty!(Base.active_repl_backend.ast_transforms)
(which is undocumented: document REPL `ast_transforms` · Issue #37047 · JuliaLang/julia · GitHub) to use the non-interactive scoping rules.