We prove pathwise large-deviation principles of switching Markov processes by exploiting the connection to associated Hamilton-Jacobi equations, following Jin Fengs and Thomas Kurtzs method. In the limit that we consider, we show how the large-deviation problem in path-space reduces to a spectral problem of finding principal eigenvalues. The large-deviation rate functions are given in action-integral form. As an application, we demonstrate how macroscopic transport properties of stochastic models of molecular motors can be deduced from an associated principal-eigenvalue problem. The precise characterization of the macroscopic velocity in terms of principal eigenvalues implies that breaking of detailed balance is necessary for obtaining transport. In this way, we extend and unify existing results about molecular motors and place them in the framework of stochastic processes and large-deviation theory.