Skip to content

Commit

Permalink
chore: replace eslint/dprint with biome (#396)
Browse files Browse the repository at this point in the history
Removes eslint and adds biome, which is a much faster linter
that can handle TypeScript out of the box, and also does formatting.

Removes circular dependencies related to importing elements into the
route map, but also route map into elements. This caused a problem
with vite's HMR depending on the exact order of the imports.
The solution here is to only map routes to elements where needed
(in this case only App.tsx).
  • Loading branch information
steabert authored Feb 25, 2025
1 parent 6d32c5d commit 52ecb1f
Show file tree
Hide file tree
Showing 201 changed files with 13,953 additions and 5,411 deletions.
9 changes: 0 additions & 9 deletions .eslintrc.json

This file was deleted.

3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ updates:
- "patch"
patterns:
- "*vite*"
- "*biome*"
- "depcheck"
- "dprint"
- "eslint*"
- "ts-node"
- "typescript"
fluent:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Tools
.DS_Store
.eslintcache

node_modules/
lib
Expand Down
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"dprint.dprint",
"biomejs.biome",
"streetsidesoftware.code-spell-checker"
]
}
27 changes: 22 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
{
"editor.defaultFormatter": "dprint.dprint",
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"typescript.tsdk": "node_modules/typescript/lib",
"eslint.workingDirectories": [
{"mode":"auto"}
]
"typescript.tsdk": "node_modules/typescript/lib"
}
51 changes: 51 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": {
"include": [
"**/*.json",
"**/*.js",
"**/*.mjs",
"**/*.cjs",
"**/*.ts",
"**/*.tsx"
],
"ignore": ["lib/", ".vscode/"]
},
"organizeImports": {
"enabled": true,
"ignore": ["generated/", ".vscode/"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"lineWidth": 80
},
"linter": {
"enabled": true,
"ignore": ["generated/", ".vscode/"],
"rules": {
"recommended": false,
"correctness": {
"recommended": true,
"noUnusedImports": "error",
"noUnusedVariables": "error"
},
"security": {
"recommended": true
},
"suspicious": {
"recommended": true,
"noArrayIndexKey": "off",
"noExplicitAny": "off",
"noImplicitAnyLet": "off"
}
}
},
"javascript": {
"formatter": {
"trailingCommas": "es5"
},
"jsxRuntime": "reactClassic"
}
}
8 changes: 0 additions & 8 deletions components/empty-view/.eslintrc.json

This file was deleted.

