[eslint] Adds rule one-var
and autofixes all related errors
#47310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request
Enables estline rule
one-var
. It forbids patterns like:and autofix them to
Apply
one-var
autofix across the codebase.Run
prettier
in affected files.Manually fix https://github.com/Automattic/wp-calypso/pull/47310/files#diff-3ec97767860a9c864e12180449bc1777637d3861ece2fd2139fd12f335516c01 because it hit the bug [one-var] Autofixing this rule drops some exported vars eslint/eslint#13834
After applying this rule it should be easier to autofix
no-var
andprefer-const
Testing instructions