Skip to content

Commit 5af841b

Browse files
committed
Add biome
1 parent a4de28f commit 5af841b

File tree

15 files changed

+299
-199
lines changed

15 files changed

+299
-199
lines changed

biome.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
3+
"formatter": {
4+
"enabled": true,
5+
"formatWithErrors": false,
6+
"indentStyle": "tab",
7+
"indentWidth": 2,
8+
"lineEnding": "cr",
9+
"lineWidth": 120,
10+
"attributePosition": "auto",
11+
"ignore": ["**/*.rs", "**/*.yaml"]
12+
},
13+
"organizeImports": { "enabled": true },
14+
"linter": { "enabled": true, "rules": { "recommended": true } },
15+
"javascript": {
16+
"formatter": {
17+
"jsxQuoteStyle": "double",
18+
"quoteProperties": "asNeeded",
19+
"trailingComma": "all",
20+
"semicolons": "always",
21+
"arrowParentheses": "always",
22+
"bracketSpacing": true,
23+
"bracketSameLine": false,
24+
"quoteStyle": "double",
25+
"attributePosition": "auto"
26+
}
27+
}
28+
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"watch:ui": "nodemon --watch packages/ui/src -e ts --exec 'turbo run build --scope=ui'",
2121
"watch:utils": "nodemon --watch packages/utils/src -e ts --exec 'turbo run build --scope=utils'",
2222
"start": "cd packages/core && pnpm start",
23-
"format": "prettier --write ."
23+
"format": "biome format ./ --write",
24+
"lint": "biome lint ."
2425
},
2526
"contributors": [
2627
{
@@ -30,10 +31,9 @@
3031
"name": "Rahul Batra"
3132
}
3233
],
33-
"workspaces": [
34-
"./packages/*"
35-
],
34+
"workspaces": ["./packages/*"],
3635
"devDependencies": {
36+
"@biomejs/biome": "^1.7.3",
3737
"@changesets/cli": "2.27.3",
3838
"nodemon": "^3.1.0",
3939
"prettier": "^3.2.5",

packages/commands/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
"type": "git",
99
"url": "https://github.com/solidjs-community/solid-cli"
1010
},
11-
"files": [
12-
"dist",
13-
"types"
14-
],
11+
"files": ["dist", "types"],
1512
"main": "./dist/index.mjs",
1613
"module": "./dist/index.mjs",
1714
"types": "./types/index.d.ts",

