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

chore: replace eslint with biomejs #2189

Merged
merged 39 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a9b128c
chore: :building_construction: Use Biomejs
mimarz Jul 29, 2024
fea1403
test ci gh
mimarz Jul 29, 2024
1ff83e3
Merge branch 'next' into chore/use-biome
mimarz Jul 29, 2024
9b09461
update rules
mimarz Jul 29, 2024
50da732
tweak rules
mimarz Jul 30, 2024
77f896d
tweak rules
mimarz Jul 30, 2024
75b9ab0
convert to biome to jsonc file type
mimarz Jul 30, 2024
badeb82
updated rules
mimarz Jul 30, 2024
d5a41de
Merge branch 'next' into chore/use-biome
mimarz Jul 30, 2024
b6bba05
ignore package.json in biome
mimarz Jul 31, 2024
13cb162
updated some scripts
mimarz Jul 31, 2024
0bb279e
updated some lint rules
mimarz Jul 31, 2024
6eda458
Rename const Error to avoid duplicate global
mimarz Jul 31, 2024
d122864
fix types script
mimarz Jul 31, 2024
87d7eda
updated rules
mimarz Jul 31, 2024
dbc3e8f
lint code with biome
mimarz Jul 31, 2024
4beba19
Merge branch 'next' into chore/use-biome
mimarz Jul 31, 2024
5867c5f
format code with biome
mimarz Jul 31, 2024
f023779
sort imports with biome
mimarz Jul 31, 2024
ead9574
update checks
mimarz Jul 31, 2024
ddf3587
fix contrastbox type error
mimarz Jul 31, 2024
b43b4df
Remove eslint and its dependencies
mimarz Jul 31, 2024
b010b4d
update linting rules
mimarz Jul 31, 2024
29c429d
fix according to new linting rules
mimarz Jul 31, 2024
34017db
remove tests from storefront checks
mimarz Jul 31, 2024
6d4b9e2
commit with lint error
mimarz Jul 31, 2024
067a902
remove on.push for checks workflows
mimarz Jul 31, 2024
751943b
test without reporter=github
mimarz Jul 31, 2024
25c4cd1
test new setup for checks
mimarz Jul 31, 2024
c42f2f2
checks again
mimarz Jul 31, 2024
2855d1d
more checks tweaks
mimarz Jul 31, 2024
ed5b131
added changeset
mimarz Jul 31, 2024
9252fac
wording
mimarz Jul 31, 2024
5413f2e
updated some biome ignores
mimarz Aug 1, 2024
804748f
fix json error in settings
mimarz Aug 1, 2024
cd383b1
format
mimarz Aug 1, 2024
4306688
revert default jsonformatter
mimarz Aug 1, 2024
c8d6935
tweak settings
mimarz Aug 1, 2024
268370d
remove default default
mimarz Aug 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .changeset/tender-ties-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@digdir/designsystemet-react': patch
'@digdir/designsystemet': patch
---

Changed linter and formatter from eslint to biomejs
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

99 changes: 0 additions & 99 deletions .eslintrc.cjs

This file was deleted.

14 changes: 3 additions & 11 deletions .github/workflows/check-storefront.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: Checks Storefront
name: Build Storefront
on:
workflow_dispatch:
pull_request:
paths:
- 'apps/storefront/**'
push:
paths:
- 'apps/storefront/**'
jobs:
checks:
name: Builds, lints and tests code
name: Build & test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -27,9 +24,4 @@ jobs:
run: yarn build:storefront
- name: Types
run: yarn types:storefront
- name: Lint Code
run: yarn lint ./apps/storefront
- name: Lint CSS
run: yarn lint-style ./apps/storefront/**/*.css
- name: Test
run: yarn test

12 changes: 2 additions & 10 deletions .github/workflows/checks-packages.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Checks Packages
name: Build Packages
on:
workflow_dispatch:
pull_request:
paths:
- 'packages/**'
- '*.*js'
push:
paths:
- 'packages/**'
jobs:
checks:
name: Builds, lints and tests code
name: Build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -19,9 +15,5 @@ jobs:
run: yarn build
- name: Types
run: yarn types:react
- name: Lint Code
run: yarn lint:all
- name: Lint CSS
run: yarn lint-style
- name: Test
run: yarn test
20 changes: 20 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Checks
on:
workflow_dispatch:
pull_request:
paths:
- 'packages/**'
- 'apps/**'
- 'biome.jsonc'
jobs:
checks:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/gh-setup
- name: Biome CI
run: yarn biome ci .
- name: Lint CSS
run: yarn lint-style

