chore: Add linting
Some checks failed
Build Docker Image / build_docker (push) Failing after 3m9s
Lint / run (push) Failing after 59s
Build, check & Test / run (push) Successful in 9m12s

Signed-off-by: Avior <git@avior.me>
This commit is contained in:
Florian Bouillon 2024-05-23 14:55:52 +02:00
parent 22a20d67d0
commit eb3b41be72
7 changed files with 275 additions and 21 deletions

View File

@ -1,10 +1,6 @@
name: Build, check & Test
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
on: push
jobs:
run:

View File

@ -1,14 +1,7 @@
name: Build Docker Image
on:
push:
branches:
- '*'
tags:
- v*
pull_request:
branches:
- master
on: push
env:
IMAGE_NAME: ${{ github.repository }}

View File

@ -15,7 +15,6 @@ env:
TYPE: container
PACKAGE: ifremer-loop
jobs:
pull_request:
name: Delete the package on a closed Pull Request
@ -41,4 +40,3 @@ jobs:
TYPE: container
PACKAGE: ifremer-loop
VERSION: branch-${{ github.event.ref }}

28
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Lint
on: push
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Run BiomeJS
run: npm run lint
# - uses: mongolyy/reviewdog-action-biome@v1
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# reporter: gitea-pr-review
# filter_mode: diff_context
# fail_on_error: true

81
biome.json Normal file
View File

@ -0,0 +1,81 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"organizeImports": {
"enabled": true
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "master"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noBannedTypes": "warn",
"noExcessiveCognitiveComplexity": {
"level": "warn",
"options": {
"maxAllowedComplexity": 20
}
},
"noStaticOnlyClass": "warn",
"noUselessTypeConstraint": "warn",
"noVoid": "error",
"useSimplifiedLogicExpression": "warn"
},
"performance": {
"noBarrelFile": "error",
"noReExportAll": "warn"
},
"style": {
"noNonNullAssertion": "warn",
"noParameterAssign": "warn",
"useCollapsedElseIf": "warn",
"useConsistentArrayType": {
"level": "error",
"options": {
"syntax": "generic"
}
},
"useEnumInitializers": "off",
"useFilenamingConvention": {
"level": "error",
"options": {
"strictCase": true,
"requireAscii": true,
"filenameCases": ["camelCase", "export"]
}
},
"useForOf": "error",
"useNamingConvention": {
"level": "error",
"options": {
"enumMemberCase": "CONSTANT_CASE",
"strictCase": false,
"requireAscii": true
}
},
"useNodeAssertStrict": "warn",
"useNumberNamespace": "warn",
"useSingleCaseStatement": "warn"
}
}
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"javascript": {
"globals": ["Astro"],
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single",
"trailingComma": "none",
"lineWidth": 200,
"bracketSameLine": true
}
}
}

156
package-lock.json generated
View File

@ -19,6 +19,7 @@
},
"devDependencies": {
"@astrojs/check": "^0",
"@biomejs/biome": "^1.7.3",
"@playwright/test": "^1",
"@types/node": "^20",
"@vitest/coverage-v8": "^1",
@ -548,6 +549,161 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"node_modules/@biomejs/biome": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.7.3.tgz",
"integrity": "sha512-ogFQI+fpXftr+tiahA6bIXwZ7CSikygASdqMtH07J2cUzrpjyTMVc9Y97v23c7/tL1xCZhM+W9k4hYIBm7Q6cQ==",
"dev": true,
"hasInstallScript": true,
"bin": {
"biome": "bin/biome"
},
"engines": {
"node": ">=14.21.3"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/biome"
},
"optionalDependencies": {
"@biomejs/cli-darwin-arm64": "1.7.3",
"@biomejs/cli-darwin-x64": "1.7.3",
"@biomejs/cli-linux-arm64": "1.7.3",
"@biomejs/cli-linux-arm64-musl": "1.7.3",
"@biomejs/cli-linux-x64": "1.7.3",
"@biomejs/cli-linux-x64-musl": "1.7.3",
"@biomejs/cli-win32-arm64": "1.7.3",
"@biomejs/cli-win32-x64": "1.7.3"
}
},
"node_modules/@biomejs/cli-darwin-arm64": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.7.3.tgz",
"integrity": "sha512-eDvLQWmGRqrPIRY7AIrkPHkQ3visEItJKkPYSHCscSDdGvKzYjmBJwG1Gu8+QC5ed6R7eiU63LEC0APFBobmfQ==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-darwin-x64": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.7.3.tgz",
"integrity": "sha512-JXCaIseKRER7dIURsVlAJacnm8SG5I0RpxZ4ya3dudASYUc68WGl4+FEN03ABY3KMIq7hcK1tzsJiWlmXyosZg==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-arm64": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.7.3.tgz",
"integrity": "sha512-phNTBpo7joDFastnmZsFjYcDYobLTx4qR4oPvc9tJ486Bd1SfEVPHEvJdNJrMwUQK56T+TRClOQd/8X1nnjA9w==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-arm64-musl": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.7.3.tgz",
"integrity": "sha512-c8AlO45PNFZ1BYcwaKzdt46kYbuP6xPGuGQ6h4j3XiEDpyseRRUy/h+6gxj07XovmyxKnSX9GSZ6nVbZvcVUAw==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-x64": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.7.3.tgz",
"integrity": "sha512-vnedYcd5p4keT3iD48oSKjOIRPYcjSNNbd8MO1bKo9ajg3GwQXZLAH+0Cvlr+eMsO67/HddWmscSQwTFrC/uPA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-linux-x64-musl": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.7.3.tgz",
"integrity": "sha512-UdEHKtYGWEX3eDmVWvQeT+z05T9/Sdt2+F/7zmMOFQ7boANeX8pcO6EkJPK3wxMudrApsNEKT26rzqK6sZRTRA==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-win32-arm64": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.7.3.tgz",
"integrity": "sha512-unNCDqUKjujYkkSxs7gFIfdasttbDC4+z0kYmcqzRk6yWVoQBL4dNLcCbdnJS+qvVDNdI9rHp2NwpQ0WAdla4Q==",
"cpu": [
"arm64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@biomejs/cli-win32-x64": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.7.3.tgz",
"integrity": "sha512-ZmByhbrnmz/UUFYB622CECwhKIPjJLLPr5zr3edhu04LzbfcOrz16VYeNq5dpO1ADG70FORhAJkaIGdaVBG00w==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=14.21.3"
}
},
"node_modules/@dzeio/logger": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@dzeio/logger/-/logger-3.2.1.tgz",

View File

@ -12,7 +12,8 @@
"test": "npm run test:unit && npm run test:e2e",
"test:unit": "vitest --coverage --run",
"test:e2e": "playwright test",
"install:test": "playwright install --with-deps"
"install:test": "playwright install --with-deps",
"lint": "biome check ."
},
"dependencies": {
"@astrojs/node": "^7",
@ -28,6 +29,7 @@
},
"devDependencies": {
"@astrojs/check": "^0",
"@biomejs/biome": "^1.7.3",
"@playwright/test": "^1",
"@types/node": "^20",
"@vitest/coverage-v8": "^1",