Hamilton–Jacobi formalism for linearized gravity