-
Notifications
You must be signed in to change notification settings - Fork 1k
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
style(eslint): enable @typescript-eslint/consistent-type-imports
#9082
style(eslint): enable @typescript-eslint/consistent-type-imports
#9082
Conversation
``` /code/redwood/packages/vite/src/fully-react/find-styles.ts 6:9 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports 7:9 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports 8:13 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports 14:28 error `import()` type annotations are forbidden @typescript-eslint/consistent-type-imports ```
deps: Set<import('vite').ModuleNode> | ||
vite: ViteDevServer, | ||
node: ModuleNode, | ||
deps: Set<ModuleNode> |
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.
@Tobbe is there a reason to use import('vite').
here in this file?
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.
gentle bump to @Tobbe - this is a fairly broad PR so the longer it stays open, the more painful the merge conflicts can become.
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 is code I mostly copy/pasted from another project. Looks like import type { ModuleNode } from 'vite'
should take care of the type here. Your change looks good
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.
thanks for double checking!
pretty sure these changes do not require any JS template rebuild. I followed the above instructions locally, and no changes were produced. |
…nsistent-type-imports # Conflicts: # packages/internal/src/build/web.ts
@virtuoushub can I resolve the merge conflicts for you here? |
This reverts commit 44f8dd2.
Hi @jtoar , thanks however I already did. |
was mean just for `RWFW` see: redwoodjs#9082 (comment)
ran `yarn rebuild-test-project-fixture`
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.
Hey @virtuoushub, scanned these changes as best I could. Awesome work! I love where you're headed—I can't wait for the import/no-extraneous-dependencies
rule. 🙏
I caught a few changes to the test project fixture that should be reverted. This is my miss, I need to update the script that rebuilds the test project fixture. We want to keep those stories the way they are. I commented on the files
__fixtures__/test-project/web/src/components/Author/Author.stories.tsx
Outdated
Show resolved
Hide resolved
__fixtures__/test-project/web/src/pages/BlogPostPage/BlogPostPage.stories.tsx
Outdated
Show resolved
Hide resolved
__fixtures__/test-project/web/src/pages/WaterfallPage/WaterfallPage.stories.tsx
Outdated
Show resolved
Hide resolved
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 pending the test project fixture changes and the question for @Tobbe.
…int/@typescript-eslint/consistent-type-imports
test project fixture changes are in. |
…int/@typescript-eslint/consistent-type-imports # Conflicts: # packages/web/src/components/GraphQLHooksProvider.tsx # packages/web/src/components/createCell.tsx
…nsistent-type-imports
…nsistent-type-imports
fwiw it looks like there is an unrelated to these changes flakey test: FAIL code src/__tests__/router.test.tsx (50.835 s)
● slow imports › usePageLoadingContext
expect(element).not.toBeInTheDocument()
expected document not to contain element, found <p>loading in page...</p> instead
536 | // This shouldn't show up, because the page shouldn't render before it's
537 | // fully loaded
> 538 | expect(screen.queryByText('loading in page...')).not.toBeInTheDocument()
| ^
539 |
540 | await waitFor(() => screen.getByText('done loading in page'))
541 | await waitFor(() => screen.getByText('done loading in layout'))
at Object.toBeInTheDocument (src/__tests__/router.test.tsx:538:60) see: https://github.com/redwoodjs/redwood/actions/runs/6032779642/job/16368480189#step:10:342 |
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 (only scanned the code, didn't try it)
…nsistent-type-imports
…nsistent-type-imports
…nsistent-type-imports
…9082) Enable a mostly stylistic lint rule. Will help with ESM conversion by helping differentiate `type` imports vs regular. This difference helps with false positives for the `import/no-extraneous-dependencies` rule ( #9081 ). That rule is what ultimately helps surface possible ESM issues/bundle bloat. see also: * https://gist.github.com/Jaid/164668c0151ae09d2bc81be78a203dd5 * https://stackoverflow.com/a/64243357 --- _note:_ due to the broad nature of these changes, this can impact inflight PRs. hopefully any possible conflicts that arise are easy enough to fix via a "take _your_ PRs changes" and then run `yarn lint:fix` merge strategy. Happy to help resolve any issues this PR might introduce to other inflight PRs, if it does get accepted/merged.
Enable a mostly stylistic lint rule. Will help with ESM conversion by helping differentiate
type
imports vs regular. This difference helps with false positives for theimport/no-extraneous-dependencies
rule ( #9081 ). That rule is what ultimately helps surface possible ESM issues/bundle bloat.see also:
note: due to the broad nature of these changes, this can impact inflight PRs. hopefully any possible conflicts that arise are easy enough to fix via a "take your PRs changes" and then run
yarn lint:fix
merge strategy. Happy to help resolve any issues this PR might introduce to other inflight PRs, if it does get accepted/merged.