4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"unifiedjs.vscode-mdx",
"christian-kohler.npm-intellisense",
Expand All @@ -22,6 +21,7 @@
"editorconfig.editorconfig",
"zignd.html-css-class-completion",
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-norwegian-bokmal"
"streetsidesoftware.code-spell-checker-norwegian-bokmal",
"biomejs.biome"
]
}
28 changes: 9 additions & 19 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"git.rebaseWhenSync": true,
"git.autofetch": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"editor.defaultFormatter": "biomejs.biome",
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.prettierPath": "./node_modules/prettier",
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
Expand All @@ -11,22 +18,5 @@
"packages/theme/brand/digdir/typography/primary.css",
"packages/theme/brand/digdir/semantic.css"
],
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"eslint.probe": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"html",
"vue",
"markdown",
"mdx"
],
"html-css-class-completion.includeGlobPattern": "packages/css/**/*.{css,html}",
"cSpell.words": ["altinn", "brreg", "designsystemet", "digdir"],
"cSpell.language": "en,nb",
"cSpell.ignorePaths": ["**/node_modules/**", "**/package.json", "yarn.lock"],
"cSpell.enabledLanguageIds": ["markdown", "plaintext"]
"html-css-class-completion.includeGlobPattern": "packages/css/**/*.{css,html}"
}
4 changes: 2 additions & 2 deletions apps/_components/src/ClipboardButton/ClipboardButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { useState } from 'react';
import { Button, Tooltip } from '@digdir/designsystemet-react';
import { ClipboardIcon } from '@navikt/aksel-icons';
import { Tooltip, Button } from '@digdir/designsystemet-react';
import { useState } from 'react';

import classes from './ClipboardButton.module.css';

Expand Down
19 changes: 8 additions & 11 deletions apps/_components/src/CodeSnippet/CodeSnippet.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
'use client';

import { useEffect, useState } from 'react';
import { Button, Tooltip } from '@digdir/designsystemet-react';
import { FilesIcon } from '@navikt/aksel-icons';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { format } from 'prettier/standalone.js';
import * as prettierMarkdown from 'prettier/plugins/markdown.js';
import * as prettierBabel from 'prettier/parser-babel';
import * as prettierEstree from 'prettier/plugins/estree';
import * as prettierHtml from 'prettier/plugins/html.js';
import * as prettierMarkdown from 'prettier/plugins/markdown.js';
import * as prettierCSS from 'prettier/plugins/postcss.js';
import * as prettierTypescript from 'prettier/plugins/typescript.js';
import * as prettierEstree from 'prettier/plugins/estree';
import * as prettierBabel from 'prettier/parser-babel';
import { format } from 'prettier/standalone.js';
import { useEffect, useState } from 'react';
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { nightOwl } from 'react-syntax-highlighter/dist/esm/styles/prism';
import { Button, Tooltip } from '@digdir/designsystemet-react';

import classes from './CodeSnippet.module.css';

Expand Down Expand Up @@ -67,10 +67,7 @@ const CodeSnippet = ({
};

return (
<div
className={classes.codeSnippet}
data-ds-color-mode='dark'
>
<div className={classes.codeSnippet} data-ds-color-mode='dark'>
{snippet && (
<>
<Tooltip content={toolTipText}>
Expand Down
23 changes: 5 additions & 18 deletions apps/_components/src/ColorModal/ColorModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Paragraph, Modal } from '@digdir/designsystemet-react';
import { Modal, Paragraph } from '@digdir/designsystemet-react';
import type { ColorNumber } from '@digdir/designsystemet/color';
import {
getColorNameFromNumber,
Expand Down Expand Up @@ -26,17 +26,11 @@ const Field = ({
return (
<div className={classes.field}>
{label && (
<Paragraph
size='sm'
className={classes.label}
>
<Paragraph size='sm' className={classes.label}>
{label}
</Paragraph>
)}
<Paragraph
size='sm'
className={classes.value}
>
<Paragraph size='sm' className={classes.value}>
{value}
</Paragraph>
{copyBtn && <ClipboardButton value={value} />}
Expand Down Expand Up @@ -78,11 +72,7 @@ export const ColorModal = ({
</div>
<div className={classes.container}>
<div className={classes.left}>
<Field
label='Hexkode:'
value={hex}
copyBtn
/>
<Field label='Hexkode:' value={hex} copyBtn />
<Field
label='HSLuv:'
value={
Expand All @@ -105,10 +95,7 @@ export const ColorModal = ({
value={getColorCombinations(weight)}
/>
)}
<Field
label=''
value='Mer informasjon om fargen kommer.'
/>
<Field label='' value='Mer informasjon om fargen kommer.' />
</div>
<div
className={classes.right}
Expand Down
2 changes: 1 addition & 1 deletion apps/_components/src/ColorModal/colorModalUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getColorNameFromNumber,
type ColorNumber,
getColorNameFromNumber,
} from '@digdir/designsystemet/color';

export const capitalizeFirstLetter = (str: string) => {
Expand Down
Loading
Loading