Skip to content

Commit be02f6e

Browse files
authored
Replace eslint and prettier with biome.js
Biome is a Rust based replacement for eslint and prettier and runs much faster.
1 parent 449e0f3 commit be02f6e

10 files changed

+70
-35
lines changed

.reuse/dep5

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Files: */slint-icon-*.svg */slint-icon-*.png */slint-icon-*.pdf */slint-logo-*.s
77
Copyright: Copyright © SixtyFPS GmbH <[email protected]>
88
License: CC-BY-ND-4.0
99

10-
Files: .gitattributes .gitignore */.gitignore .dockerignore .prettierignore .pre-commit-config.yaml .vscode/* cspell.json rustfmt.toml .mailmap */.eslintrc.yml Cargo.lock */.npmignore
10+
Files: .gitattributes .gitignore */.gitignore .dockerignore .prettierignore .pre-commit-config.yaml .vscode/* cspell.json rustfmt.toml .mailmap */.eslintrc.yml Cargo.lock */.npmignore biome.json
1111
Copyright: Copyright © SixtyFPS GmbH <[email protected]>
1212
License: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
1313

editors/vscode/.eslintrc.json

-16
This file was deleted.

editors/vscode/biome.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"formatter": {
4+
"enabled": true,
5+
"formatWithErrors": false,
6+
"indentStyle": "space",
7+
"indentWidth": 4,
8+
"lineEnding": "lf",
9+
"attributePosition": "auto",
10+
"ignore": [
11+
"./node_modules",
12+
"./.pnp",
13+
"**/.pnp.js",
14+
"./coverage",
15+
"**/build/**",
16+
"**/out/**",
17+
"./dist",
18+
"**/.DS_Store",
19+
"**/.env.local",
20+
"**/.env.development.local",
21+
"**/.env.test.local",
22+
"**/.env.production.local",
23+
"**/npm-debug.log*",
24+
"**/yarn-debug.log*",
25+
"**/yarn-error.log*",
26+
"**/.vscode/**"
27+
]
28+
},
29+
"organizeImports": { "enabled": false },
30+
"linter": {
31+
"enabled": true,
32+
"rules": {
33+
"recommended": false,
34+
"style": { "useBlockStatements": "warn" },
35+
"suspicious": { "noDoubleEquals": "warn" }
36+
},
37+
"ignore": ["webviews/**", "**/.vscode/**", "**/build/**", "**/out/**"]
38+
},
39+
"javascript": {
40+
"formatter": {
41+
"jsxQuoteStyle": "double",
42+
"quoteProperties": "asNeeded",
43+
"semicolons": "always",
44+
"arrowParentheses": "always",
45+
"bracketSpacing": true,
46+
"bracketSameLine": false,
47+
"quoteStyle": "double",
48+
"attributePosition": "auto"
49+
}
50+
}
51+
}

editors/vscode/language-configuration.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
"lineComment": "//",
44
"blockComment": ["/*", "*/"]
55
},
6-
"brackets": [
7-
["{", "}"],
8-
["[", "]"],
9-
["(", ")"]
10-
],
6+
"brackets": [["{", "}"], ["[", "]"], ["(", ")"]],
117
"autoClosingPairs": [
128
{
139
"open": "{",

editors/vscode/src/browser.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ function startClient(
6161

6262
// this method is called when vs code is activated
6363
export function activate(context: vscode.ExtensionContext) {
64-
statusBar = common.activate(context, (cl, ctx) =>
65-
startClient(cl, ctx),
66-
);
64+
statusBar = common.activate(context, (cl, ctx) => startClient(cl, ctx));
6765
}
6866

6967
export function deactivate(): Thenable<void> | undefined {

editors/vscode/src/common.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,28 @@ export function languageClientOptions(): LanguageClientOptions {
126126
// But we want to open the document next to it instead.
127127
let panel = wasm_preview.panel();
128128
if (panel && panel.active) {
129-
const uri = cl.protocol2CodeConverter.asUri(params.uri);
129+
const uri = cl.protocol2CodeConverter.asUri(
130+
params.uri,
131+
);
130132
let col = panel.viewColumn || 1;
131133
let options: vscode.TextDocumentShowOptions = {
132134
viewColumn: col > 1 ? col - 1 : col + 1,
133135
preserveFocus: !params.takeFocus,
134136
};
135137
if (params.selection !== undefined) {
136-
options.selection = cl.protocol2CodeConverter.asRange(params.selection);
138+
options.selection =
139+
cl.protocol2CodeConverter.asRange(
140+
params.selection,
141+
);
137142
}
138143
await vscode.window.showTextDocument(uri, options);
139144

140145
return { success: true };
141146
}
142147
}
143148
return await next(params);
144-
}
145-
}
149+
},
150+
},
146151
},
147152
};
148153
}

editors/vscode/src/extension.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ function startClient(
152152
event.oldState === State.Running
153153
) {
154154
cl.outputChannel.appendLine(
155-
"The Slint Language Server crashed. This is a bug. Please open an issue on https://github.com/slint-ui/slint/issues"
155+
"The Slint Language Server crashed. This is a bug. Please open an issue on https://github.com/slint-ui/slint/issues",
156156
);
157157
cl.outputChannel.show();
158158
vscode.commands.executeCommand("workbench.action.output.focus");
@@ -191,9 +191,7 @@ export function activate(context: vscode.ExtensionContext) {
191191
);
192192
}
193193

194-
statusBar = common.activate(context, (cl, ctx) =>
195-
startClient(cl, ctx),
196-
);
194+
statusBar = common.activate(context, (cl, ctx) => startClient(cl, ctx));
197195
}
198196

199197
export function deactivate(): Thenable<void> | undefined {

editors/vscode/src/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"lib": ["es2021", "webworker"],
55
"types": ["vscode"]
66
},
7-
"include": ["./*.ts"],
7+
"include": ["./*.ts"]
88
}

editors/vscode/src/wasm_preview.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ function getPreviewHtml(
9393
slint_wasm_preview_url: Uri,
9494
default_style: string,
9595
): string {
96-
const experimental = typeof process !== 'undefined' && process.env.hasOwnProperty("SLINT_ENABLE_EXPERIMENTAL_FEATURES");
96+
const experimental =
97+
typeof process !== "undefined" &&
98+
process.env.hasOwnProperty("SLINT_ENABLE_EXPERIMENTAL_FEATURES");
9799
const result = `<!DOCTYPE html>
98100
<html lang="en" style="height: 100%; width: 100%;">
99101
<head>

xtask/src/license_headers_check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ lazy_static! {
430430
("(^|/)Pipfile$", LicenseLocation::Tag(LicenseTagStyle::shell_comment_style())),
431431
("(^|/)\\.npmrc$", LicenseLocation::Tag(LicenseTagStyle::shell_comment_style())),
432432
("(^|/)pnpm-lock\\.yaml$", LicenseLocation::NoLicense),
433+
("(^|/)biome\\.json$", LicenseLocation::NoLicense),
433434

434435
// Path prefix matches:
435436
("^editors/tree-sitter-slint/corpus/", LicenseLocation::NoLicense), // liberal license

0 commit comments

Comments
 (0)