If you are looking for a formula, there is none.
The value of the pull-up will depend on your paticular set-up.
Even then, it's more of a good engineering estimate of what would work best.
Using results from a search, your MCU's GPIO pin max current:
The esp8266 and esp-12e both use the same ESP8266 chip, with the only difference being the number of pins. The maximum current that can be drawn from a single GPIO pin is 12mA.
Wetting current is the minimum amount of DC current necessary to keep a mechanical switch contact on a dry loop in good health. Typically, 1-20 mA in copper wire loops. If a mechanical switch contact is operated with too little current, the contacts tend to accumulate excessive resistance and may fail prematurely.
I would suggest getting the pullup/pulldown current to within 1-5mA range.
Using R = V / I, where V = 3.1, I = 0.001, then R = 3.1K
If I = 0.005, then R = 620Ω
Therefore, I would suggest using a 1K to 3.3K pullup/pulldown resistor. This should result in a more robust solution with high noise immunity and high reliability.
That is a particular circuit. You have a single pushbutton on a breadboard and it's only a few inches away from the ESP. So 10K would be fine.
If it's 3 feet away and susceptible to electrical interference I would probably suggest something different. If you use 32 switches again maybe something different.
Re post#13 showing 220Ω pulldown resistor. This works out to 14mA current when the button is pressed. I would bump this up to at least 270Ω to get the current calculation within spec.
buttons are typically connected between the pin and ground, the pin configured as INPUT_PULLUP to use the internal pullup resistor which pulls the pin HIGH and when pressed, the button pulls the pin LOW.