Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Biome #216

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions boilerplates/biome/files/$package.json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { addDependency, loadAsJson, setScripts, type TransformerProps } from "@batijs/core";

export default async function getPackageJson(props: TransformerProps) {
const packageJson = await loadAsJson(props);

setScripts(packageJson, {
lint: {
value: "biome check --apply-unsafe ./",
precedence: 0
},
format: {
value: "biome format --write ./",
precedence: 0
},
});

return addDependency(packageJson, await import("../package.json", { assert: { type: "json" } }), {

Check failure on line 17 in boilerplates/biome/files/$package.json.ts

View workflow job for this annotation

GitHub Actions / lint-and-check-types (18)

Parsing error:

Check failure on line 17 in boilerplates/biome/files/$package.json.ts

View workflow job for this annotation

GitHub Actions / lint-and-check-types (20)

Parsing error:
devDependencies: ["@biomejs/biome"],
});
}
18 changes: 18 additions & 0 deletions boilerplates/biome/files/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.0/schema.json",
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"files": {
"ignore": [
"./dist/**",
"./node_modules/**"
]
}
}
30 changes: 30 additions & 0 deletions boilerplates/biome/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "@batijs/biome",
"private": true,
"version": "0.0.1",
"description": "",
"type": "module",
"scripts": {
"check-types": "tsc --noEmit",
"build": "bati-compile-boilerplate"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@batijs/compile": "workspace:*",
"@biomejs/biome": "^1.6.0",
"@types/node": "^18.19.14"
},
"dependencies": {
"@batijs/core": "workspace:*"
},
"files": [
"dist/"
],
"bati": {
"if": {
"flag": "biome"
}
}
}
5 changes: 5 additions & 0 deletions boilerplates/biome/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"../tsconfig.base.json"
]
}
5 changes: 4 additions & 1 deletion packages/core/src/utils/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface PackageJsonScripts {
build?: string;
preview?: string;
lint?: string;
format?: string;
};
}

Expand All @@ -26,6 +27,7 @@ export interface PackageJsonScriptOptions {
build?: PackageJsonScriptOption;
preview?: PackageJsonScriptOption;
lint?: PackageJsonScriptOption;
format?: PackageJsonScriptOption;
}

function* deps(obj: PackageJsonDeps) {
Expand Down Expand Up @@ -82,6 +84,7 @@ const previousScripts: Required<PackageJsonScriptOptions> = {
build: { precedence: -Infinity },
preview: { precedence: -Infinity },
lint: { precedence: -Infinity },
format: { precedence: -Infinity },
};

function warnScript(key: string, old: string, nnew: string) {
Expand All @@ -98,7 +101,7 @@ function warnScript(key: string, old: string, nnew: string) {
}

export function setScripts<T extends PackageJsonScripts>(packageJson: T, scripts: PackageJsonScriptOptions) {
const keys = ["dev", "build", "preview", "lint"] as const;
const keys = ["dev", "build", "preview", "lint", "format"] as const;

for (const key of keys) {
const prev = previousScripts[key]!;
Expand Down
1 change: 0 additions & 1 deletion packages/features/src/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ export const features = [
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICdodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQnPjxzdmcgeG1sbnM9J2h0dHA6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NjU5IDYuNSw0LjVDIDE0Ljg0LDQuMzMzNiAyMy4xNzMzLDQuNTAwMjcgMzEuNSw1QyAzOS44NjA5LDkuMjUxNDYgNDEuNTI3NSwxNS4yNTE1IDM2LjUsMjNDIDQxLjc1NiwyOC41OTM1IDQxLjc1NiwzNC4yNjAyIDM2LjUsNDBDIDM0Ljk3NTEsNDEuMDA4NiAzMy4zMDg0LDQxLjUwODYgMzEuNSw0MS41IFonLz48L2c+PGc+PHBhdGggc3R5bGU9J29wYWNpdHk6MC42ODInIGZpbGw9JyM5MjhlMzYnIGQ9J00gMjguNSwxNC41IEMgMjkuMTIzOSwxNC45MTY5IDI5LjQ1NzMsMTUuNTgzNiAyOS41LDE2LjVDIDI5LjI1MjgsMTcuNzEzMyAyOC41ODYyLDE4LjM4IDI3LjUsMTguNUMgMjguMjM0MSwxNy4yOTIxIDI4LjU2NzQsMTUuOTU4NyAyOC41LDE0LjUgWicvPjwvZz48Zz48cGF0aCBzdHlsZT0nb3BhY2l0eTowLjc1OCcgZmlsbD0nI2M0YTMyMycgZD0nTSAyMy41LDMzLjUgQyAyMy41LDM2LjE2NjcgMjMuNSwzOC44MzMzIDIzLjUsNDEuNUMgMjYuMTY2Nyw0MS41IDI4LjgzMzMsNDEuNSAzMS41LDQxLjVDIDI4LjcxMzEsNDIuNDc2NyAyNS43MTMxLDQyLjgxIDIyLjUsNDIuNUMgMjIuMTksMzkuMjg2OSAyMi41MjMzLDM2LjI4NjkgMjMuNSwzMy41IFonLz48L2c+PC9zdmc+Cg==",
url: "https://biomejs.dev",
spectrum: "bleeding_edge",
disabled: true,
},

// Error tracking
Expand Down
11 changes: 11 additions & 0 deletions packages/tests/tests/FRAMEWORK+biome.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { describeBati } from "@batijs/tests-utils";

export const matrix = [["solid", "react", "vue"], "biome"];

await describeBati(({ test, expect, fetch }) => {
test("home", async () => {
const res = await fetch("/");
expect(res.status).toBe(200);
expect(await res.text()).not.toContain('{"is404":true}');
});
});
Loading
Loading