Skip to content

Commit 3d38374

Browse files
authored
legg til knip (#3736)
* legg til knip * fiks knip-feil etter rebase
1 parent ee9eb41 commit 3d38374

File tree

4 files changed

+420
-28
lines changed

4 files changed

+420
-28
lines changed
Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,80 @@
11
name: Valider pull request
2-
on: [pull_request]
2+
on: [ pull_request ]
33
jobs:
44
valid-pull-request:
55
name: Valider pull request
66
runs-on: ubuntu-latest
77
timeout-minutes: 30
88
steps:
9-
- name: Hente kode
10-
uses: actions/checkout@v4
9+
- uses: actions/checkout@v4
1110
with:
1211
fetch-depth: 0
1312

14-
- name: Sette yarn-config
15-
run: |
16-
yarn config set npmScopes.navikt.npmRegistryServer "https://npm.pkg.github.com"
17-
yarn config set npmScopes.navikt.npmAlwaysAuth true
18-
yarn config set npmScopes.navikt.npmAuthToken $NPM_AUTH_TOKEN
19-
env:
20-
NPM_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
21-
22-
- name: Sette opp Node
23-
uses: actions/setup-node@v4
13+
- uses: actions/setup-node@v4
2414
with:
25-
node-version: 18.8.0
15+
node-version: 22.17.1
2616
cache: 'yarn'
17+
registry-url: https://npm.pkg.github.com/
18+
always-auth: true
19+
token: ${{ secrets.READER_TOKEN }}
2720

2821
- name: Installere dependencies
2922
run: yarn install --immutable
3023

3124
- name: Bygg
3225
run: yarn build
3326

34-
- name: Typescript and linting
35-
run: yarn stylelint && yarn eslint:changed && yarn tsc
27+
- name: Stylelint
28+
run: yarn stylelint
29+
30+
- name: ESLint
31+
run: yarn eslint:changed
32+
33+
- name: Typescript
34+
run: yarn tsc
3635

3736
- name: Run test
3837
run: yarn test
38+
39+
knip-it:
40+
name: Kjør knip
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 30
43+
permissions:
44+
contents: read
45+
pull-requests: write
46+
steps:
47+
- uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
51+
- uses: actions/setup-node@v4
52+
with:
53+
node-version: 22.17.1
54+
registry-url: https://npm.pkg.github.com/
55+
always-auth: true
56+
token: ${{ secrets.READER_TOKEN }}
57+
cache: 'yarn'
58+
59+
- name: Installere dependencies
60+
run: yarn install --immutable
61+
62+
- name: Run knip
63+
run: |
64+
yarn knip --no-exit-code --reporter=markdown > knip-report.md
65+
cat knip-report.md > $GITHUB_STEP_SUMMARY
66+
67+
- name: Delete previous comments from knip
68+
continue-on-error: true
69+
run: gh pr comment ${{ github.event.pull_request.number }} --delete-last --yes
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Post knip report
74+
run: |
75+
number_of_words=$(wc -w < knip-report.md)
76+
if [ $number_of_words -gt 3 ]; then
77+
gh pr comment ${{ github.event.pull_request.number }} --body-file knip-report.md
78+
fi
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
},
3737
"devDependencies": {
3838
"@navikt/aksel-stylelint": "7.26.0",
39-
"@navikt/ds-css": "7.26.0",
4039
"@navikt/ft-config-eslint": "workspace:^",
4140
"@navikt/ft-frontend-storybook-utils": "workspace:^",
4241
"@storybook/addon-a11y": "9.1.1",
@@ -52,6 +51,7 @@
5251
"gh-pages": "6.3.0",
5352
"husky": "9.1.7",
5453
"jsdom": "26.1.0",
54+
"knip": "^5.62.0",
5555
"lerna": "8.2.3",
5656
"lint-staged": "16.1.4",
5757
"postcss-less": "6.0.0",

packages/fakta-beregning/src/components/fellesFaktaForATFLogSN/vurderFaktaBeregningHjelpefunksjoner.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ const { OVERSTYRING_AV_BEREGNINGSGRUNNLAG, VURDER_FAKTA_FOR_ATFL_SN } = FaktaBer
77

88
export const BEGRUNNELSE_FAKTA_TILFELLER_NAME = 'begrunnelseFaktaTilfeller';
99

10-
export const parseStringToBoolean = (value: string) => value === 'true';
11-
1210
export const erSubmittable = (submittable: boolean, submitEnabled: boolean, hasErrors: boolean): boolean =>
1311
submittable && submitEnabled && !hasErrors;
1412

0 commit comments

Comments
 (0)