Skip to content

Commit

Permalink
move from Eslint/prettier to biome (#549)
Browse files Browse the repository at this point in the history
* move from eslint to biome

* move formatting to biome

* update yarn and node
  • Loading branch information
xaviergonz authored Sep 22, 2024
1 parent 6cb51bf commit 10a44bd
Show file tree
Hide file tree
Showing 123 changed files with 769 additions and 2,255 deletions.
16 changes: 1 addition & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

env:
NODE_VERSION: "22.5.1"
NODE_VERSION: "22.9.0"

jobs:
lib-site-build:
Expand Down Expand Up @@ -92,17 +92,3 @@ jobs:
- run: yarn lib:build
- run: yarn build
working-directory: ./apps/benchmark

# formatting:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4

# - uses: actions/setup-node@v4
# with:
# node-version: ${{ env.NODE_VERSION }}
# cache: "yarn"

# - run: yarn install --immutable
# - run: yarn prettier --check .
21 changes: 0 additions & 21 deletions .prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "arcanis.vscode-zipfs"]
"recommendations": ["biomejs.biome", "arcanis.vscode-zipfs"]
}
6 changes: 2 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"typescript.tsdk": "./node_modules/typescript/lib",
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"peacock.color": "#68217A",
"workbench.colorCustomizations": {
"titleBar.activeBackground": "#68217a",
Expand All @@ -15,6 +14,5 @@
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"eslint.experimental.useFlatConfig": true
}
}
2 changes: 0 additions & 2 deletions apps/benchmark/src/bench.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-function-type */

import Benchmark from "benchmark"
import chalk from "chalk"

Expand Down
8 changes: 4 additions & 4 deletions apps/site/docs/examples/clientServer/appInstance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ function initAppInstance() {
// also listen to local actions, cancel them and send them to the server
onActionMiddleware(rootStore, {
onStart(actionCall, ctx) {
if (!serverAction) {
if (serverAction) {
// just run the server action unmodified
return undefined
} else {
// if the action does not come from the server cancel it silently
// and send it to the server
// it will then be replicated by the server and properly executed
Expand All @@ -55,9 +58,6 @@ function initAppInstance() {
result: ActionTrackingResult.Return,
value: undefined,
}
} else {
// just run the server action unmodified
return undefined
}
},
})
Expand Down
3 changes: 2 additions & 1 deletion apps/site/docs/examples/todoList/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { observer } from "mobx-react"
import React, { useState } from "react"
import { useState } from "react"
import { LogsView } from "./logs"
import { createRootStore, Todo, TodoList } from "./store"

Expand Down Expand Up @@ -60,6 +60,7 @@ export const TodoListView = observer(({ list }: { list: TodoList }) => {
placeholder="I will..."
/>
<button
type="button"
onClick={() => {
list.add(new Todo({ text: newTodo }))
setNewTodo("")
Expand Down
1 change: 0 additions & 1 deletion apps/site/docs/examples/todoList/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export function createRootStore(): TodoList {
registerRootStore(rootStore)

// we can also connect the store to the redux dev tools
// eslint-disable-next-line @typescript-eslint/no-require-imports
const remotedev = require("remotedev")
const connection = remotedev.connectViaExtension({
name: "Todo List Example",
Expand Down
1 change: 1 addition & 0 deletions apps/site/docs/examples/yjsBinding/appInstance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const AppInstance = observer(() => {

<div>{status.connected ? "Online (sync enabled)" : "Offline (sync disabled)"}</div>
<button
type="button"
onClick={() => {
toggleWebrtcProviderConnection()
}}
Expand Down
3 changes: 1 addition & 2 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"scripts": {
"start": "docusaurus start",
"build": "docusaurus build && shx cp -r ./copy-to-build/. ./build",
"serve": "docusaurus serve",
"lint": "cd ../.. && yarn eslint \"apps/site/{src,docs}/**/*.{ts,tsx}\""
"serve": "docusaurus serve"
},
"dependencies": {
"@docusaurus/core": "^3.5.2",
Expand Down
2 changes: 0 additions & 2 deletions apps/site/src/pages/example-apps/yjs-binding.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable import-x/no-unresolved */
import BrowserOnly from "@docusaurus/BrowserOnly"
/* eslint-enable import-x/no-unresolved */
import { App } from "../../../docs/examples/yjsBinding/app"

const Page = () => (
Expand Down
123 changes: 123 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json",
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
"files": {
"ignoreUnknown": false,
"ignore": [
"**/node_modules/",
"**/dist/",
"./packages/lib/coverage/",
"./packages/lib/api-docs/",
"./apps/site/.docusaurus/",
"./apps/site/build/",
"./apps/site/copy-to-build/",
"./apps/site/static/api/",
"**/.yarn/",
"**/.pnp.*"
]
},
"formatter": {
"enabled": true,
"useEditorconfig": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 100,
"attributePosition": "auto",
"bracketSpacing": true
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": { "all": true, "useKeyWithClickEvents": "off" },
"complexity": {
"all": true,
"noBannedTypes": "off",
"noExcessiveCognitiveComplexity": "off",
"noForEach": "off",
"noUselessThisAlias": "off",
"noVoid": "off"
},
"correctness": {
"all": true,
"noUndeclaredDependencies": "off",
"useImportExtensions": "off"
},
"performance": {
"all": true,
"noBarrelFile": "off",
"noReExportAll": "off"
},
"security": { "all": true },
"style": {
"all": true,
"noArguments": "off",
"noDefaultExport": "off",
"noNamespaceImport": "off",
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"noParameterProperties": "off",
"noUnusedTemplateLiteral": "off",
"noUselessElse": "off",
"useConsistentArrayType": "off",
"useFilenamingConvention": "off",
"useForOf": "off",
"useImportType": "off",
"useNamingConvention": "off",
"useShorthandArrayType": "off",
"useTemplate": "off"
},
"suspicious": {
"all": true,
"noArrayIndexKey": "off",
"noAssignInExpressions": "off",
"noConfusingVoidType": "off",
"noConsole": "off",
"noEmptyBlockStatements": "off",
"noEmptyInterface": "off",
"noExplicitAny": "off",
"noMisplacedAssertion": "off",
"noReactSpecificProps": "off"
}
},
"ignore": ["packages/lib/src/action/modelFlowPromiseGenerator.ts"],
"include": [
"apps/site/src/**/*.ts",
"apps/site/src/**/*.tsx",
"apps/site/docs/**/*.ts",
"apps/site/docs/**/*.tsx",
"packages/lib/src/**/*.ts",
"packages/lib/test/**/*.ts",
"packages/mobx-keystone-yjs/src/**/*.ts",
"packages/mobx-keystone-yjs/test/**/*.ts"
]
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "es5",
"semicolons": "asNeeded",
"arrowParentheses": "always",
"bracketSameLine": false,
"quoteStyle": "double",
"attributePosition": "auto",
"bracketSpacing": true
},
"globals": [
"afterEach",
"beforeEach",
"describe",
"expect",
"it",
"jest",
"test",
"fail",
"arguments",
"ReadonlySetLike"
]
}
}
Loading

0 comments on commit 10a44bd

Please sign in to comment.