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

Chore: (ehdotus) Järjestetään importit automaattisesti #74

Merged
merged 2 commits into from
Mar 23, 2024

Conversation

niemisami
Copy link
Contributor

@niemisami niemisami commented Mar 11, 2024

Järjestellään ja ryhmitellään importit automaattisesti:

  1. react/next/paketit
  2. @/ -prefixillä olevat omat tiedostot sekä relatiiviset importit

Tähän asti ei ole varmasti pystytty erottelemaan mitkä importit ovat ns. "omia" ja mitkä node_moduleista, koska importeissa ei ollut mitään prefixiä e.g. import Hero from 'components/hero'; nyt -> import Hero from '@/components/hero';. Tuota @/`-prefixiä on näkynyt paljon uusissa js-kirjastoissa ja siks valitsin sen. Vaatii ehkä vähän tottumista, mutta vscode osaa importella itsestään, joten eipä sillä väliä 🙃

Tosiaan täysin lonkalta heitetty ehdotelma eikä pakollista missään nimessä; jaaa sisältää muutoksia vain aivan jokaiseen tiedostoon 😅

@niemisami niemisami mentioned this pull request Mar 11, 2024
@niemisami
Copy link
Contributor Author

niemisami commented Mar 11, 2024

Esimerkki miten toimii player.tsx tiedostosta:

// VANHA
import Image from 'next/image';
import { useEffect, useState } from 'react';
import { format } from 'date-fns';

import testcard from '../public/testcard.webp';
import placeholderImage from '../public/kuva_puuttuu_v2.jpeg';
import useShoutBoxAndVideo from 'hooks/useShoutboxAndVideo';
import { FiPause, FiPlay, FiMessageSquare, FiVideo } from 'react-icons/fi';
import { Show } from 'scripts/google/showlistHelpers';

// UUSI
import { useEffect, useState } from 'react';
import { FiMessageSquare, FiPause, FiPlay, FiVideo } from 'react-icons/fi';
import Image from 'next/image';
import { format } from 'date-fns';

import useShoutBoxAndVideo from '@/hooks/useShoutboxAndVideo';
import { Show } from '@/scripts/google/showlistHelpers';
import placeholderImage from '../public/kuva_puuttuu_v2.jpeg';
import testcard from '../public/testcard.webp';

@niemisami niemisami merged commit 51f03e8 into develop Mar 23, 2024
2 checks passed
@niemisami niemisami deleted the chore/import-sort branch March 23, 2024 13:11
ebetoi added a commit that referenced this pull request Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants