-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Biome](https://biomejs.dev/) is the successor to rome, as noted in #599. Notes: - Biome also supports formatting JSON files. - It is available as a download, but it works better with our update querying logic as a package install. - We will still support rome, but biome will be suggested in its place if a `rome.json` exists.
- Loading branch information
1 parent
d9eae68
commit 182dd26
Showing
10 changed files
with
170 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { linterCheckTest, linterFmtTest } from "tests"; | ||
|
||
linterCheckTest({ linterName: "biome", namedTestPrefixes: ["basic_check"] }); | ||
|
||
linterFmtTest({ linterName: "biome", namedTestPrefixes: ["basic_fmt", "basic_json"] }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
version: 0.1 | ||
tools: | ||
definitions: | ||
- name: biome | ||
# Available as a download, but release name doesn't configure well to our schema | ||
runtime: node | ||
package: "@biomejs/biome" | ||
shims: [biome] | ||
known_good_version: 1.4.1 | ||
lint: | ||
definitions: | ||
# Successor to the rome linter+formatter | ||
- name: biome | ||
files: | ||
- typescript | ||
- javascript | ||
- json | ||
commands: | ||
- name: lint | ||
output: regex | ||
parse_regex: | ||
' *(?P<path>.*?):(?P<line>\d+):(?P<col>\d+) (?P<code>[^ ]+)(?:[^×]*\n).*× | ||
(?P<message>.*)\n' | ||
run: biome check ${target} | ||
success_codes: [0, 1] | ||
batch: true | ||
cache_results: true | ||
read_output_from: stderr | ||
- name: fmt | ||
output: rewrite | ||
run: biome format --write "${target}" | ||
success_codes: [0, 1] | ||
batch: true | ||
cache_results: true | ||
formatter: true | ||
in_place: true | ||
tools: [biome] | ||
suggest_if: config_present | ||
direct_configs: | ||
- biome.json | ||
- rome.json # For backwards compatibility with rome | ||
affects_cache: | ||
- package.json | ||
- .editorconfig # Undocumented config file | ||
known_good_version: 1.4.1 | ||
version_command: | ||
parse_regex: biome CLI version ${semver} | ||
run: biome --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const foobar = () => { } | ||
const barfoo = () => { } | ||
|
||
enum Bar { Baz }; | ||
|
||
const foo = (bar: Bar) => { | ||
switch (bar) { | ||
case Bar.Baz: | ||
foobar(); | ||
barfoo(); | ||
break; | ||
} | ||
{ !foo ? null : 1 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const foobar = () => { } | ||
const barfoo = () => { } | ||
|
||
enum Bar { Baz }; | ||
|
||
const foo = (bar: Bar) => { | ||
switch (bar) { | ||
case Bar.Baz: | ||
foobar(); | ||
barfoo(); | ||
break; | ||
} | ||
{ !foo ? null : 1 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{"a": | ||
"foo", | ||
"b": 1, | ||
"a": true} |
50 changes: 50 additions & 0 deletions
50
linters/biome/test_data/biome_v1.4.1_basic_check.check.shot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing linter biome test basic_check 1`] = ` | ||
{ | ||
"issues": [ | ||
{ | ||
"code": "lint/style/useEnumInitializers", | ||
"column": "6", | ||
"file": "test_data/basic_check.in.ts", | ||
"level": "LEVEL_HIGH", | ||
"line": "4", | ||
"linter": "biome", | ||
"message": "This enum declaration contains members that are implicitly initialized.", | ||
"targetType": "typescript", | ||
}, | ||
], | ||
"lintActions": [ | ||
{ | ||
"command": "fmt", | ||
"fileGroupName": "typescript", | ||
"linter": "biome", | ||
"paths": [ | ||
"test_data/basic_check.in.ts", | ||
], | ||
"verb": "TRUNK_VERB_FMT", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "typescript", | ||
"linter": "biome", | ||
"paths": [ | ||
"test_data/basic_check.in.ts", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
], | ||
"taskFailures": [], | ||
"unformattedFiles": [ | ||
{ | ||
"column": "1", | ||
"file": "test_data/basic_check.in.ts", | ||
"issueClass": "ISSUE_CLASS_UNFORMATTED", | ||
"level": "LEVEL_HIGH", | ||
"line": "1", | ||
"linter": "biome", | ||
"message": "Incorrect formatting, autoformat by running 'trunk fmt'", | ||
}, | ||
], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing formatter biome test basic_fmt 1`] = ` | ||
"const foobar = () => {}; | ||
const barfoo = () => {}; | ||
|
||
enum Bar { | ||
Baz, | ||
} | ||
|
||
const foo = (bar: Bar) => { | ||
switch (bar) { | ||
case Bar.Baz: | ||
foobar(); | ||
barfoo(); | ||
break; | ||
} | ||
{ | ||
!foo ? null : 1; | ||
} | ||
}; | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing formatter biome test basic_json 1`] = ` | ||
"{ "a": "foo", "b": 1, "a": true } | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters