Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Lint
on:
push:
branches:
- master
pull_request:

permissions:
contents: read
pull-requests: read

env:
NODE_VERSION: 25
GOVERSION: 1.25.3

jobs:
lint-go:
name: Lint go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GOVERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.6
- name: Check generated files
run: go generate ./... && git diff --quiet || { git diff; echo "Malformed generated files. Run 'go generate ./...' and commit to fix"; exit 1; }

lint-web:
name: Lint web
runs-on: ubuntu-latest
steps:
- name: Install NodeJS
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}

- name: Code Checkout
uses: actions/checkout@v2

- name: Install Dependencies
working-directory: ./web
run: npm ci

- name: Code Linting
working-directory: ./web
run: npm run lint
25 changes: 0 additions & 25 deletions .github/workflows/golangci-lint.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "2"
linters:
default: standard

formatters:
enable:
- gofmt
1 change: 1 addition & 0 deletions server/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a temporary directory so that CI passes since it wants to embed *something*.
13 changes: 13 additions & 0 deletions web/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
printWidth: 120, // max 120 chars in line, code is easy to read
useTabs: false, // use spaces instead of tabs
tabWidth: 2, // "visual width" of of the "tab"
trailingComma: 'es5', // add trailing commas in objects, arrays, etc.
semi: true, // add ; when needed
singleQuote: true, // '' for stings instead of ""
bracketSpacing: true, // import { some } ... instead of import {some} ...
arrowParens: 'always', // braces even for single param in arrow functions (a) => { }
jsxSingleQuote: false, // "" for react props, like in html
bracketSameLine: false, // pretty JSX
endOfLine: 'lf', // 'lf' for linux, 'crlf' for windows, we need to use 'lf' for git
};
8 changes: 4 additions & 4 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export default defineConfig([
// other options...
},
},
])
]);
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
import reactX from 'eslint-plugin-react-x';
import reactDom from 'eslint-plugin-react-dom';

export default defineConfig([
globalIgnores(['dist']),
Expand All @@ -69,5 +69,5 @@ export default defineConfig([
// other options...
},
},
])
]);
```
14 changes: 7 additions & 7 deletions web/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import tseslint from 'typescript-eslint';
import { defineConfig, globalIgnores } from 'eslint/config';

export default defineConfig([
globalIgnores(['dist']),
Expand All @@ -20,4 +20,4 @@ export default defineConfig([
globals: globals.browser,
},
},
])
]);
21 changes: 21 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build-dev": "",
"lint": "eslint .",
"preview": "vite preview"
"lint": "eslint . && prettier . --check",
"preview": "vite preview",
"format": "prettier . --write"
},
"engines": {
"node": "^25.0.0",
"npm": "^11.0.0"
},
"dependencies": {
"react": "^19.1.1",
Expand All @@ -24,6 +28,7 @@
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.22",
"globals": "^16.4.0",
"prettier": "3.6.2",
"typescript": "~5.9.3",
"typescript-eslint": "^8.45.0",
"vite": "^7.1.7"
Expand Down
56 changes: 25 additions & 31 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
import { useState } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import './App.css'
import { useState } from 'react';
import reactLogo from './assets/react.svg';
import viteLogo from '/vite.svg';
import './App.css';

function App() {
const [count, setCount] = useState(0)
fetch("/api/v1/user").then(x => x.json().then(x => console.log(x)))
return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
count is {count}
</button>
<p>
Skull emoji
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
</p>
</>
)
const [count, setCount] = useState(0);
fetch('/api/v1/user').then((x) => x.json().then((x) => console.log(x)));
return (
<>
<div>
<a href="https://vite.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button>
<p>Skull emoji</p>
</div>
<p className="read-the-docs">Click on the Vite and React logos to learn more</p>
</>
);
}

export default App
export default App;
12 changes: 6 additions & 6 deletions web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App.tsx';

createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
</StrictMode>
);
5 changes: 1 addition & 4 deletions web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
"references": [{ "path": "./tsconfig.app.json" }, { "path": "./tsconfig.node.json" }]
}
10 changes: 5 additions & 5 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vite.dev/config/
export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true
}
changeOrigin: true,
},
},
},
plugins: [react()],
})
});