-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Increase "react", "api" import specificity #2973
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2973 +/- ##
==========================================
- Coverage 74.98% 74.97% -0.01%
==========================================
Files 269 269
Lines 10358 10358
Branches 1225 1225
==========================================
- Hits 7767 7766 -1
Misses 2234 2234
- Partials 357 358 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
0907bde
to
f24bb88
Compare
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.
Reviewed 15 of 31 files at r1, all commit messages.
Reviewable status: 15 of 31 files reviewed, all discussions resolved (waiting on @imnasnainaec)
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.
Reviewed 16 of 31 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @imnasnainaec)
src/components/TreeView/TreeNavigator.tsx
line 1 at r1 (raw file):
import { Fragment, type ReactElement, useEffect } from "react";
Here the type
import is not at the beginning of the list but in other updates, the types are all moved to the front, e.g. in src/components/TreeView/tests/TreeSearch.test.tsx
:
import TreeSearch, {
type TreeSearchProps,
insertDecimalPoints,
testId,
useTreeSearch,
} from "components/TreeView/TreeSearch";
```.
Should `type ReactElement` be moved to the beginning?
Code quote:
import { Fragment, type ReactElement, useEffect } from "react";
src/components/TreeView/tests/TreeSearch.test.tsx
line 13 at r1 (raw file):
This seems to contradict the recommendation:
- Generally import the specific things needed (e.g., not
React
when{ type ReactElement }
will do)
That recommendation suggests that default exports should be avoided and only export specific types/objects.
If that is a direction we want to take, I am in favor of it being a separate PR.
Code quote:
import TreeSearch, {
type TreeSearchProps,
insertDecimalPoints,
testId,
useTreeSearch,
} from "components/TreeView/TreeSearch";
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.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)
src/components/TreeView/TreeNavigator.tsx
line 1 at r1 (raw file):
Previously, jmgrady (Jim Grady) wrote…
Here the
type
import is not at the beginning of the list but in other updates, the types are all moved to the front, e.g. insrc/components/TreeView/tests/TreeSearch.test.tsx
:import TreeSearch, { type TreeSearchProps, insertDecimalPoints, testId, useTreeSearch, } from "components/TreeView/TreeSearch"; ```. Should `type ReactElement` be moved to the beginning?
I hadn't intended to move type
imports all to the front, but was maintaining the alphabetic sort (and with ESLint defaults, all capital letters sort before lowercase). Would it be easier to have the type
imports clustered if they're to be type
-prefixed?
src/components/TreeView/tests/TreeSearch.test.tsx
line 13 at r1 (raw file):
Previously, jmgrady (Jim Grady) wrote…
This seems to contradict the recommendation:
- Generally import the specific things needed (e.g., not
React
when{ type ReactElement }
will do)That recommendation suggests that default exports should be avoided and only export specific types/objects.
If that is a direction we want to take, I am in favor of it being a separate PR.
My intent is not to generally move away from default exports, but from using import * as ____ from
if just a few things are needed. The * as
is not needed with React
because its default export is already a cumulative object. Any thoughts on better wording for the style guide?
Also, avoids usage of
import React
andReact.
for potential upcoming TS transpiler change.This change is