QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.25k stars 59 forks source link

chore: enforce types imports #237

Closed Yovach closed 10 months ago

Yovach commented 10 months ago

This PR, however small, adds the keyword 'type' to imports where possible.

I think it would be interesting to enable verbatimModuleSyntax as well.

vercel[bot] commented 10 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-international ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 11, 2023 0:35am
Yovach commented 10 months ago

I added the separate-type-imports rule to eslint config and tried to add a rule to enforce the top-level type but you have to install a new dependency (https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md#prefer-top-level) :/

QuiiBz commented 10 months ago

tried to add a rule to enforce the top-level type but you have to install a new dependency (import-js/eslint-plugin-import@main/docs/rules/consistent-type-specifier-style.md#prefer-top-level) :/

This rule seems redundant with @typescript-eslint/consistent-type-imports, I'm not sure to understand the difference between the two?

Yovach commented 10 months ago

tried to add a rule to enforce the top-level type but you have to install a new dependency (import-js/eslint-plugin-import@main/docs/rules/consistent-type-specifier-style.md#prefer-top-level) :/

This rule seems redundant with @typescript-eslint/consistent-type-imports, I'm not sure to understand the difference between the two?

The @typescript-eslint/consistent-type-imports allows us to use

import { type ReactElement } from 'react';

while it shouldn't.

The import/consistent-type-specifier-style prevents this

QuiiBz commented 10 months ago

Thanks for the explanation, it's a lot clearer. I think we can go ahed and add this new eslint-plugin-import package along with this other rule.

Yovach commented 10 months ago

Issues will be fixed with --fix thanks to import/consistent-type-specifier-style