Skip to content

Commit

Permalink
lint js
Browse files Browse the repository at this point in the history
  • Loading branch information
pldubouilh committed Jul 8, 2023
1 parent 7b4987d commit 97c427f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/always.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
go-version: 1.19.1
id: go

- name: deps
run: npm i -g standard

- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
Expand Down
30 changes: 16 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
FLAGS := -ldflags "-s -w" -trimpath
NOCGO := CGO_ENABLED=0

build:
build::
go vet && go fmt
${NOCGO} go build ${FLAGS} -o gossa

install:
install::
sudo cp gossa /usr/local/bin

run:
run::
./gossa -verb=true test-fixture

run-ro:
run-ro::
./gossa -verb=true -ro=true test-fixture

run-extra:
run-extra::
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture

ci: build-all test
lint-js::
standard

ci:: build-all test lint-js
echo "done"

test:
test::
-@cd test-fixture && ln -s ../support .; true
go test -cover -c -tags testrunmain

Expand All @@ -43,19 +46,19 @@ test:
# go tool cover -html all.out
# go tool cover -func=all.out | grep main | grep '9.\..\%'

watch:
watch::
ls gossa.go gossa_test.go ui/* | entr -rc make build run

watch-extra:
watch-extra::
ls gossa.go gossa_test.go ui/* | entr -rc make build run-extra

watch-ro:
watch-ro::
ls gossa.go gossa_test.go ui/* | entr -rc make build run-ro

watch-test:
watch-test::
ls gossa.go gossa_test.go ui/* | entr -rc make test

build-all: build
build-all:: build
${NOCGO} GOOS=linux GOARCH=amd64 go build ${FLAGS} -o builds/gossa-linux-x64
${NOCGO} GOOS=linux GOARCH=arm go build ${FLAGS} -o builds/gossa-linux-arm
${NOCGO} GOOS=linux GOARCH=arm64 go build ${FLAGS} -o builds/gossa-linux-arm64
Expand All @@ -64,8 +67,7 @@ build-all: build
${NOCGO} GOOS=windows GOARCH=amd64 go build ${FLAGS} -o builds/gossa-windows.exe
sha256sum builds/*

.PHONY: clean
clean:
clean::
rm -f gossa
rm -f gossa-linux64
rm -f gossa-linux-arm
Expand Down
16 changes: 8 additions & 8 deletions ui/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ const getArrowSelected = () => document.querySelector('.arrow-selected')
const getASelected = () => !getArrowSelected() ? false : getArrowSelected().parentElement.parentElement.querySelectorAll('a')[0]
const prependPath = a => a.startsWith('/') ? a : decodeURI(location.pathname) + a
const prevent = e => e.preventDefault()
const flicker = w => w.classList.remove('runFade') || void w.offsetWidth || w.classList.add('runFade')
const flicker = w => w.classList.remove('runFade') || void w.offsetWidth || w.classList.add('runFade') // eslint-disable-line

const encodeURIHash = e => encodeURI(e).replaceAll("#", "%23")
const encodeURIHash = e => encodeURI(e).replaceAll('#', '%23')

// Manual upload
manualUpload.addEventListener('change', () => Array.from(manualUpload.files).forEach(f => isDupe(f.name) || postFile(f, '/' + f.name)), false)
Expand Down Expand Up @@ -103,7 +103,7 @@ window.onClickLink = e => {
videoOn(a.href)
return false
// let html be displayed naturally
} else if (a.innerText.endsWith(".html")) {
} else if (a.innerText.endsWith('.html')) {
return true
}

Expand Down Expand Up @@ -286,7 +286,7 @@ document.ondrop = e => {

cancelDefault(e)
upGrid.style.display = 'none'
let t = getLink().firstChild
const t = getLink().firstChild

// move to a folder
if (draggingSrc && t) {
Expand Down Expand Up @@ -339,7 +339,7 @@ async function padOn (a) {
fileEdited = a.innerHTML
const f = await fetch(a.href, {
credentials: 'include',
headers: new Headers({ 'pragma': 'no-cache', 'cache-control': 'no-cache' })
headers: new Headers({ pragma: 'no-cache', 'cache-control': 'no-cache' })
})
editor.value = await f.text()
} catch (error) {
Expand Down Expand Up @@ -605,7 +605,7 @@ function videosOff () {
return true
}

window.videodl = function() {
window.videodl = function () {
dl(getASelected())
}

Expand All @@ -628,7 +628,7 @@ function helpOff () {
}

// Paste handler
let cuts = []
const cuts = []
function onPaste () {
if (!cuts.length) { return refresh() }
const a = getASelected()
Expand Down Expand Up @@ -669,7 +669,7 @@ let typedPath = ''
let typedToken = null

function cpPath () {
var t = document.createElement('textarea')
const t = document.createElement('textarea')
t.value = getASelected().href
document.body.appendChild(t)
t.select()
Expand Down

0 comments on commit 97c427f

Please sign in to comment.