Skip to content

Commit

Permalink
Remove ESLint configuration and add Biome configuration for linting a…
Browse files Browse the repository at this point in the history
…nd formatting
  • Loading branch information
sergiodxa committed Dec 6, 2024
1 parent bf7ed54 commit c1fe97d
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 106 deletions.
50 changes: 0 additions & 50 deletions .eslintrc.cjs

This file was deleted.

55 changes: 55 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignore": ["src/server/json-hash.ts"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"correctness": {
"useHookAtTopLevel": "error"
},
"performance": {
"noBarrelFile": "error",
"noReExportAll": "error"
},
"style": {
"noNegationElse": "error",
"useConst": "off",
"useExportType": "off",
"useImportType": "off"
},
"suspicious": {
"noConsoleLog": "warn",
"noEmptyBlockStatements": "warn",
"noSkippedTests": "error"
},
"nursery": {
"useSortedClasses": {
"level": "error",
"options": {
"attributes": ["className", "class"],
"functions": ["cn", "tv"]
}
}
}
}
},
"formatter": { "enabled": true },
"vcs": {
"enabled": true,
"clientKind": "git",
"defaultBranch": "main",
"useIgnoreFile": true
},
"overrides": [
{
"include": ["**/*.md"],
"formatter": { "indentStyle": "tab" }
}
]
}
Binary file modified bun.lockb
Binary file not shown.
24 changes: 4 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@
"sponsor": {
"url": "https://github.com/sponsors/sergiodxa"
},
"files": [
"src",
"build",
"package.json",
"README.md"
],
"files": ["src", "build", "package.json", "README.md"],
"scripts": {
"build": "tsc",
"typecheck": "tsc --noEmit",
Expand Down Expand Up @@ -102,28 +97,17 @@
}
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@cloudflare/workers-types": "^4.20241112.0",
"@react-router/cloudflare": "^7.0.1",
"@total-typescript/tsconfig": "^1.0.4",
"@types/bun": "^1.1.14",
"@types/node": "^20.11.28",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prefer-let": "^3.0.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-testing-library": "^6.2.0",
"eslint-plugin-unicorn": "^53.0.0",
"i18next": "^23.10.1",
"prettier": "^3.2.4",
"remix-i18next": "^7.0.0",
"typescript": "^5.7.2",
"vite": "^5.4.11",
"vite-tsconfig-paths": "^5.1.3",
"zod": "^3.22.4"
}
},
"trustedDependencies": ["@biomejs/biome"]
}
9 changes: 0 additions & 9 deletions prettier.config.mjs

This file was deleted.

6 changes: 2 additions & 4 deletions src/cloudflare.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import type {
Fetcher,
RequestInit,
KVNamespace,
RequestInit,
} from "@cloudflare/workers-types";
import type { Context } from "hono";

import { createWorkersKVSessionStorage } from "@react-router/cloudflare";
import type { Context } from "hono";
import { createMiddleware } from "hono/factory";
import { cacheHeader } from "pretty-cache-header";
import {
type CookieOptions,
type SessionData,
createCookieSessionStorage,
} from "react-router";

import { session } from "./session.js";

interface StaticAssetsOptions {
Expand Down
3 changes: 1 addition & 2 deletions src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Context } from "hono";
import type { AppLoadContext, ServerBuild } from "react-router";

import { createMiddleware } from "hono/factory";
import type { AppLoadContext, ServerBuild } from "react-router";
import { createRequestHandler } from "react-router";

export interface ReactRouterMiddlewareOptions {
Expand Down
3 changes: 1 addition & 2 deletions src/i18next.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Context } from "hono";
import { createMiddleware } from "hono/factory";
import type { FlatNamespace, TFunction } from "i18next";
import type { RemixI18NextOption } from "remix-i18next/server";

import { createMiddleware } from "hono/factory";
import { RemixI18Next } from "remix-i18next/server";

const i18nSymbol = Symbol().toString();
Expand Down
3 changes: 1 addition & 2 deletions src/session.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Context } from "hono";
import type { Session, SessionData, SessionStorage } from "react-router";

import { createMiddleware } from "hono/factory";
import type { Session, SessionData, SessionStorage } from "react-router";

type Env = {
Variables: Record<symbol, unknown>;
Expand Down
3 changes: 1 addition & 2 deletions src/typed-env.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Context } from "hono";
import type { z } from "zod";

import { env } from "hono/adapter";
import type { z } from "zod";

export function typedEnv<Schema extends z.ZodTypeAny>(
c: Context,
Expand Down
3 changes: 1 addition & 2 deletions test/cloudflare.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { afterAll, describe, expect, mock, test } from "bun:test";
import { createWorkersKVSessionStorage } from "@react-router/cloudflare";
import { describe, test, expect, mock, afterAll } from "bun:test";
import { Context } from "hono";
import { createCookieSessionStorage } from "react-router";

import {
cookieSession,
staticAssets,
Expand Down
6 changes: 2 additions & 4 deletions test/handler.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import type { ServerBuild } from "react-router";

import { describe, test, expect, mock, afterAll } from "bun:test";
import { afterAll, describe, expect, mock, test } from "bun:test";
import { Hono } from "hono";

import type { ServerBuild } from "react-router";
import { reactRouter } from "../src/handler";

const build = {
Expand Down
3 changes: 1 addition & 2 deletions test/security.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, test, expect, mock, afterAll } from "bun:test";
import { afterAll, describe, expect, mock, test } from "bun:test";
import { Context } from "hono";

import { httpsOnly } from "../src/security";

describe(httpsOnly.name, () => {
Expand Down
4 changes: 1 addition & 3 deletions test/session.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { describe, test, expect, mock, afterAll, spyOn } from "bun:test";
import { afterAll, describe, expect, mock, spyOn, test } from "bun:test";
import { Context } from "hono";
import { createCookieSessionStorage } from "react-router";

import { getSession, getSessionStorage, session } from "../src/session";

const sessionStorage = createCookieSessionStorage({
Expand Down Expand Up @@ -75,7 +74,6 @@ describe(session.name, () => {
});

await middleware(c, next);
console.log("here");

expect(createSessionStorage).toHaveBeenCalledTimes(2);
expect(c.set).toHaveBeenNthCalledWith(
Expand Down
3 changes: 1 addition & 2 deletions test/setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createWorkersKVSessionStorage } from "@react-router/cloudflare";
import { mock } from "bun:test";
import { createWorkersKVSessionStorage } from "@react-router/cloudflare";
import { createCookieSessionStorage } from "react-router";

import * as session from "../src/session";

mock.module("@react-router/cloudflare", () => {
Expand Down
3 changes: 1 addition & 2 deletions test/trailing-slash.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { describe, test, expect, mock, afterAll } from "bun:test";
import { afterAll, describe, expect, mock, test } from "bun:test";
import { Context } from "hono";

import { trailingSlash } from "../src/trailing-slash";

describe(trailingSlash.name, () => {
Expand Down

0 comments on commit c1fe97d

Please sign in to comment.