Skip to content

Replace deprecated xref: [exclude: ...] with elixirc_options: [no_warn_undefined: ...]#769

Merged
josevalim merged 1 commit into
elixir-ecto:masterfrom
gilbertwong96:fix-deprecated-xref-exclude
Jun 11, 2026
Merged

Replace deprecated xref: [exclude: ...] with elixirc_options: [no_warn_undefined: ...]#769
josevalim merged 1 commit into
elixir-ecto:masterfrom
gilbertwong96:fix-deprecated-xref-exclude

Conversation

@gilbertwong96

Copy link
Copy Markdown
Contributor

Elixir 1.20 deprecates the xref: [exclude: ...] project option in mix.exs in favor of elixirc_options: [no_warn_undefined: ...]. The new option suppresses the same undefined-module warning that the old xref exclude silenced for the optional Jason dependency.

Deprecation warning

warning: "xref: [exclude: ...]" in your mix.exs file is deprecated, instead use: "elixirc_options: [no_warn_undefined: ...]"
  (mix 1.20.1) lib/mix/tasks/compile.elixir.ex:243: Mix.Tasks.Compile.Elixir.xref_exclude_opts/2

Change

-      xref: [exclude: [Jason]]
+      elixirc_options: [no_warn_undefined: [Jason]]

Why [Jason] (bare module) rather than a tuple

The only references to Jason in the codebase are as default values for Application.get_env/3 (in lib/postgrex/types.ex, lib/postgrex/extensions/jsonb.ex, lib/postgrex/extensions/json.ex) — no Jason.foo/n function is called directly. The bare module form is the natural fit and matches the old xref: [exclude: [Jason]] semantics.

Verification

$ mix compile --force --warnings-as-errors
Compiling 70 files (.ex)
Generated postgrex app

No deprecation warning, no other warnings.

…n_undefined: ...]

Elixir 1.20 deprecates the xref: [exclude: ...] project option in mix.exs
in favor of elixirc_options: [no_warn_undefined: ...]. The new option
suppresses the same undefined-module warning that the old xref exclude
silenced for the optional Jason dependency.
@josevalim josevalim merged commit 4fb0e42 into elixir-ecto:master Jun 11, 2026
11 of 13 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants