Skip to content

Commit

Permalink
Merge pull request #290 from chrismwilliams/tooling/use-biome
Browse files Browse the repository at this point in the history
Tooling: use biome
  • Loading branch information
chrismwilliams authored Aug 22, 2024
2 parents abfae1f + c0a1321 commit 80cfc1e
Show file tree
Hide file tree
Showing 38 changed files with 312 additions and 2,702 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

67 changes: 0 additions & 67 deletions .eslintrc.cjs

This file was deleted.

8 changes: 7 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ module.exports = {
plugins: ["prettier-plugin-astro", "prettier-plugin-tailwindcss" /* Must come last */],
overrides: [
{
files: "*.astro",
files: "**/*.astro",
options: {
parser: "astro",
},
},
{
files: ["*.mdx", "*.md"],
options: {
printWidth: 80,
},
},
],
};
28 changes: 14 additions & 14 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": { "editor.defaultFormatter": "biomejs.biome" },
"[typescript]": { "editor.defaultFormatter": "biomejs.biome" },
"[javascriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
"[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
"[json]": { "editor.defaultFormatter": "biomejs.biome" },
"[jsonc]": { "editor.defaultFormatter": "biomejs.biome" },
"[astro]": { "editor.defaultFormatter": "astro-build.astro-vscode" },
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
"source.organizeImports": "never",
"source.organizeImports.biome": "explicit",
"source.fixAll": "never",
"quickfix.biome": "explicit"
},
"[markdown]": {
"editor.wordWrap": "on"
},
"prettier.documentSelectors": ["**/*.astro"],
"eslint.probe": [
"astro",
"javascript",
"javascriptreact",
"markdown",
"typescript",
"typescriptreact"
],
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
}
"typescript.tsdk": "node_modules/typescript/lib",
"astro.content-intellisense": true
}
8 changes: 3 additions & 5 deletions astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import fs from "node:fs";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";
import expressiveCode from "astro-expressive-code";
import icon from "astro-icon";
import fs from "fs";
import { defineConfig } from "astro/config";
import rehypeExternalLinks from "rehype-external-links";
import remarkUnwrapImages from "remark-unwrap-images";

Expand All @@ -31,7 +31,7 @@ export default defineConfig({
[
rehypeExternalLinks,
{
rel: ["nofollow, noopener, noreferrer"],
rel: ["nofollow, noreferrer"],
target: "_blank",
},
],
Expand Down Expand Up @@ -60,9 +60,7 @@ function rawFonts(ext: string[]) {
name: "vite-plugin-raw-fonts",
// @ts-expect-error:next-line
transform(_, id) {
// eslint-disable-next-line
if (ext.some((e) => id.endsWith(e))) {
// eslint-disable-next-line
const buffer = fs.readFileSync(id);
return {
code: `export default ${JSON.stringify(buffer)}`,
Expand Down
36 changes: 36 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"formatter": {
"indentStyle": "tab",
"indentWidth": 2,
"lineWidth": 100,
"formatWithErrors": true,
"ignore": ["*.astro"]
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noSvgWithoutTitle": "off"
},
"suspicious": {
"noExplicitAny": "warn"
}
}
},
"javascript": {
"formatter": {
"trailingCommas": "all",
"semicolons": "always"
}
},
"vcs": {
"clientKind": "git",
"enabled": true,
"useIgnoreFile": true
}
}
20 changes: 5 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"build": "astro build",
"postbuild": "pagefind --site dist",
"preview": "astro preview",
"format": "prettier -w --cache . && prettier -w --cache **/*.astro",
"lint": "biome lint .",
"format": "pnpm run format:code && pnpm run format:imports",
"format:code": "biome format . --write && prettier -w \"**/*\" \"!**/*.{md,mdx}\" --ignore-unknown --cache",
"format:imports": "biome check --formatter-enabled=false --write",
"check": "astro check"
},
"dependencies": {
Expand All @@ -27,26 +30,13 @@
},
"devDependencies": {
"@astrojs/check": "^0.9.3",
"@biomejs/biome": "^1.8.3",
"@iconify-json/mdi": "^1.1.68",
"@pagefind/default-ui": "^1.1.0",
"@resvg/resvg-js": "^2.6.2",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/typography": "^0.5.14",
"@types/eslint": "^9.6.0",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"astro-eslint-parser": "^0.16.3",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-astro": "^0.34.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-markdown": "^4.0.1",
"eslint-plugin-perfectionist": "^2.8.0",
"eslint-plugin-regexp": "^2.5.0",
"eslint-plugin-typescript-sort-keys": "^3.2.0",
"mdast-util-to-string": "^4.0.0",
"pagefind": "^1.1.0",
"prettier": "^3.3.3",
Expand Down
Loading

0 comments on commit 80cfc1e

Please sign in to comment.