Here's a recursive pattern test that checks for lists of lists of...of lists of integers, that is, of arbitrarily nested lists of integers.
nestedListOfIntegerQ = MatchQ[#, {(_Integer | _?nestedListOfIntegerQ) ...}] &;
f[x_?nestedListOfIntegerQ] := Depth[x];
More examples of nested lists:
MatchQ[{1, 2, 3}, _?nestedListOfIntegerQ]
(* True *)
MatchQ[{{1, 2, 3}, {4, 5, 6}}, _?nestedListOfIntegerQ]
(* True *)
MatchQ[{{2}, {3, {4}, 5}}, _?nestedListOfIntegerQ]
(* True *)
(* Allows empty lists *)
MatchQ[{{}, {{}}}, _?nestedListOfIntegerQ]
(* True *)
Use double-dot ..
(Repeated
) instead of the triple-dot ...
(RepeatedNull
) to match nested lists, none of which are empty. If you want a mix, you'll have to specify an explicit pattern for the specific mix.