Skip to content
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

Merged
merged 8 commits into from
May 20, 2024
Merged

Frontend lint fixes #605

merged 8 commits into from
May 20, 2024

Conversation

miguelmota
Copy link
Member

Depends on #604

Copy link

netlify bot commented May 18, 2024

Deploy Preview for hop-sdk-docs failed.

Name Link
🔨 Latest commit 6941095
🔍 Latest deploy log https://app.netlify.com/sites/hop-sdk-docs/deploys/664827b9cbfaa60008b1f40e

Copy link
Member

@shanefontaine shanefontaine left a 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 by vite.

  • 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",
Copy link
Member

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/*",
Copy link
Member

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.

@miguelmota miguelmota merged commit c2ae5d7 into develop May 20, 2024
0 of 4 checks passed
@shanefontaine shanefontaine deleted the feature/fe-lint branch May 20, 2024 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants