Heat oven to 350°F. Line a 9x13-inch pan with parchment and lightly grease.
Whisk flour, baking soda, and salt in a medium bowl; set aside.
Cream softened butter, brown sugar, and granulated sugar until light and fluffy.
Beat in vanilla, then add eggs one at a time, mixing well and scraping the bowl.
Mix in the dry ingredients on low just until no dry streaks remain.
Fold in chocolate chips and walnuts, if using.
Spread dough evenly in the prepared pan; smooth the top.
Bake until golden at the edges and set in the center, 24–28 minutes.
Cool completely in the pan, then lift out and cut into bars.