This is less of an answer (unless you'll accept "no way" as one), and more of an extended comment.
Missing a shaft or two is not a big deal.
But lighting up caves for spawner efficiency is a huge work, as you need to proof all caves in 128 meter sphere around your position at killing floor.
I've done it once and vowed to never again build a spawner in the ground.
See: I made shafts every 20 meters in one cardinal direction, starting from a main shaft in the other direction (like a branch mine), making a circle of 140, to be sure.
That gives 280 + 280 + 280 + 260 + 240 + 220 + 180 + 100 = 1840 meters of pure mining, without spelunking, per level of which you'd want three (to cover 64 meters of depth at 20 meters between levels).
Adding vertical access, some ease of navigation and diagonal shafts that you'll dig a lot of to find caves by sound we have quite above six kilometers of digging, plus cave adventures (imagine those multi-leveled jagged open caves with holes in the ceiling raining creepers!).
And the surface.
You have to light up almost 20 acres of land, more than 70000 square meters - or always be sure to sleep the nigh over.
So, my advice is: make your spawner in the sky.
128 meters above surface, or 100 above ocean, and you're all set and are only dealing with its ugliness (build it away, go via portal).
gaming.stackexchange.com/users/33619/Orc JMR
If you build your spawner on the surface (rather than in the sky), you will need to find and light up all of the caves, there is no way around it.
Personally I find the "x-ray machine" to be "cheating" and instead have my own technique for finding caves.
Create a grid of holes about 8 or 16 blocks apart (depending on how accurate you want to be).
These holes should be dug from the surface to the bottom of the map (or at least until you reach the infamous "lava layer").
The added bonus with this technique is these holes to the surface will also prevent any void fog at the bottom of your world.
If you use this technique, to be on the safe side, put everything except the necessities (torches for if you find caves, and tools needed to dig: pickaxe, shovel, sword; all of which can be of stone or iron) in a chest so as to not lose it if you fall into a pool of lava or appear in a dangerous area.
gaming.stackexchange.com/users/17179/IQAndreas
To prevent spawning in caves, you need to fill them in, light them up or flood them with water (or lava).
There are a few ways to do it.
Manual work World editing mods (such as WorldEdit ) External world editing tools (such as MCEdit )
Manual work is the hardest option, but doesn't have side-effects: while mods and editors are much easier, they will restrict your exploration of the caves if you choose to fill them up and sometimes they might even corrupt your save, which is why it is highly recommended to take backups before using them.
gaming.stackexchange.com/users/51318/3ventic
If you build your spawner on the surface (rather than in the sky), you will need to find and light up all of the caves, there is no way around it.
In order to assist in finding caves, it is very common for some users to make an "x-ray machine".
This technique is described in the second half of the following video:
The X-Ray device works like this xPGSx P=Player S=
PistonxPxxx G=
Glowstonexxxxx x=solid block (Dirt etc)
Activate the piston and
it pushes the glowstone the player's head.
If it were a solid block, you would suffocate.
In the video, he does not suffocate.
Since Glowstone is not visually transparent, it allows you to see through any wall directly in contact with the glowstone that was just pushed over your head by the piston.
I'll leave it to you to figure out how to activate the piston.
This requires no mods or 'cheats', but rather, it exploits the design of the 3D graphics environment, which some may consider cheating.
This edit contributed by musicwithoutpaper without permission, just in case the YouTube video gets removed.
Although he uses the machine to find pools of water, it can just as easily be used to find caves.
gaming.stackexchange.com/users/17179/IQAndreas
You could use a single command to fill everything in - the only requirement is being an op or having cheats enabled in single player.
It's super efficient and a lot easier than having to create a sky mob trap or manually fill in all caves.
/fill 0 64 0 200 5 200 1
The first three numbers are the starting coordinates, the next three numbers are the ending coordinates, and the last number is the block ID you want to fill it with.
If you used this exact command, you would replace every single block from x:0 z:0 to x:200 z:200 with stone, covering from about sea level (y:64) to a few blocks above bedrock (y:5).
You would want to center your mob trap at x:100 z:100.
You can adjust coordinates accordingly depending on where you want to build your mob trap.
gaming.stackexchange.com/users/27903/Gigazelle
I made a mob trap recently but it did not seem efficient so I found out caves affect your mob traps but how do I get rid of the caves easily or at least stop the mobs from spawning in them.
How can I easily remove caves for my mob trap?
gaming.stackexchange.com
<minecraft-java-edition>
gaming.stackexchange.com/questions/125158
gaming.stackexchange.com/users/52364/FalseFlash
To prevent spawning in caves, you will need to find and light them all up or fill them in. While there is not simple way to tackle this problem, investing time in lighting up caves, seem to solve the problem.
Users suggesting there now way to to such a thing. However someone proposes a way to deal with it.