Preheat the oven to 375°F (190°C) and position a rack in the center. Line two baking sheets with parchment paper or silicone mats.
In a medium bowl, whisk together the flour, baking soda, and salt until evenly distributed. Set the bowl aside.
In a large bowl, beat the softened butter with the granulated sugar and brown sugar on medium speed for about 2 minutes, until pale and fluffy. Scrape down the sides halfway through.
Add the eggs one at a time, beating well after each. Pour in the vanilla extract and mix until just combined; the batter should look smooth and slightly glossy.
Add the dry ingredients to the wet mixture in two or three additions, mixing on low speed only until the flour disappears with no dry streaks. Stop as soon as it comes together.
Fold in the chocolate chips and walnuts, if using, by hand with a spatula for even distribution. Reserve a small handful of chips to press onto the dough tops.
Scoop rounded 2-tablespoon portions of dough onto the lined sheets, spacing them about 2 inches apart. Press a few reserved chips onto the top of each mound if you like.
Bake one sheet at a time for 10 to 12 minutes, until the edges are golden and the centers look just set. Rotate the sheet halfway through if your oven has hot spots.
Let the cookies rest on the hot baking sheet for 2 to 3 minutes, then transfer them to a wire rack to finish cooling.