Use prettier to format other files

+ Add vscode settings to automatically use it.
This commit is contained in:
nimbleghost 2023-05-29 22:23:54 +02:00
parent b222541ea8
commit 4d40de58fc
6 changed files with 35 additions and 2 deletions

6
.editorconfig Normal file
View file

@ -0,0 +1,6 @@
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2

1
.gitignore vendored
View file

@ -1,7 +1,6 @@
dist/
build/
.idea/
.vscode/
*.swp
server/docs/
server/site/

6
.prettierignore Normal file
View file

@ -0,0 +1,6 @@
server/docs/
server/site/
server/mailer_emoji_map.json
scripts/emoji.json
dist/
web/

7
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"golang.go"
]
}

7
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}

View file

@ -55,6 +55,8 @@ help:
@echo " make coverage-upload - Upload coverage results to codecov.io"
@echo
@echo "Lint/format:"
@echo " make format - Run prettier on config files, docs, etc excluding the web app"
@echo " make format-check - Run prettier on config files, docs, etc excluding the web app, but don't change anything"
@echo " make fmt - Run 'go fmt'"
@echo " make fmt-check - Run 'go fmt', but don't change anything"
@echo " make vet - Run 'go vet'"
@ -248,7 +250,7 @@ cli-build-results:
# Test/check targets
check: test web-format-check fmt-check vet web-lint lint staticcheck
check: test format-check web-format-check fmt-check vet web-lint lint staticcheck
test: .PHONY
go test $(shell go list ./... | grep -vE 'ntfy/(test|examples|tools)')
@ -275,6 +277,12 @@ coverage-upload:
# Lint/formatting targets
format: web-deps
./web/node_modules/.bin/prettier . --write
format-check: web-deps
./web/node_modules/.bin/prettier . --check
fmt:
gofmt -s -w .