Switched to biome.

This commit is contained in:
Mike Cao 2025-11-20 20:56:16 -08:00
parent abc1b50ad0
commit 15fda927ce
11 changed files with 184 additions and 1167 deletions

View file

@ -1 +0,0 @@
/src/generated/

View file

@ -1,51 +0,0 @@
{
"env": {
"browser": true,
"es2020": true,
"node": true,
"jquery": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 11,
"sourceType": "module"
},
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/typescript",
"plugin:css-modules/recommended",
"plugin:cypress/recommended",
"prettier",
"next"
],
"plugins": ["@typescript-eslint", "prettier", "promise", "css-modules", "cypress"],
"rules": {
"no-console": "error",
"react/display-name": "off",
"react-hooks/exhaustive-deps": "off",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"import/no-anonymous-default-export": "off",
"import/no-named-as-default": "off",
"css-modules/no-unused-class": "off",
"@next/next/no-img-element": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }],
"@typescript-eslint/no-namespace": ["error", { "allowDeclarations": true }],
"@typescript-eslint/triple-slash-reference": "off"
},
"globals": {
"React": "writable"
}
}

View file

@ -1,2 +0,0 @@
/public/script.js
/src/generated/

View file

@ -1,7 +0,0 @@
{
"arrowParens": "avoid",
"endOfLine": "lf",
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}

52
biome.json Normal file
View file

@ -0,0 +1,52 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.6/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"includes": ["**", "!!**/dist"]
},
"formatter": {
"enabled": true,
"lineWidth": 100,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": "off",
"correctness": {
"useExhaustiveDependencies": "off"
},
"style": {
"noDescendingSpecificity": "off"
},
"suspicious": {
"noExplicitAny": "off"
},
"performance": {
"noImgElement": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"trailingCommas": "all",
"arrowParentheses": "asNeeded"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}

View file

@ -1,5 +1,5 @@
import 'dotenv/config';
import pkg from './package.json' assert { type: 'json' };
import pkg from './package.json' with { type: 'json' };
const TRACKER_SCRIPT = '/script.js';

View file

@ -42,24 +42,18 @@
"download-country-names": "node scripts/download-country-names.js",
"download-language-names": "node scripts/download-language-names.js",
"change-password": "node scripts/change-password.js",
"lint": "next lint --quiet",
"prepare": "node -e \"if (process.env.NODE_ENV !== 'production'){process.exit(1)} \" || husky install",
"postbuild": "node scripts/postbuild.js",
"test": "jest",
"cypress-open": "cypress open cypress run",
"cypress-run": "cypress run cypress run"
"cypress-run": "cypress run cypress run",
"lint": "biome lint .",
"format": "biome format --write .",
"check": "biome check --apply"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"prettier --write",
"eslint"
],
"**/*.css": [
"stylelint --fix",
"prettier --write"
],
"**/*.json": [
"prettier --write"
"**/*.{js,jsx,ts,tsx,json,css}": [
"npm run format"
]
},
"cacheDirectories": [
@ -78,7 +72,7 @@
"@react-spring/web": "^10.0.3",
"@svgr/cli": "^8.1.0",
"@tanstack/react-query": "^5.90.5",
"@umami/react-zen": "^0.207.0",
"@umami/react-zen": "^0.208.0",
"@umami/redis-client": "^0.29.0",
"bcryptjs": "^3.0.2",
"chalk": "^5.6.2",
@ -132,6 +126,7 @@
"zustand": "^5.0.8"
},
"devDependencies": {
"@biomejs/biome": "^2.3.6",
"@formatjs/cli": "^4.2.29",
"@netlify/plugin-nextjs": "^5.14.4",
"@rollup/plugin-alias": "^5.0.0",
@ -151,15 +146,6 @@
"babel-plugin-react-compiler": "19.1.0-rc.2",
"cross-env": "^10.1.0",
"cypress": "^13.6.6",
"eslint": "^8.33.0",
"eslint-config-next": "^14.2.33",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-plugin-css-modules": "^2.12.0",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.5.3",
"extract-react-intl-messages": "^4.1.1",
"husky": "^9.1.7",
"jest": "^29.7.0",
@ -168,7 +154,6 @@
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-import": "^15.1.0",
"postcss-preset-env": "7.8.3",
"prettier": "^3.6.2",
"prompts": "2.4.2",
"rollup": "^4.52.5",
"rollup-plugin-copy": "^3.4.0",

1193
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,10 @@
import { ClickHouseClient, createClient } from '@clickhouse/client';
import { type ClickHouseClient, createClient } from '@clickhouse/client';
import { formatInTimeZone } from 'date-fns-tz';
import debug from 'debug';
import { CLICKHOUSE } from '@/lib/db';
import { DEFAULT_PAGE_SIZE, FILTER_COLUMNS, OPERATORS } from './constants';
import { filtersObjectToArray } from './params';
import { QueryFilters, QueryOptions } from './types';
import type { QueryFilters, QueryOptions } from './types';
export const CLICKHOUSE_DATE_FORMATS = {
utc: '%Y-%m-%dT%H:%i:%SZ',

View file

@ -1,12 +1,12 @@
import { z } from 'zod';
import { checkAuth } from '@/lib/auth';
import { DEFAULT_PAGE_SIZE, FILTER_COLUMNS } from '@/lib/constants';
import { getAllowedUnits, getMinimumUnit, maxDate, parseDateRange } from '@/lib/date';
import { fetchWebsite } from '@/lib/load';
import { filtersArrayToObject } from '@/lib/params';
import { badRequest, unauthorized } from '@/lib/response';
import { QueryFilters } from '@/lib/types';
import type { QueryFilters } from '@/lib/types';
import { getWebsiteSegment } from '@/queries/prisma';
import { z } from 'zod';
export async function parseRequest(
request: Request,

View file

@ -1,4 +1,4 @@
export function setItem(key: string, data: any, session?: boolean): void {
export function setItem(key: string, data: any, session?: boolean) {
if (typeof window !== 'undefined' && data) {
return (session ? sessionStorage : localStorage).setItem(key, JSON.stringify(data));
}
@ -18,7 +18,7 @@ export function getItem(key: string, session?: boolean): any {
}
}
export function removeItem(key: string, session?: boolean): void {
export function removeItem(key: string, session?: boolean) {
if (typeof window !== 'undefined') {
return (session ? sessionStorage : localStorage).removeItem(key);
}