7 changes: 2 additions & 5 deletions components/empty-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@
"import": "./lib/index.js"
}
},
"files": [
"lib"
],
"files": ["lib"],
"scripts": {
"prebuild": "pnpm run -C ../../illustrations build",
"build": "pnpm prebuild && tsc",
"check:unused-deps": "depcheck . --config=depcheck.yml",
"lint": "tsc --noEmit && eslint . --cache"
"lint": "tsc --noEmit && biome check"
},
"devDependencies": {
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"eslint": "^8.57.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^4.5.5"
Expand Down
2 changes: 1 addition & 1 deletion components/empty-view/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
AddUserProfileDark,
AddUserProfileLight,
bundleIllustrationSmart,
CodeErrorDark,
CodeErrorLight,
DataDark,
Expand Down Expand Up @@ -42,6 +41,7 @@ import {
TeamLight,
UnderConstructionDark,
UnderConstructionLight,
bundleIllustrationSmart,
} from "@axiscommunications/fluent-illustrations";
import { IllustrationKind } from "./types.js";

Expand Down
105 changes: 59 additions & 46 deletions components/empty-view/src/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ import {

import { useMediaQuery } from "@axiscommunications/fluent-hooks";

import { Illustration } from "./constants.js";
import { useContainerStyle, useStyles } from "./styles.js";
import {
ContentProps,
EmptyViewProps,
HtmlDivAttributesRestProps,
} from "./types.js";
import { Illustration } from "./constants.js";

function ContainerSpacious(
{ children, className, ...rest }: PropsWithChildren<
HtmlDivAttributesRestProps
>
) {
function ContainerSpacious({
children,
className,
...rest
}: PropsWithChildren<HtmlDivAttributesRestProps>) {
const styles = useStyles();
const containerStyle = useContainerStyle({ className });

Expand All @@ -37,11 +37,11 @@ function ContainerSpacious(
);
}

function ContainerCompact(
{ children, className, ...rest }: PropsWithChildren<
HtmlDivAttributesRestProps
>
) {
function ContainerCompact({
children,
className,
...rest
}: PropsWithChildren<HtmlDivAttributesRestProps>) {
const styles = useStyles();
const containerStyle = useContainerStyle({ className });

Expand All @@ -54,11 +54,11 @@ function ContainerCompact(
);
}

function ContainerTop(
{ children, className, ...rest }: PropsWithChildren<
HtmlDivAttributesRestProps
>
) {
function ContainerTop({
children,
className,
...rest
}: PropsWithChildren<HtmlDivAttributesRestProps>) {
const styles = useStyles();
const containerStyle = useContainerStyle({ className });

Expand Down Expand Up @@ -106,9 +106,10 @@ function ContentSmall({ body, illustration, title }: ContentProps) {
);
}

function ContentExtraSmall(
{ title, body }: Omit<ContentProps, "illustration">
) {
function ContentExtraSmall({
title,
body,
}: Omit<ContentProps, "illustration">) {
const screenStyles = useStyles();
return (
<>
Expand All @@ -118,36 +119,42 @@ function ContentExtraSmall(
);
}

export function MainEmptyView(
{ after, illustration, title, children, ...rest }: EmptyViewProps
) {
export function MainEmptyView({
after,
illustration,
title,
children,
...rest
}: EmptyViewProps) {
const screenStyles = useStyles();
const media = useMediaQuery();
return (
<ContainerSpacious {...rest}>
{media === "small"
? (
<ContentMedium
illustration={illustration}
title={title}
body={children}
/>
)
: (
<ContentLarge
illustration={illustration}
title={title}
body={children}
/>
)}
{media === "small" ? (
<ContentMedium
illustration={illustration}
title={title}
body={children}
/>
) : (
<ContentLarge
illustration={illustration}
title={title}
body={children}
/>
)}
<div className={screenStyles.after}>{after}</div>
</ContainerSpacious>
);
}

export function PanelEmptyView(
{ after, illustration, title, children, ...rest }: EmptyViewProps
) {
export function PanelEmptyView({
after,
illustration,
title,
children,
...rest
}: EmptyViewProps) {
const screenStyles = useStyles();
return (
<ContainerTop {...rest}>
Expand All @@ -161,9 +168,12 @@ export function PanelEmptyView(
);
}

export function SubmenuEmptyView(
{ illustration, title, children, ...rest }: Omit<EmptyViewProps, "after">
) {
export function SubmenuEmptyView({
illustration,
title,
children,
...rest
}: Omit<EmptyViewProps, "after">) {
return (
<ContainerTop {...rest}>
<ContentSmall illustration={illustration} title={title} body={children} />
Expand All @@ -184,9 +194,12 @@ export function SubmenuEmptyView(
* </DialogContent>
* ```
*/
export function DialogEmptyView(
{ after, title, children, ...rest }: Omit<EmptyViewProps, "illustration">
) {
export function DialogEmptyView({
after,
title,
children,
...rest
}: Omit<EmptyViewProps, "illustration">) {
const screenStyles = useStyles();
return (
<ContainerCompact {...rest}>
Expand Down
11 changes: 0 additions & 11 deletions components/password-input/.eslintrc.json

This file was deleted.

7 changes: 2 additions & 5 deletions components/password-input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
"main": "lib/cjs/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib"
],
"files": ["lib"],
"scripts": {
"build": "pnpm build:cjs && pnpm build:esm",
"build:cjs": "tsc --module commonjs --outDir lib/cjs",
"build:esm": "tsc",
"check:unused-deps": "depcheck . --config=depcheck.yml",
"lint": "tsc --noEmit && eslint . --cache",
"lint": "tsc --noEmit && biome check",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest watch"
Expand All @@ -39,7 +37,6 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitest/coverage-c8": "^0.33.0",
"eslint": "^8.57.1",
"jsdom": "^26.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
Loading

0 comments on commit 52ecb1f

Please sign in to comment.