It seems that biome applies unsafe fixes when working in virtual workspaces, at least when working inside liveshares.
If I start a liveshare in that repo and share it with myself (in a new vscode window), and save index.ts
, biome will apply the unsafe fixes.
[Trace - 10:55:20 AM] Sending request 'textDocument/codeAction - (24)'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 3,
"character": 0
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 2,
"character": 15
},
"end": {
"line": 2,
"character": 35
}
},
"message": "Do not use template literals if interpolation and special-character handling are not needed.",
"code": "lint/style/noUnusedTemplateLiteral",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-template-literal"
},
"severity": 1,
"source": "biome"
},
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "This variable is unused.",
"code": "lint/correctness/noUnusedVariables",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-variables"
},
"severity": 1,
"source": "biome"
},
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "'unused' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
}
],
"only": [
"quickfix.biome"
],
"triggerKind": 2
}
}
[Trace - 10:55:20 AM] Received response 'textDocument/codeAction - (24)' in 2ms.
Result: []
[Trace - 10:55:20 AM] Sending request 'textDocument/codeAction - (25)'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 3,
"character": 0
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 2,
"character": 15
},
"end": {
"line": 2,
"character": 35
}
},
"message": "Do not use template literals if interpolation and special-character handling are not needed.",
"code": "lint/style/noUnusedTemplateLiteral",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-template-literal"
},
"severity": 1,
"source": "biome"
},
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "This variable is unused.",
"code": "lint/correctness/noUnusedVariables",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-variables"
},
"severity": 1,
"source": "biome"
},
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "'unused' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
}
],
"only": [
"source.organizeImports.biome"
],
"triggerKind": 2
}
}
[Trace - 10:55:20 AM] Received response 'textDocument/codeAction - (25)' in 2ms.
Result: []
[Trace - 10:55:20 AM] Sending request 'textDocument/formatting - (26)'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts"
},
"options": {
"tabSize": 2,
"insertSpaces": true
}
}
[Trace - 10:55:20 AM] Received response 'textDocument/formatting - (26)' in 1ms.
Result: [
{
"newText": "// const unused = `hello`\n\nconst unused = `hellothereklajsdjk`\n",
"range": {
"end": {
"character": 0,
"line": 4
},
"start": {
"character": 0,
"line": 0
}
}
}
]
[Trace - 10:55:20 AM] Sending notification 'textDocument/didSave'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts"
}
}
[Trace - 10:55:20 AM] Sending request 'textDocument/codeAction - (27)'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 3,
"character": 0
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 2,
"character": 15
},
"end": {
"line": 2,
"character": 35
}
},
"message": "Do not use template literals if interpolation and special-character handling are not needed.",
"code": "lint/style/noUnusedTemplateLiteral",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-template-literal"
},
"severity": 1,
"source": "biome"
},
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "This variable is unused.",
"code": "lint/correctness/noUnusedVariables",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-variables"
},
"severity": 1,
"source": "biome"
},
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "'unused' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
}
],
"triggerKind": 1
}
}
[Trace - 10:55:20 AM] Received response 'textDocument/codeAction - (27)' in 3ms.
Result: [
{
"diagnostics": [
{
"code": "lint/style/noUnusedTemplateLiteral",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-template-literal"
},
"message": "Do not use template literals if interpolation and special-character handling are not needed.",
"range": {
"end": {
"character": 35,
"line": 2
},
"start": {
"character": 15,
"line": 2
}
},
"severity": 1,
"source": "biome"
}
],
"edit": {
"changes": {
"file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts": [
{
"newText": "\"",
"range": {
"end": {
"character": 16,
"line": 2
},
"start": {
"character": 15,
"line": 2
}
}
},
{
"newText": "\"",
"range": {
"end": {
"character": 35,
"line": 2
},
"start": {
"character": 34,
"line": 2
}
}
}
]
}
},
"kind": "quickfix.biome.style.noUnusedTemplateLiteral",
"title": "Replace with string literal"
},
{
"diagnostics": [
{
"code": "lint/style/noUnusedTemplateLiteral",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-template-literal"
},
"message": "Do not use template literals if interpolation and special-character handling are not needed.",
"range": {
"end": {
"character": 35,
"line": 2
},
"start": {
"character": 15,
"line": 2
}
},
"severity": 1,
"source": "biome"
}
],
"edit": {
"changes": {
"file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts": [
{
"newText": "// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>\n",
"range": {
"end": {
"character": 0,
"line": 2
},
"start": {
"character": 0,
"line": 2
}
}
},
{
"newText": " ",
"range": {
"end": {
"character": 6,
"line": 2
},
"start": {
"character": 5,
"line": 2
}
}
}
]
}
},
"kind": "quickfix.suppressRule.biome.style.noUnusedTemplateLiteral",
"title": "Suppress rule lint/style/noUnusedTemplateLiteral"
},
{
"diagnostics": [
{
"code": "lint/correctness/noUnusedVariables",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-variables"
},
"message": "This variable is unused.",
"range": {
"end": {
"character": 12,
"line": 2
},
"start": {
"character": 6,
"line": 2
}
},
"severity": 1,
"source": "biome"
}
],
"edit": {
"changes": {
"file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts": [
{
"newText": "_unused",
"range": {
"end": {
"character": 12,
"line": 2
},
"start": {
"character": 6,
"line": 2
}
}
}
]
}
},
"kind": "quickfix.biome.correctness.noUnusedVariables",
"title": "If this is intentional, prepend unused with an underscore."
},
{
"diagnostics": [
{
"code": "lint/correctness/noUnusedVariables",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-variables"
},
"message": "This variable is unused.",
"range": {
"end": {
"character": 12,
"line": 2
},
"start": {
"character": 6,
"line": 2
}
},
"severity": 1,
"source": "biome"
}
],
"edit": {
"changes": {
"file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts": [
{
"newText": "// biome-ignore lint/correctness/noUnusedVariables: <explanation>\n",
"range": {
"end": {
"character": 0,
"line": 2
},
"start": {
"character": 0,
"line": 2
}
}
},
{
"newText": " ",
"range": {
"end": {
"character": 6,
"line": 2
},
"start": {
"character": 5,
"line": 2
}
}
}
]
}
},
"kind": "quickfix.suppressRule.biome.correctness.noUnusedVariables",
"title": "Suppress rule lint/correctness/noUnusedVariables"
}
]
[Trace - 10:55:20 AM] Sending notification 'textDocument/didChange'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts",
"version": 14
},
"contentChanges": [
{
"range": {
"start": {
"line": 2,
"character": 34
},
"end": {
"line": 2,
"character": 35
}
},
"rangeLength": 1,
"text": "\""
},
{
"range": {
"start": {
"line": 2,
"character": 15
},
"end": {
"line": 2,
"character": 16
}
},
"rangeLength": 1,
"text": "\""
}
]
}
[Trace - 10:55:20 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"diagnostics": [
{
"code": "lint/correctness/noUnusedVariables",
"codeDescription": {
"href": "https://biomejs.dev/linter/rules/no-unused-variables"
},
"message": "This variable is unused.",
"range": {
"end": {
"character": 12,
"line": 2
},
"start": {
"character": 6,
"line": 2
}
},
"severity": 1,
"source": "biome"
}
],
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts",
"version": 14
}
[Trace - 10:55:20 AM] Sending notification 'textDocument/didChange'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts",
"version": 15
},
"contentChanges": [
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 6
}
},
"rangeLength": 0,
"text": "_"
}
]
}
[Trace - 10:55:20 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"diagnostics": [],
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts",
"version": 15
}
[Trace - 10:55:20 AM] Sending request 'textDocument/codeAction - (28)'.
Params: {
"textDocument": {
"uri": "file:///Users/gustaf/Repos/Gustaf/biome-unsafe/index.ts"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 3,
"character": 0
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 2,
"character": 6
},
"end": {
"line": 2,
"character": 12
}
},
"message": "'unused' is declared but its value is never read.",
"code": 6133,
"severity": 4,
"tags": [
1
],
"source": "ts"
}
],
"triggerKind": 1
}
}
[Trace - 10:55:20 AM] Received response 'textDocument/codeAction - (28)' in 1ms.
Result: []