In Eisenbud's and Harris's "3264 & All That", they define the codimension of a subvariety $Y$ of a variety $X$ as $\operatorname{codim}_X(Y)=\dim(X)-\dim(Y)$. This part is fine and also agrees with the definition of the height of a prime ideal in the case that $X$ is an affine variety. However, they then define the codimension of a subvariety $Y$ of a scheme $X$ as the minimum of$$\{\operatorname{codim}_{X'}(Y): X'\text{ is a reduced irreducible component of }X\}.$$(Note: Eisenbud and Harris assume in their definition that schemes are separated and finite type over an algebraically closed field of characteristic $0$.)Now already this definition does not make sense since $Y$ may not be a subvariety of $X'$. But I will assume the set is meant to include the condition that $Y$ is a subvariety of $X'$. The issue is that this definition disagrees with other definitions of codimension I have seen as well as with the definition of height of a prime ideal. For example, consider the scheme $\operatorname{Spec}(k[x,y,z]/(xz,yz))$ which is the union of $\mathbb{A}^2\times\{0\}$ with $\{0\}^2\times\mathbb{A}^1$. Under Eisenbud's and Harris's definition, the codimension of the origin is $1$. But by the other definitions I have seen, the codimension should be $2$. Perhaps they meant to say maximum instead of minimum. I tried to look for an errata of the book online but could not find one.
There is also the issue that right after this definition, they state Krull's principal ideal theorem as "An ideal generated by $n$ elements in a Noetherian ring has codimension $\leq n$." But 1. they never define the codimension of an ideal (only prime ideals, via subvarieties), and 2. their definition of codimension of a prime ideal is not the same as its height, so this is different than the conventional Krull's principal ideal theorem.
Am I missing something, or is the book simply mistaken?