Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sett opp knip & fjern ubrukte ting #2647

Merged
merged 2 commits into from
Mar 24, 2025
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
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on: [push]

env:
CI: true
TZ: Europe/Oslo

jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
image: ${{ steps.docker-build-push.outputs.image }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
registry-url: https://npm.pkg.github.com
- name: Install dependencies
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}

- name: Generate source files
run: pnpm run gen:routes

- name: Lint
run: pnpm run lint:ci

- name: Types
run: pnpm run types

- name: Test
run: pnpm run test

- name: Knip
run: pnpm run knip

- name: Build
run: pnpm run build
if: github.ref != 'refs/heads/master'
11 changes: 0 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,8 @@ jobs:
- name: Lint
run: pnpm run lint:ci

- name: Types
run: pnpm run types

- name: Test
run: pnpm run test

- name: Build
run: pnpm run build
if: github.ref != 'refs/heads/master'

- name: Publish Docker image
if: github.ref == 'refs/heads/master'

uses: nais/docker-build-push@v0
id: docker-build-push
with:
Expand Down
3 changes: 2 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"noSetterReturn": "off",
"noUnreachable": "off",
"noUnreachableSuper": "off",
"noUnusedImports": "error"
"noUnusedImports": "error",
"noUnusedVariables": "error"
},
"style": {
"noArguments": "error",
Expand Down
7 changes: 7 additions & 0 deletions knip.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["src/main.tsx", "src/routes/**/*.tsx", "src/loginWebWorker.ts", "src/window-variabler.ts"],
"project": ["src/**/*.ts", "src/**/*.tsx"],
"ignore": ["src/generated/**"],
"ignoreDependencies": ["@grafana/.+", "@navikt/ds-css"]
}
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"types": "tsc --noEmit",
"gen:routes": "tsr generate",
"generate": "openapi-typescript https://modiapersonoversikt-api.intern.dev.nav.no/modiapersonoversikt-api/v3/api-docs -o src/generated/modiapersonoversikt-api.ts --enum --root-types --root-types-no-schema-prefix",
"tsc": "tsc"
"tsc": "tsc",
"knip": "knip --exclude enumMembers"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -120,7 +121,6 @@
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@faker-js/faker": "^9.5.1",
"@navikt/aksel-stylelint": "^7.17.4",
"@playwright/test": "^1.51.1",
"@tanstack/router-cli": "^1.114.25",
"@tanstack/router-devtools": "^1.112.8",
Expand All @@ -129,8 +129,6 @@
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/lodash": "^4.17.16",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.startcase": "^4.4.9",
"@types/md5": "^2.3.5",
"@types/node": "^22.13.10",
"@types/prop-types": "^15.7.14",
Expand All @@ -140,9 +138,9 @@
"@types/react-modal": "^3.16.3",
"@types/react-redux": "^7.1.34",
"autoprefixer": "^10.4.21",
"cross-env": "^7.0.3",
"happy-dom": "^16.7.3",
"jest-styled-components": "^7.2.0",
"knip": "^5.46.0",
"less": "^4.2.2",
"lint-staged": "^15.5.0",
"msw": "^2.7.3",
Expand All @@ -153,7 +151,6 @@
"prop-types": "^15.8.1",
"react-collapse": "^5.1.1",
"redux-devtools-extension": "^2.13.9",
"stylelint": "^16.16.0",
"tailwindcss": "^3.4.17",
"typescript": "^5.8.2",
"undici": "^7.5.0",
Expand Down
Loading
Loading