packages/commands/src/handlers/add.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ export const handleAdd = async (packages?: string[], forceTransform: boolean = f
179179
if (fileUpdates.length) p.log.message([`${color.cyan("Modify")}`, ...fileUpdates.map((f) => ` - ${f}`)].join("\n"));
180180

181181
if (packageUpdates.length)
182-
p.log.message([`${color.cyan("Install")}`, ...packageUpdates.map((p) => ` - ${p.name}` + (p.dev ? " (dev)" : ""))].join("\n"));
182+
p.log.message(
183+
[`${color.cyan("Install")}`, ...packageUpdates.map((p) => ` - ${p.name}` + (p.dev ? " (dev)" : ""))].join("\n"),
184+
);
183185
if (commandUpdates.length)
184186
p.log.message([`${color.cyan("Run commands")}`, ...commandUpdates.map((p) => ` - ${p}`)].join("\n"));
185187

@@ -196,7 +198,8 @@ export const handleAdd = async (packages?: string[], forceTransform: boolean = f
196198
if (postInstalls.length === 0) return;
197199

198200
p.log.message(
199-
`${postInstalls.length} ${postInstalls.length === 1 ? "package has" : "packages have"
201+
`${postInstalls.length} ${
202+
postInstalls.length === 1 ? "package has" : "packages have"
200203
} post install steps that need to run.`,
201204
);
202205

packages/commands/src/lib/integrations.ts

Lines changed: 70 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type Integrations = Record<Supported, IntegrationsValue>;
2626
export const [rootFile, setRootFile] = createSignal<string | undefined>(undefined);
2727

2828
export const integrations: Record<string, IntegrationsValue> = {
29-
"tailwind": {
29+
tailwind: {
3030
installs: ["tailwindcss", "postcss", "autoprefixer"],
3131
postInstall: async () => {
3232
const pM = detectPackageManager();
@@ -73,7 +73,7 @@ export const integrations: Record<string, IntegrationsValue> = {
7373
await flushQueue();
7474
},
7575
},
76-
"unocss": {
76+
unocss: {
7777
pluginOptions: {
7878
importName: "UnoCss",
7979
importSource: "unocss/vite",
@@ -88,7 +88,7 @@ export const integrations: Record<string, IntegrationsValue> = {
8888
await insertAtBeginning(path, `import "virtual:uno.css";\n`);
8989
},
9090
},
91-
"vitepwa": {
91+
vitepwa: {
9292
pluginOptions: {
9393
importName: "VitePWA",
9494
importSource: "vite-plugin-pwa",
@@ -111,7 +111,7 @@ export const integrations: Record<string, IntegrationsValue> = {
111111
await insertAtBeginning(path, `import "solid-devtools";\n`);
112112
},
113113
},
114-
"vitest": {
114+
vitest: {
115115
installs: [],
116116
installsDev: [
117117
"vitest",
@@ -123,30 +123,32 @@ export const integrations: Record<string, IntegrationsValue> = {
123123
additionalConfig: async () => {
124124
try {
125125
p.log.info("Adding test script to package.json");
126-
let hasStart = false;
127-
manipulateJsonFile("package.json", (packageJson) => {
128-
if (!packageJson.scripts) { packageJson.scripts = {}; }
129-
if (!/\bvitest\b/.test(packageJson.scripts.test || "")) {
130-
packageJson.scripts.test = "vitest";
131-
}
132-
hasStart = packageJson.dependencies["@solidjs/start"]
133-
return packageJson;
134-
});
126+
let hasStart = false;
127+
manipulateJsonFile("package.json", (packageJson) => {
128+
if (!packageJson.scripts) {
129+
packageJson.scripts = {};
130+
}
131+
if (!/\bvitest\b/.test(packageJson.scripts.test || "")) {
132+
packageJson.scripts.test = "vitest";
133+
}
134+
hasStart = packageJson.dependencies["@solidjs/start"];
135+
return packageJson;
136+
});
135137
const hasTs = fileExists("tsconfig.json");
136-
if (hasTs) {
138+
if (hasTs) {
137139
p.log.info("Adding testing types to tsconfig.json");
138-
manipulateJsonFile("tsconfig.json", (tsConfig) => {
139-
if (!tsConfig.compilerOptions) {
140-
tsConfig.compilerOptions = {};
141-
}
142-
tsConfig.compilerOptions.types = [
143-
...new Set([...(tsConfig.compilerOptions.types || []), "vite/client", "@testing-library/jest-dom"]),
144-
];
145-
return tsConfig;
146-
});
140+
manipulateJsonFile("tsconfig.json", (tsConfig) => {
141+
if (!tsConfig.compilerOptions) {
142+
tsConfig.compilerOptions = {};
143+
}
144+
tsConfig.compilerOptions.types = [
145+
...new Set([...(tsConfig.compilerOptions.types || []), "vite/client", "@testing-library/jest-dom"]),
146+
];
147+
return tsConfig;
148+
});
147149
}
148150
if (
149-
hasStart &&
151+
hasStart &&
150152
["ts", "mjs", "cjs", "js"].every(
151153
(suffix) => !fileExists(`vite.config.${suffix}`) && !fileExists(`vitest.config.${suffix}`),
152154
)
@@ -173,49 +175,52 @@ export default defineConfig({
173175
}
174176
},
175177
},
176-
"tauri-v1.x": {
177-
installs: ["@tauri-apps/cli"],
178-
postInstall: async () => {
179-
try {
180-
let name = "";
181-
manipulateJsonFile("package.json", (packageJson) => {
182-
if (!packageJson.scripts) { packageJson.scripts = {}; }
183-
packageJson.scripts.tauri = "tauri";
184-
name = packageJson.name;
185-
return packageJson;
186-
});
187-
await flushQueue();
188-
const pM = detectPackageManager();
189-
await $`${getRunnerCommand(pM)} tauri init --ci -A ${name} -W ${name} -D ../dist -P http://localhost:3000`;
190-
p.note(`Make sure you have installed all prerequisites: https://tauri.app/v1/guides/getting-started/prerequisites
178+
"tauri-v1.x": {
179+
installs: ["@tauri-apps/cli"],
180+
postInstall: async () => {
181+
try {
182+
let name = "";
183+
manipulateJsonFile("package.json", (packageJson) => {
184+
if (!packageJson.scripts) {
185+
packageJson.scripts = {};
186+
}
187+
packageJson.scripts.tauri = "tauri";
188+
name = packageJson.name;
189+
return packageJson;
190+
});
191+
await flushQueue();
192+
const pM = detectPackageManager();
193+
await $`${getRunnerCommand(pM)} tauri init --ci -A ${name} -W ${name} -D ../dist -P http://localhost:3000`;
194+
p.note(`Make sure you have installed all prerequisites: https://tauri.app/v1/guides/getting-started/prerequisites
191195
192196
Start tauri development with ${color.bold(pM.name)} ${color.bold(pM.runScriptCommand("tauri dev"))}`);
193-
} catch (err) {
194-
console.error(err);
195-
}
196-
},
197-
},
198-
"tauri-v2.x": {
199-
installs: ["@tauri-apps/cli@next"],
200-
postInstall: async () => {
201-
try {
202-
let name = "";
203-
manipulateJsonFile("package.json", (packageJson) => {
204-
if (!packageJson.scripts) { packageJson.scripts = {}; }
205-
packageJson.scripts.tauri = "tauri";
206-
name = packageJson.name;
207-
return packageJson;
208-
})
209-
await flushQueue();
210-
const pM = detectPackageManager();
211-
await $`${getRunnerCommand(pM)} tauri init --ci -A ${name} -W ${name} -D ../dist -P http://localhost:3000`;
212-
p.note(`Make sure you have installed all prerequisites: https://v2.tauri.app/start/prerequisites/
197+
} catch (err) {
198+
console.error(err);
199+
}
200+
},
201+
},
202+
"tauri-v2.x": {
203+
installs: ["@tauri-apps/cli@next"],
204+
postInstall: async () => {
205+
try {
206+
let name = "";
207+
manipulateJsonFile("package.json", (packageJson) => {
208+
if (!packageJson.scripts) {
209+
packageJson.scripts = {};
210+
}
211+
packageJson.scripts.tauri = "tauri";
212+
name = packageJson.name;
213+
return packageJson;
214+
});
215+
await flushQueue();
216+
const pM = detectPackageManager();
217+
await $`${getRunnerCommand(pM)} tauri init --ci -A ${name} -W ${name} -D ../dist -P http://localhost:3000`;
218+
p.note(`Make sure you have installed all prerequisites: https://v2.tauri.app/start/prerequisites/
213219
214220
Start tauri development with ${color.bold(pM.name)} ${color.bold(pM.runScriptCommand("tauri dev"))}`);
215-
} catch (err) {
216-
console.error(err);
217-
}
218-
},
219-
},
221+
} catch (err) {
222+
console.error(err);
223+
}
224+
},
225+
},
220226
};
221-

0 commit comments

Comments
 (0)