As far as I'm concerned, "free module$A$-module of rank $n$" means "$A$-module isomorphic to $A^n$. You just have to remember that a free module of rank $n$ is sometimes also a free module of rank $m$ even when $n$ is different from $m$. This happens for all $m$ and $n$ in the case of the $0$ ring. It also happens for some positive values of $m$ and $n$ for certain noncommutative rings.
EDIT Oh, I see: You were thinking of "rank of a module", not "rank of a free module". So if "rank" refers to how many independent elements there are, and if you have the urge to be all Bourbaki-careful about it, then you just have to choose between two definitions in the first place.
Option 1, the rank is the supremum of the sizes of sets of independent elements.
Option 2, it is the supremum of the sizes of indexed collections of independent elements.
The distinction has no effect (because two elements cannot be independent if they are equal) except in the case of the (unique up to unique isomorphism) module for the (unique up to unique isomorphism) $0$ ring, in which case Option 1 gives $1$ and Option 2 gives $\infty$. I think I prefer Option 2, because $1$ doesn't seem right. On the other hand, that $\infty$ doesn't really exist: it's trying to be the largest possible cardinal number. What a choice!