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

Replace eslint with Biome #1

Merged
merged 6 commits into from
Jul 25, 2024
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
18 changes: 0 additions & 18 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm lint
run: pnpm biome ci --reporter=github
- name: Build
run: pnpm build
26 changes: 9 additions & 17 deletions .ladle/components.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import React from "react";
import "../src/index.css"
import "../src/index.css";

import type { GlobalProvider } from "@ladle/react";

export const Provider: GlobalProvider = ({
children,
globalState,
storyMeta,
}) => {
// Make components that use `className="dark:underline"` dark mode compatible
const theme = globalState.theme;
if (theme === 'dark') {
return (
<div className="dark text-white">
{children}
</div>
)
}
return children;
};
export const Provider: GlobalProvider = ({ children, globalState }) => {
// Make components that use `className="dark:underline"` dark mode compatible
const theme = globalState.theme;
if (theme === "dark") {
return <div className="dark text-white">{children}</div>;
}
return children;
};
8 changes: 4 additions & 4 deletions .ladle/config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('@ladle/react').UserConfig} */
export default {
defaultStory: "index--readme",
outDir: "docs",
base: process.env.CI ? "/haddock3-ui/" : "/",
};
defaultStory: "index--readme",
outDir: "docs",
base: process.env.CI ? "/haddock3-ui/" : "/",
};
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"biomejs.biome",
"bradlc.vscode-tailwindcss",
"yoavbls.pretty-ts-errors"
]
}
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ We use [ladle](https://ladle.dev/) to develop components. To start the developme
pnpm dev
```

To lint use

```bash
pnpm lint
```

To format use

```bash
pnpm format
```

## Build package

```bash
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.12820670.svg)](https://doi.org/10.5281/zenodo.12820670)
[![Research Software Directory Badge](https://img.shields.io/badge/rsd-00a3e3.svg)](https://research-software-directory.org/software/haddock3-ui)
[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu)
[![Checked with Biome](https://img.shields.io/badge/Checked_with-Biome-60a5fa?style=flat&logo=biome)](https://biomejs.dev)

The [haddock3 web application](https://github.com/i-VRESSE/haddock3-webapp) had several components that could be used outside of the web application. This package contains those components.

Expand Down
116 changes: 116 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": { "enabled": true },
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noBannedTypes": "error",
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessTypeConstraint": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useArrayLiterals": "off",
"useExhaustiveDependencies": "warn",
"useHookAtTopLevel": "error",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"style": { "noNamespace": "error", "useAsConstAssertion": "error" },
"suspicious": {
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "off",
"noExplicitAny": "error",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noMisleadingInstantiator": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
},
"ignore": ["**/dist", "**/.eslintrc.cjs"]
},
"overrides": [
{
"include": ["*.ts", "*.tsx", "*.mts", "*.cts"],
"linter": {
"rules": {
"correctness": {
"noConstAssign": "off",
"noGlobalObjectCalls": "off",
"noInvalidConstructorSuper": "off",
"noInvalidNewBuiltin": "off",
"noNewSymbol": "off",
"noSetterReturn": "off",
"noUndeclaredVariables": "off",
"noUnreachable": "off",
"noUnreachableSuper": "off"
},
"style": {
"noArguments": "error",
"noVar": "error",
"useConst": "error"
},
"suspicious": {
"noDuplicateClassMembers": "off",
"noDuplicateObjectKeys": "off",
"noDuplicateParameters": "off",
"noFunctionAssign": "off",
"noImportAssign": "off",
"noRedeclare": "off",
"noUnsafeNegation": "off",
"useGetterReturn": "off"
}
}
}
}
]
}
143 changes: 70 additions & 73 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,75 +1,72 @@
{
"name": "@i-vresse/haddock3-ui",
"version": "0.1.4",
"type": "module",
"private": false,
"sideEffects": false,
"license": "Apache-2.0",
"homepage": "https://github.com/i-VRESSE/haddock3-ui#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/i-VRESSE/haddock3-ui.git"
},
"bugs": {
"url": "https://github.com/i-VRESSE/haddock3-ui/issues"
},
"scripts": {
"dev": "ladle serve",
"build": "tsc -b && vite build",
"build:docs": "ladle build",
"preview": "ladle preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"prepublishOnly": "pnpm build"
},
"dependencies": {
"clsx": "^2.1.1",
"ngl": "^2.3.1",
"tailwind-merge": "^2.4.0"
},
"peerDependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@ladle/react": "^4.1.0",
"@tailwindcss/typography": "^0.5.13",
"@types/node": "^20.14.12",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"postcss": "^8.4.40",
"tailwindcss": "^3.4.6",
"typescript": "^5.2.2",
"vite": "^5.3.4",
"vite-plugin-dts": "^3.9.1"
},
"files": [
"dist"
],
"module": "dist/index.js",
"types": "./dist/src/index.d.ts",
"exports": {
".": {
"module": "./dist/index.mjs",
"import": {
"types": "./dist/src/index.d.ts",
"default": "./dist/index.js"
},
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"packageManager": "pnpm@9.6.0",
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=20"
}
"name": "@i-vresse/haddock3-ui",
"version": "0.1.4",
"type": "module",
"private": false,
"sideEffects": false,
"license": "Apache-2.0",
"homepage": "https://github.com/i-VRESSE/haddock3-ui#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/i-VRESSE/haddock3-ui.git"
},
"bugs": {
"url": "https://github.com/i-VRESSE/haddock3-ui/issues"
},
"scripts": {
"dev": "ladle serve",
"build": "tsc -b && vite build",
"build:docs": "ladle build",
"preview": "ladle preview",
"lint": "biome lint",
"format": "biome check --write",
"prepublishOnly": "pnpm build"
},
"dependencies": {
"clsx": "^2.1.1",
"ngl": "^2.3.1",
"tailwind-merge": "^2.4.0"
},
"peerDependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@biomejs/biome": "1.8.3",
"@ladle/react": "^4.1.0",
"@tailwindcss/typography": "^0.5.13",
"@types/node": "^20.14.12",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.19",
"postcss": "^8.4.40",
"tailwindcss": "^3.4.6",
"typescript": "^5.2.2",
"vite": "^5.3.4",
"vite-plugin-dts": "^3.9.1"
},
"files": ["dist"],
"module": "dist/index.js",
"types": "./dist/src/index.d.ts",
"exports": {
".": {
"module": "./dist/index.mjs",
"import": {
"types": "./dist/src/index.d.ts",
"default": "./dist/index.js"
},
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"packageManager": "pnpm@9.6.0",
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">=20"
}
}
Loading