Use a knife to strip the kernels from the corn. It’s easiest if you stand the corn up in a shallow bowl and just cut down the length of each ear as many times as is necessary; you’ll quickly get the hang of it.
Put the oil in a large skillet over high heat. When hot, add the corn, tomatoes, and onions, shallot and garlic (if using); let sit for a moment. As the corn browns, shake the pan to distribute it so each kernel is deeply browned on at least one surface.
Sprinkle with salt and pepper, then stir in the basil and add feta (if using); serve hot or at room temperature.