From 1367ca26ce6b32634068d2d2ced6be848e95241c Mon Sep 17 00:00:00 2001 From: iorate <682043+iorate@users.noreply.github.com> Date: Sun, 16 Jun 2024 01:21:21 +0900 Subject: [PATCH] chore: update biome settings --- .github/workflows/check.yml | 2 +- .vscode/settings.json | 3 --- biome.json | 18 +++++++++++++++--- lefthook.yml | 6 +++--- package.json | 8 ++++++-- src/scripts/options/from-now.tsx | 2 +- src/scripts/options/set-interval-item.tsx | 2 +- src/scripts/options/sync-section.tsx | 2 +- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 3c184a9c6..a4c70d3ae 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -33,7 +33,7 @@ jobs: run: pnpm install - name: Check - run: pnpm check + run: pnpm check-ci - name: Test run: pnpm test diff --git a/.vscode/settings.json b/.vscode/settings.json index 5fd3f8597..2eca1080c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,9 +5,6 @@ }, "editor.defaultFormatter": "biomejs.biome", "editor.formatOnSave": true, - "[css]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, diff --git a/biome.json b/biome.json index c16e51e92..6caedf3c9 100644 --- a/biome.json +++ b/biome.json @@ -14,10 +14,22 @@ "linter": { "rules": { "correctness": { - "noUnusedImports": "warn", - "noUnusedVariables": "warn", - "useHookAtTopLevel": "warn" + "noUnusedImports": "error", + "noUnusedVariables": "error", + "useHookAtTopLevel": "error" + }, + "nursery": { + "useImportExtensions": "error" } } + }, + "css": { + "formatter": { + "enabled": true, + "indentStyle": "space" + }, + "linter": { + "enabled": true + } } } diff --git a/lefthook.yml b/lefthook.yml index 8024bebd8..cdf634c03 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -2,10 +2,10 @@ pre-commit: parallel: true commands: biome: - glob: "*.{js,cjs,mjs,ts,cts,mts,jsx,tsx,json,jsonc}" - run: pnpm biome check --apply --no-errors-on-unmatched {staged_files} + glob: "*.{js,cjs,mjs,ts,cts,mts,jsx,tsx,json,jsonc,css}" + run: pnpm biome check --write --no-errors-on-unmatched {staged_files} stage_fixed: true prettier: - glob: "*.{css,yml,yaml,md,markdown}" + glob: "*.{yml,yaml,md,markdown}" run: pnpm prettier --write {staged_files} stage_fixed: true diff --git a/package.json b/package.json index 9cc5285da..631ee2efc 100644 --- a/package.json +++ b/package.json @@ -57,11 +57,15 @@ "scripts": { "build": "tsx scripts/build.ts", "check": "pnpm run /^check:/", - "check:biome": "biome check .", + "check:biome": "biome check", "check:prettier": "prettier --check .", "check:tsc": "tsc", + "check-ci": "pnpm run /^check-ci:/", + "check-ci:biome": "biome ci --reporter=github", + "check-ci:prettier": "prettier --check .", + "check-ci:tsc": "tsc", "fix": "pnpm run /^fix:/", - "fix:biome": "biome check --apply .", + "fix:biome": "biome check --write", "fix:prettier": "prettier --write .", "generate-ruleset-parser": "lezer-generator src/scripts/ruleset/ruleset.grammar -o src/scripts/ruleset/parser.js --noTerms", "generate-third-party-notices": "tsx scripts/generate-third-party-notices.ts", diff --git a/src/scripts/options/from-now.tsx b/src/scripts/options/from-now.tsx index c6b50e04b..b82218caa 100644 --- a/src/scripts/options/from-now.tsx +++ b/src/scripts/options/from-now.tsx @@ -1,7 +1,7 @@ import dayjs from "dayjs"; import dayjsRelativeTime from "dayjs/plugin/relativeTime"; import { useEffect, useState } from "react"; -import "../dayjs-locales"; +import "../dayjs-locales.ts"; import { translate } from "../locales.ts"; dayjs.extend(dayjsRelativeTime); diff --git a/src/scripts/options/set-interval-item.tsx b/src/scripts/options/set-interval-item.tsx index 0a5941f79..cc94887e9 100644 --- a/src/scripts/options/set-interval-item.tsx +++ b/src/scripts/options/set-interval-item.tsx @@ -3,7 +3,7 @@ import { useState } from "react"; import { ControlLabel, LabelWrapper } from "../components/label.tsx"; import { Row, RowItem } from "../components/row.tsx"; import { useClassName } from "../components/utilities.ts"; -import "../dayjs-locales"; +import "../dayjs-locales.ts"; import { saveToLocalStorage } from "../local-storage.ts"; import { translate } from "../locales.ts"; import { useOptionsContext } from "./options-context.tsx"; diff --git a/src/scripts/options/sync-section.tsx b/src/scripts/options/sync-section.tsx index 1d1092282..fb09d549b 100644 --- a/src/scripts/options/sync-section.tsx +++ b/src/scripts/options/sync-section.tsx @@ -33,7 +33,7 @@ import { import { Text } from "../components/text.tsx"; import { TextArea } from "../components/textarea.tsx"; import { usePrevious } from "../components/utilities.ts"; -import "../dayjs-locales"; +import "../dayjs-locales.ts"; import { getWebsiteURL, translate } from "../locales.ts"; import { addMessageListeners, sendMessage } from "../messages.ts"; import { supportedClouds } from "../supported-clouds.ts";