Generally it's the caterpillars of noctuid moths that eat basil. It's amazing how many plants they can eat in just one sitting/night.
There are a few ways to get rid of earwigs if their numbers become a problem.
1)Put a few rolled up, damp newspapers next to your vegetables in the evening. Earwigs will instinctively hide in there at sunrise and you can pick up the newspapers and dispose of them as they like. This works better than ordinary traps in my opinion, and doesn't attract other potentially much worse pests like rats and raccoons.
2)Put diatomaceous earth to the soil around the plants the critters love to raid. It's pretty much the only soil barrier that works but to be effective it needs to be reapplied every 7-10 days. Just be careful to get "uncalcinated" diatome earth: the one sold to deter slugs it's usually the best but pricey.
3)When everything else fails or if the infestation is really bad, it's time to turn to chemistry. Any insecticide that kills crawling insects will kill earwigs. Deltamethrin and other pyrethroids will make short work of earwigs if properly applied.