Bring a large pot of water to a boil and salt it. Put the oil in a large skillet over medium-high heat. When it's hot, add the onion and eggplant, sprinkle with salt and pepper, and stir occasionally until browned and tender, about 15 minutes.
Add pasta to boiling water and prepare as directed. When the pasta is done, drain it, reserving 1/2 cup of the cooking water. Return pasta to the pot with 1/2 cup ricotta cheese and the reserved cooking water; toss to combine. Serve pasta topped with the eggplant mixture, freshly grated Parmesan and basil.