In this paper a general class of linear cyclic codes $$C_{n,q,t}^i , 1\le i\le t$$ C n , q , t i , 1 ≤ i ≤ t , is defined of length $$n$$ n and over a field $${ GF}(q)$$ G F ( q ) with $$(n,q)=1$$ ( n , q ) = 1 . This class of codes includes as special cases quadratic residue codes, generalized quadratic residue codes, $$e$$ e -residue codes and $$Q$$ Q -codes. Furthermore, they partially overlap with the families of duadic, triadic and polyadic codes. Expressions for idempotent generators are derived in terms of the size of cyclotomic cosets mod $$n $$ n and coefficients of the irreducible polynomials over $${ GF}(q)$$ G F ( q ) dividing $$x^{n}-1$$ x n - 1 . As an auxiliary tool an orthonormal matrix is introduced whose columns correspond to these idempotents. Concrete examples are presented for $$t=2$$ t = 2 and $$n\in \{p^{\lambda },2p^{\lambda },2^{\lambda }\}, \lambda \ge 1$$ n ? { p ? , 2 p ? , 2 ? } , ? ? 1 , where $$p$$ p is an arbitrary odd prime. When $$n=p^{\lambda }$$ n = p ? or $$n=2p^{\lambda }$$ n = 2 p ? the codes all belong to the subclass of 2-residue codes. Using this technique, we determine the idempotents of the codes $$C_{2^{\lambda },q,2}^i $$ C 2 ? , q , 2 i , and recover those of the generalized quadratic codes $$C_{p^{\lambda },q,2}^i $$ C p ? , q , 2 i and of the codes $$C_{2p^{\lambda },q,2}^i $$ C 2 p ? , q , 2 i . In the final section the idempotents of the cubic residue codes $$C_{p,q,3}^i $$ C p , q , 3 i are constructed.