Maxwell's equations in tensor notation read:
\begin{align} \partial_\mu F^{\mu\nu} &= J^\nu \\ \partial_{[\lambda}F_{\mu\nu]} &= 0 \end{align}
Consider doing a general coordinate transformation $x^\mu \rightarrow x^{\mu'}$ on the first equation. (NB: everything that follows applies also to the second equation.) Writing the equation in primed coordinates and then expanding in terms of unprimed coordinates, we find that the equation transforms to:
\begin{equation} \frac{\partial x^\lambda}{\partial x^{\mu '}} \frac{\partial^2 x^{\mu '}}{\partial x^\lambda \partial x^\mu} \frac{\partial x^{\nu '}}{\partial x^\nu} F^{\mu\nu} + \frac{\partial x^\lambda}{\partial x^{\mu '}} \frac{\partial x^{\mu '}}{\partial x^\mu} \frac{\partial^2 x^{\nu '}}{\partial x^\lambda \partial x^\nu} F^{\mu\nu} + \frac{\partial x^\lambda}{\partial x^{\mu '}}\frac{\partial x^{\mu '}}{\partial x^{\mu }}\frac{\partial x^{\nu '}}{\partial x^{\nu }} \frac{\partial}{\partial x^\lambda} F^{\mu\nu} = \frac{\partial x^{\nu '}}{\partial x^{\nu }} J^{\nu } \end{equation}
A sufficient condition for the equation to be invariant under this transformation is that the first two terms on the left hand side vanish, and a sufficient condition for that to happen is that:
\begin{equation} \frac{\partial^2 x^{\mu '}}{\partial x^\lambda \partial x^\mu} = 0 \end{equation}
Integrating this equation, we find that this Maxwell equation will be invariant under a linear coordinate transformation:
\begin{equation} x^{\mu '} = M{^{\mu'}_{\ \ \mu}} x^\mu + a^{\mu'} \end{equation}
Here, $M{^{\mu'}_{\ \ \mu}}$ is a constant matrix and $a^{\mu'}$ is a constant vector.
Formally, this is true for all linear transformations, not just Lorentz transformations. Of course, one can appeal to the existence of a Minkowski metric field to restrict $M{^{\mu'}_{\ \ \mu}}$ to be a Lorentz matrix. However, this does not change the fact that this equation seems to be formally invariant under all linear transformations. And I didn't think it was meant to be true that Maxwell's equations were invariant under all linear transformations!
So: can someone sort me out here? Are the two equations above actually invariant under all linear transformations, or have I made an error here?