Fix hard-coded CLI inspector version #544
Open
+22
−15
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.
Motivation and Context
The CLI is hard-coded at version
0.5.1
, from when it was merged in #177 f4e6f4d.It can use the
package.json
version, as does the client.How Has This Been Tested?
Tested by inspecting raw protocol messages.
Incorrect version on
main
:Corrected:
Breaking Changes
Unlikely.
Types of changes
Checklist
Additional context
Broader discussion
I have few questions and comments, but Discussions aren't enabled, so I'm not sure where to raise
them --
TL;DR:
NodeNext
modules?"noUncheckedIndexedAccess": true
be used throughout? Potential errors are detected.Despite this being a very tiny change, the varying TypeScript configurations across the sub-packages
tripped me up quite a bit, so I investigated a few details. Overall, consistency throughout the
monorepo would result in less confusion when reading and working with the parts of the inspector.
Generally lower cognitive overhead -- because, personally, when the same thing is accomplished in
multiple ways, it slows me down because I wonder why and which is correct or preferrable; especially
with unfamiliar code. Maybe this is second nature to experienced TS developers, working in
difficult contexts?
For example, the
package.json
import in thecli
andclient
here.The
cli
TypeScript config usesNodeNext
modules, which requires an import attribute (... with: { type: "json" }
).The
client
usesESNext
(andbundler
configuration), which tolerates an import attribute. Sothe quickest approach would be to add the import attribute in the
client
files,useConnection.tsx
andSidebar.tsx
.However, I could not find an easy way to enforce it (detection), so one needs to know. I briefly
checked the TS compiler options and
eslint-plugin-import
; a custom rule might be needed, which isa bit too crufty, IMO.
Alternately, change the CLI to
Node16
(used by the server and the TypeScript SDK). This wouldeliminate the requirement of an import attribute. It seems less preferable because enforcing modern
usage is ideal. Perhaps the
server
should go toNodeNext
too?Somewhat related, the
cli
compiler config uses"noUncheckedIndexedAccess": true
, which caughtthe potential bug in the destructuring of
split()
(but not in theclient
). If this option isenabled on the
client
andserver
, there are many errors. Should it be enabled?