Start by preheating your oven to 350°F (175°C). Grease and flour a 9x13-inch baking pan or line it with parchment paper.
In a large bowl, combine the flour, sugar, baking powder, baking soda, salt, and cinnamon.
In another bowl, whisk together the vegetable oil and eggs until well combined.
Gradually add the wet ingredients to the dry ingredients, mixing well until fully combined.
Stir in the grated carrots, crushed pineapple, and walnuts (if using). Mix until they are evenly distributed throughout the batter.
Pour the batter into the prepared pan. Bake for about 40-45 minutes, or until a toothpick inserted into the center of the cake comes out clean.
Remove the cake from the oven and let it cool in the pan for 10 minutes. Then, transfer it to a wire rack to cool completely.