Begin by preparing the eggplants. Sprinkle the cubed eggplants with salt and let them sit in a colander for about 15 minutes to draw out excess moisture. Rinse and pat dry with a paper towel.
While the eggplants are sitting, bring a large pot of salted water to a boil. Cook the pasta according to the package instructions until al dente. Reserve 1 cup of pasta water, then drain the pasta.
In a large skillet, heat the olive oil over medium heat. Once hot, add the cubed eggplant. Cook for about 8-10 minutes until the eggplant is golden brown and tender. Remove the eggplant from the skillet and set aside.
In the same skillet, add the minced garlic and cook for about 1 minute until fragrant. Be careful not to burn the garlic.
Pour in the crushed tomatoes and stir well. Add the dried oregano, red pepper flakes (if using), salt, and pepper. Simmer the sauce for about 10 minutes, allowing the flavors to meld.
Add the cooked eggplant back to the skillet and mix well. If the sauce is too thick, add a bit of the reserved pasta water to reach your desired consistency.
Add the drained pasta to the skillet and toss everything together, ensuring the pasta is well coated in the sauce. Cook for an additional 2-3 minutes to heat through.
Serve the pasta hot, garnished with crumbled ricotta salata and fresh basil leaves.