Page MenuHomeSealhub

Jak ustawić linting i unit testy zintegrowane z Sealhubem
Updated 284 Days AgoPublic

Version 34 of 36: You are viewing an older version of this document, as it appeared on Jul 25 2023, 13:51.

Ten artykuł zawiera instrukcje stawiania lintowania za pomocą ESLinta, testów funkcjonalnych i integracji obydwu tych procesów z arcanistem i phabricatorem.

Zakładamy, że repozytorium, w którym wdrażane jest lintowanie, korzysta z Typescripta.

Instalacja arcanista i linterów

mkdir -p ~/bin
cd ~/bin
git clone https://we.phorge.it/source/arcanist.git arcanist
git clone https://hub.sealcode.org/diffusion/124/arcanist-linters.git
git clone https://github.com/sealcode/arc-unit-mocha.git
ln -s arcanist/bin/arc arc

# Dodaj ~/bin do swojego PATH, jeżeli jeszcze go tam nie ma:

echo "export PATH=\$PATH:$HOME/bin" >> ~/.bashrc
echo "export PATH=\$PATH:$HOME/bin" >> ~/.zshrc

# zrestartuj terminal i sprawdź, czy ta komenda:

which arc

# zwraca: /home/<nazwa_usera>/bin/arc
# jeżeli zwraca coś innego, np. /usr/bin/arc, to odinstaluj wersję arcanista, jaką masz zainstalowaną z managera paczek

Dodawanie lintera do nowego repo

Jeżeli tworzysz własne repo, podążaj za poniższymi instrukcjami. Jeżeli nie, to zignoruj poniższe instrukcje.

Dodaj takie pliki do repo projektu:

https://hub.sealcode.org/diffusion/PLAY/browse/hotwire/.arclint
https://hub.sealcode.org/diffusion/PLAY/browse/hotwire/.arcconfig
https://hub.sealcode.org/diffusion/PLAY/browse/hotwire/.eslintrc.js

Dodaj depsy:

npm install --save-dev prettier eslint @typescript-eslint/eslint-plugin eslint-plugin-prettier@latest eslint-config-prettier eslint-plugin-prettier

Od teraz możesz sprawdzić wynik lintowania za pomocą:

arc lint

Dodatkowo, wyniki lintowania będą się wyświetlały w diffie, ułatwiając zadnaie recenzentom i autorom diffów

Last Author
kuba-orlik
Last Edited
Jul 25 2023, 13:51

Event Timeline

kuba-orlik created this object.
kuba-orlik edited the content of this document. (Show Details)
piotr-ptaszynski edited the content of this document. (Show Details)
piotr-ptaszynski edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)

Dodałem te pluginy do AUR, więc jak ktoś korzysta z Archa to może sobie je pobrać.

Więc w moim przypadku instrukcja wygląda następująco

yay -S arcanist arcanist-linters-git arc-unit-mocha-git

a aktualizacja jest normalnie przez

yay

@kuba-orlik

@fraunos najs! 💪 Dodasz to do treści powyższego artykułu, aby nie umknęło?

kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)
kuba-orlik edited the content of this document. (Show Details)