Code Quality: Remove no-undef
eslint rule
#577
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.
This PR removes the disabled
no-undef
rule in the eslint rules and fixes the lint errors that occurred with it.Disabling the
no-undef
rule globally is dangerous. This is because you can use variables and functions that have not been previously defined or imported, making it easier to overlook critical errors.In fact, there were already variables and functions that were not defined. The reason these didn't cause an error was probably because the variable or function happened to be defined in another JavaScript.
Instead of removing the
no-undef
rule, I added the following configuration to the eslint:globals
: Suppresses warning errors that occur in the two constructorsFontFace
andFileReader
.overrides
: To preventit
anddescribe
from causing warning errors in unit tests, add unit test rules to the javascript files in thetest
directory.Testing Instructions
This PR does not add or change any functionality, so it should work correctly as before, but please test the following:
<Test />
that doesn't exist. When you runnpm run lint:js
you should get the following error:error 'Test' is not defined react/jsx-no-undef
test()
that is not predefined. trunk does not warn this statement as an error, but when you runnpm run :lint
on this PR, you should get the following error:error 'test' is not defined no-undef