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

Global React Import #138

Open
kalisjoshua opened this issue Dec 26, 2024 · 2 comments
Open

Global React Import #138

kalisjoshua opened this issue Dec 26, 2024 · 2 comments
Labels
chore Other changes that don't modify source or test files developer Issues or tickets that are currently in developers wheelhouse question A question regarding the code or functionality setup Repo setup and architecture

Comments

@kalisjoshua
Copy link
Contributor

There is a way to configure projects to assume React is in scope for .tsx files which will remove the requirement to import React explicitly. Adding this config would remove the need to explictly import React and disable the biome linting rule "lint/correctness/noUnusedImports".

@kalisjoshua kalisjoshua added chore Other changes that don't modify source or test files developer Issues or tickets that are currently in developers wheelhouse question A question regarding the code or functionality setup Repo setup and architecture labels Dec 26, 2024
@brandonjpierce
Copy link
Contributor

@kalisjoshua in any case we would, at a bare minimum, need to define react as a peer dependency which will install it anyways. Note we don't import from react explicitly unless it is for a particular hook or type e.g.

import { useState } from 'react';

We do not do a glob or default import of

import * as React from 'react';
// or
import React from 'react';

@kalisjoshua
Copy link
Contributor Author

Super low priority

https://github.com/gohypergiant/standard-toolkit/blob/feat/update-config-and-audit/apps/docs/lib/install.tsx#L1

I added it as a reminder to myself, and to also look at the config for a similar solution for vitest imports; to solve for this as well:

https://github.com/gohypergiant/standard-toolkit/blob/main/packages/geo/src/index.test.ts#L14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Other changes that don't modify source or test files developer Issues or tickets that are currently in developers wheelhouse question A question regarding the code or functionality setup Repo setup and architecture
Projects
None yet
Development

No branches or pull requests

2 participants