To calculate CR, you take the average of its Offensive CR and its Defensive CR.
Calculating Defensive CR
It's base HP is 22 HP, and has 2 immunities and 8 resistances. You take its effective hitpoints here by multiplying it by 2 according to the table in DMG 277, applying the multiplier only once. Therefore, it's effective HP is 44, putting it at CR 1/4.
Now, its AC is 19, which is 6 AC above the normal AC value for a regular CR 1/4 creature. This means its defensive CR goes up 3 points, to 3.25.
Condition immunities have no effect on its CR as shown in DMG 279. Incorporeal Movement also has no effect on CR according to DMG 280. I will say Variable Illumination and Ephemeral have no effect as well, as they deal no damage or provide no protection.
Its movement speed is 50 ft (hover) -- but note that this is not a flying speed. The Will O' Wisp cannot float 50 ft upwards and make ranged attacks, so it does not qualify for the +2 effective AC as shown in DMG 279.
Our final Defensive CR is now 3.25.
Calculating Offensive CR
Its Offensive CR is simpler to calculate. Its damage per round due to its Shock action is 9 points, with a +4 to-hit bonus. This puts its CR to CR 1.
Its Invisibility ability does not affect its CR as shown in DMG 280. The only remaining ability to consider is Consume Life, but it's unlikely this affects CR calculations.
We have a final Offensive CR of 1.
Taking the average
$$\text{Final CR} = \frac{\text{Defense CR} + \text{Offense CR}}{2} = \frac{3.25 + 1}{2} = 2.125$$
We have a final CR of 2.125, which when rounded off is CR 2. So, the Will O' Wisp is strong at defense, but weak at offense.
Putting CR in perspective
This particular creature is actually not that powerful, using just raw numbers. The PCs should be able to handle them, as long as they aren't swarmed (the PCs being swarmed with anything is going to spell trouble for them due to the action economy).
One Will O' Wisp is Deadly for a party of four level 1 PCs
One Will O' Wisp is a Medium encounter for a party of four level 2 PCs, but two are Deadly
One Will O' Wisp is Easy for a party of four level 3 PCs, and Hard for two Will O' Wisps
As you can see, typically, the party should outgrow the Will O' Wisp after level 2, though encountering a couple of them might be a problem.