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.
Hello, @jongund! During today's APG Task Force meeting, I offered to take a look at the linting failures in gh-2622. Here's my proposal for a solution!
It's not exactly what I suggested "off the cuff," because I've gained additional context that influenced my opinion here. Namely: it's that the "global namespace object" pattern is used elsewhere in the project. Although we know there are better methods for code sharing, it seems wise to defer addressing that for another day (when we can address the issue holistically) and to focus today's patch on the stated problem.
Fortunately, your decision to introduce ES6 classes doesn't interfere with the namespace pattern. If we use a "class expression" rather than a "class declaration," we can assign each class to a property value rather than a variable binding. (In this form, the identifier following the
class
keyword is optional, but we'll leave it there, anyway, for debugging purposes. Doing so will ensure that the namesListbox
andToolbar
are still associated with the class values in error stack traces and such.)If we take this approach, we won't have to modify the ESLint configuration, after all.
(To be clear: it's still true that we can fix those linting errors solely by changing the ESLint configuration. If we choose to do that instead of applying this patch, we'll want to make sure to add the names to the right place in the file named
.eslintrc.json
: the "overrides" for files with.js
extensions. Although it might be even better to add the configuration "in-line" in the example files where we expect the variables to be available globally; that's done with code comments like/* global Listbox */
. That way, ESLint would continue to correctly warn us if we accidentally referred toListbox
orToolbar
from some file where those aren't available.)WAI Preview Link (Last built on Thu, 09 Mar 2023 21:30:16 GMT).