-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend lint fixes #605
Frontend lint fixes #605
Conversation
❌ Deploy Preview for hop-sdk-docs failed.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Suggestion
- I think ESM requires using the node protocol (
import path from 'node:path'
) and might be needed here.
Note
-
I believe
vite
handles TS config and bundles this into ESM. But I do not 100% understand all the implications of the TS config nor what a FE should be, but do believe this is all good & handled byvite
. -
For most packages I think we've been using relative imports for imports within a module and subpath imports when reaching outside of a module. In this case, for example, all the
components
reference's to each other should use relative imports. However, I believe it is ideal as-is and IIUC module classification/terminology is diff for each framework. So no change here, just a comment that FE appears to be a slightly different way of thinking than Node apps, as expected.
@@ -12,7 +12,7 @@ | |||
"start": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` vite", | |||
"dev": "pnpm start", | |||
"lint": "eslint . --fix", | |||
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` tsc && vite build", | |||
"build": "REACT_APP_GIT_SHA=`git rev-parse --short HEAD` tsc && vite build && echo '{\"type\": \"module\", \"imports\": { \"#*\": \"./*\" }}' > dist/package.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be required for dual exports. Since this is single, I believe this will then be redundant since package.json resolution will observe this file directly.
}, | ||
"imports": { | ||
"#*": { | ||
"import": "./src/*", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should just be a single "#*": "./dist/*"
. Will help tools evaluate to dist
and will be more representative of prod.
I believe src
can be used but would require us to manually configure a bunch of other tools, I think.
Depends on #604