Cut the aubergines into chunky cubes, sprinkle them with some salt and let them sit for 20 minutes. Dry them off with kitchen paper, pressing lightly.
Saute: Peel the garlic cloves, smash them slightly but leave them whole. Heat the olive oil in a wide non-stick pan and add the garlic cloves. Turn the heat to low and fry the garlic, stirring often, until it starts to sizzle and smell. Don't let it burn.
Add the aubergines, stir to coat them in oil, and cook on medium heat until translucent and soft.
Simmer: Add the chopped tomatoes, herbs, and stock. Bring everything to a boil, cover the pan leaving a crack open and let cook for about 20 minutes until the liquid has evaporated and the aubergines are very soft. If there is too much liquid left in the pan by the time the aubergines are soft, just take away the lid and let the sauce bubble for a little while longer.
Cook pasta: While the sauce is cooking, start cooking the spaghetti.
Mix: Mash the aubergines with a fork, add the sliced basil leaves, season to taste, and mix with the spaghetti. Serve with some grated Parmesan if desired.