Skip to content

Commit a451f18

Browse files
committed
frontend: configure prettier
1 parent 3f580fb commit a451f18

File tree

4 files changed

+90
-1
lines changed

4 files changed

+90
-1
lines changed

frontend/.prettierrc.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "all",
10+
"bracketSpacing": true,
11+
"bracketSameLine": false,
12+
"arrowParens": "avoid",
13+
"proseWrap": "preserve",
14+
"htmlWhitespaceSensitivity": "css",
15+
"endOfLine": "lf",
16+
"overrides": [
17+
{
18+
"files": "**/*.html",
19+
"options": {
20+
"parser": "angular",
21+
"printWidth": 80,
22+
"bracketSameLine": false,
23+
"htmlWhitespaceSensitivity": "ignore",
24+
"singleAttributePerLine": false
25+
}
26+
}
27+
]
28+
}

frontend/Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Frontend Makefile
2+
3+
.PHONY: help
4+
help: ## Display this help message
5+
@echo "Frontend Makefile - Available targets:"
6+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
7+
8+
.PHONY: install
9+
install: ## Install npm dependencies
10+
npm install
11+
12+
.PHONY: prettify
13+
prettify: ## Format HTML, SCSS, TypeScript, and JavaScript files with Prettier
14+
npx prettier --write 'src/**/*.{ts,js,html,scss,css,json}'
15+
16+
.PHONY: check-prettify
17+
check-prettify: ## Check if files are formatted with Prettier
18+
npx prettier --check 'src/**/*.{ts,js,html,scss,css,json}'
19+
20+
.PHONY: start
21+
start: ## Start the development server
22+
npm start
23+
24+
.PHONY: build
25+
build: ## Build the frontend for production
26+
npm run build:prod
27+
28+
.PHONY: test
29+
test: ## Run Cypress tests
30+
npm run tests
31+
32+
.PHONY: test-headless
33+
test-headless: ## Run Cypress tests in headless mode
34+
npm run tests:headless
35+
36+
.PHONY: clean
37+
clean: ## Clean build artifacts and node_modules
38+
rm -rf dist node_modules
39+
40+
.PHONY: rebuild
41+
rebuild: clean install build ## Clean, reinstall dependencies, and rebuild

frontend/package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org openmina-uv --project openmina ./dist/frontend/browser && sentry-cli sourcemaps upload --org openmina-uv --project openmina ./dist/frontend/browser",
2020
"copy-env": "cp dist/frontend/browser/assets/environments/webnode.js dist/frontend/browser/assets/environments/env.js",
2121
"deploy": "npm run prebuild && npm run build:prod && npm run copy-env && firebase deploy",
22-
"deploy:leaderboard": "npm run prebuild && npm run build:prod && cp dist/frontend/browser/assets/environments/leaderboard.js dist/frontend/browser/assets/environments/env.js && firebase deploy"
22+
"deploy:leaderboard": "npm run prebuild && npm run build:prod && cp dist/frontend/browser/assets/environments/leaderboard.js dist/frontend/browser/assets/environments/env.js && firebase deploy",
23+
"prettify": "make prettify",
24+
"check-prettify": "make check-prettify"
2325
},
2426
"private": true,
2527
"dependencies": {
@@ -84,6 +86,7 @@
8486
"karma-coverage": "~2.2.0",
8587
"karma-jasmine": "~5.1.0",
8688
"karma-jasmine-html-reporter": "~2.1.0",
89+
"prettier": "^3.6.2",
8790
"terser-webpack-plugin": "^5.3.10",
8891
"typescript": "~5.8.3",
8992
"webpack": "^5.88.2",

0 commit comments

Comments
 (0)