Preheat your oven to 375°F (190°C).
In a large skillet, heat the olive oil over medium heat. Add the diced onion and cook until softened, about 3-4 minutes.
Add the ground beef to the skillet and cook until browned, breaking it apart with a spoon, about 5-7 minutes. Drain any excess fat.
Stir in the minced garlic, Italian seasoning, salt, and black pepper. Cook for an additional minute until fragrant.
Add the diced tomatoes (with their juice) and bring to a simmer. Cook for about 5 minutes, allowing the flavors to meld.
In a large bowl, combine the ricotta cheese, half of the mozzarella cheese, and the cooked gnocchi. Mix well.
Pour the beef mixture into the bowl with the gnocchi and cheese, and stir until everything is well combined.
Transfer the mixture to a greased 9x13-inch baking dish. Top with the remaining mozzarella cheese and the grated Parmesan cheese.
Bake in the preheated oven for 25-30 minutes, or until the cheese is bubbly and golden.
Remove from the oven and let it cool for a few minutes before serving. Garnish with fresh basil if desired.