In a medium bowl, add the sardines, removing any bones if there are any, then mash well with a fork.
Add the shallot, olives, mayonnaise, Parmesan, lemon zest, harissa, parsley, and mustard, then stir with the fork until combined and mostly smooth.
Season with black pepper and salt to taste, then stir again to combine.
Transfer the dip back into the sardine tins and top with the shredded cheddar, if using, then use a kitchen torch to char the top of the cheese until golden.
If you don't have a torch, transfer the dip to a heat-safe dish instead and broil on high for 3 to 5 minutes, watching closely, until the top is golden and bubbling, then enjoy!