Valence electrons are those electrons furthest from the nucleus that engage in reactions. These are the electrons in the outermost shells. Whether it is covalent, or ionic bonding, we are talking about the electrons in the outer shell only.
It’s important to remember the most stable anatomic configurations are those where the valence electron shell is completely filled. The noble gases: helium, neon, argon, krypton, xeon, radon all have completely filled shells, so are one of the few things in nature to exist purely in their anatomical form.