Compare commits
4 commits
1be992bc34
...
7a12b946a6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7a12b946a6 | ||
![]() |
c54eccc625 | ||
![]() |
54cca2b151 | ||
![]() |
15a83882ef |
11 changed files with 3153 additions and 61 deletions
54
.github/workflows/golangci-lint.yml
vendored
Normal file
54
.github/workflows/golangci-lint.yml
vendored
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
name: golangci-lint
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "master" ]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
# Optional: allow read access to pull request. Use with `only-new-issues` option.
|
||||||
|
# pull-requests: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
golangci:
|
||||||
|
name: lint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.21"
|
||||||
|
cache: false
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v4
|
||||||
|
with:
|
||||||
|
# Require: The version of golangci-lint to use.
|
||||||
|
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||||
|
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||||
|
version: v1.54
|
||||||
|
|
||||||
|
# Optional: working directory, useful for monorepos
|
||||||
|
working-directory: ./backend
|
||||||
|
|
||||||
|
# Optional: golangci-lint command line arguments.
|
||||||
|
#
|
||||||
|
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
|
||||||
|
# The location of the configuration file can be changed by using `--config=`
|
||||||
|
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||||
|
|
||||||
|
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||||
|
# only-new-issues: true
|
||||||
|
|
||||||
|
# Optional: if set to true, then all caching functionality will be completely disabled,
|
||||||
|
# takes precedence over all other caching options.
|
||||||
|
# skip-cache: true
|
||||||
|
|
||||||
|
# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
|
||||||
|
# skip-pkg-cache: true
|
||||||
|
|
||||||
|
# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
|
||||||
|
# skip-build-cache: true
|
||||||
|
|
||||||
|
# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
|
||||||
|
# install-mode: "goinstall"
|
1
.github/workflows/node.js.yml
vendored
1
.github/workflows/node.js.yml
vendored
|
@ -32,5 +32,6 @@ jobs:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
- run: npm run lint
|
||||||
- run: npm run build --if-present
|
- run: npm run build --if-present
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
|
@ -62,6 +62,10 @@ backup:
|
||||||
# Format
|
# Format
|
||||||
fmt:
|
fmt:
|
||||||
$(GOCMD) fmt ./...
|
$(GOCMD) fmt ./...
|
||||||
|
|
||||||
|
# Lint
|
||||||
|
lint:
|
||||||
|
golangci-lint run ./...
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
default: build
|
default: build
|
||||||
|
|
|
@ -15,7 +15,7 @@ func main() {
|
||||||
conf, err := config.ReadConfigFromFile("config.toml")
|
conf, err := config.ReadConfigFromFile("config.toml")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conf = config.NewConfig()
|
conf = config.NewConfig()
|
||||||
conf.WriteConfigToFile("config.toml")
|
_ = conf.WriteConfigToFile("config.toml")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pretty print the current config
|
// Pretty print the current config
|
||||||
|
|
|
@ -104,6 +104,9 @@ func (d *Db) Migrate(dirname string) error {
|
||||||
log.Println("Executed SQL file:", file.Name())
|
log.Println("Executed SQL file:", file.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.Commit()
|
if tr.Commit() != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,9 @@ func TestDbGetUserId(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("setupState failed:", err)
|
t.Error("setupState failed:", err)
|
||||||
}
|
}
|
||||||
db.AddUser("test", "password")
|
if db.AddUser("test", "password") != nil {
|
||||||
|
t.Error("AddUser failed")
|
||||||
|
}
|
||||||
|
|
||||||
var id int
|
var id int
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
'plugin:react-hooks/recommended',
|
'plugin:react-hooks/recommended',
|
||||||
'plugin:prettier/recommended',
|
'plugin:prettier/recommended',
|
||||||
],
|
],
|
||||||
ignorePatterns: ['dist', '.eslintrc.cjs', 'tailwind.config.js', 'postcss.config.js'],
|
ignorePatterns: ['dist', '.eslintrc.cjs', 'tailwind.config.js', 'postcss.config.js', 'jest.config.cjs'],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
plugins: ['react-refresh', 'prettier'],
|
plugins: ['react-refresh', 'prettier'],
|
||||||
rules: {
|
rules: {
|
||||||
|
|
5
frontend/jest.config.cjs
Normal file
5
frontend/jest.config.cjs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = {
|
||||||
|
transform: {
|
||||||
|
'^.+\\.(t|j)sx?$': '@swc/jest',
|
||||||
|
},
|
||||||
|
}
|
3117
frontend/package-lock.json
generated
3117
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -8,13 +8,17 @@
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"format": "prettier --config .prettierrc '**/*.ts' '**/*.tsx' '**/*.js' '**/*.json' --write"
|
"format": "prettier --config .prettierrc '**/*.ts' '**/*.tsx' '**/*.js' '**/*.json' --write",
|
||||||
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@swc/core": "^1.4.2",
|
||||||
|
"@swc/jest": "^0.2.36",
|
||||||
|
"@types/jest": "^29.5.12",
|
||||||
"@types/react": "^18.2.55",
|
"@types/react": "^18.2.55",
|
||||||
"@types/react-dom": "^18.2.19",
|
"@types/react-dom": "^18.2.19",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||||
|
@ -27,8 +31,10 @@
|
||||||
"eslint-plugin-react": "^7.33.2",
|
"eslint-plugin-react": "^7.33.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.5",
|
"eslint-plugin-react-refresh": "^0.4.5",
|
||||||
|
"jest": "^29.7.0",
|
||||||
"postcss": "^8.4.35",
|
"postcss": "^8.4.35",
|
||||||
"prettier": "3.2.5",
|
"prettier": "3.2.5",
|
||||||
|
"react-test-renderer": "^18.2.0",
|
||||||
"tailwindcss": "^3.4.1",
|
"tailwindcss": "^3.4.1",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^5.1.0"
|
"vite": "^5.1.0"
|
||||||
|
|
12
frontend/src/Components/__tests__/CountButton.test.ts
Normal file
12
frontend/src/Components/__tests__/CountButton.test.ts
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import { describe, expect, test } from "@jest/globals";
|
||||||
|
|
||||||
|
function sum(a: number, b: number): number {
|
||||||
|
return a + b;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is obviously not testing the proper component
|
||||||
|
describe("sum module", () => {
|
||||||
|
test("adds 1 + 2 to equal 3", () => {
|
||||||
|
expect(sum(1, 1)).toBe(2);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue