Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Use explicit React type namespaces when following that convention
When the project uses React.* type names, import the React namespace as a type; the JSX transform alone is not a guarantee of ambient types.
Bad example
| 1 | import { FC, SVGProps } from 'react'; |
| 2 |
|
| 3 | const Icon: FC<SVGProps<SVGSVGElement>> = (props) => <svg {...props} />; |
Explanation (EN)
An ordinary import used only for types may conflict with the configured type-only import convention.
Objašnjenje (HR)
Obični import koji služi samo tipovima može biti u sukobu s postavljenom konvencijom type-only importa.
Good example
| 1 | import type * as React from "react"; |
| 2 | const Icon: React.FC<React.SVGProps<SVGSVGElement>> = props => <svg {...props} />; |
Explanation (EN)
The namespace is explicit and erased from runtime output.
Objašnjenje (HR)
Namespace je izričito uvezen i uklanja se iz izvršnog izlaza.
Notes (EN)
Follow the project's type-import convention. Namespace-qualified React types should use an explicit type import when required by module configuration.
Exceptions / Tradeoffs (EN)
The automatic JSX runtime removes the runtime React import requirement; it does not guarantee every React namespace type is globally available in every module setup. Named type imports are also valid.