[core] Remove file-wide disables of no-use-before-define
#27984
Merged
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.
We've had two remaining instances of file-wide disables of
no-use-before-define
:colorManipulator
It's clear that
no-use-before-define
is just a hinderance in the demo sources. The goal is usually to declare the data after the component implementation since the component implementation is more relevant than the data.This temporal dead zone (TDZ) is safe since components aren't rendered until the module is completely evaluated.
This will allow actuall unsafe TDZs but so far we haven't had any issues in demos.
For
colorManipulator
we can resolve it by just re-ordering the function declarations. We generally don't rely on hoisting of function declarations (since it's potentially unsafe withlet
/const
) so let's not start in one-off instances.