Skip to content

Commit 1bcb334

Browse files
committed
switch to biome for formatting
1 parent 1b63995 commit 1bcb334

14 files changed

Lines changed: 131 additions & 133 deletions

File tree

biome.jsonc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
3+
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false },
4+
"files": { "ignoreUnknown": false },
5+
"formatter": {
6+
"enabled": true,
7+
"formatWithErrors": false,
8+
"indentStyle": "space",
9+
"indentWidth": 2,
10+
"lineEnding": "lf",
11+
"lineWidth": 95,
12+
"attributePosition": "auto",
13+
"bracketSameLine": false,
14+
"bracketSpacing": true,
15+
"expand": "auto",
16+
"useEditorconfig": true,
17+
// Keep this in sync with .prettierignore.
18+
"includes": [
19+
"**",
20+
"!**/test/data/*",
21+
"!**/*.css",
22+
"!**/*.html",
23+
"!**/*.ohm-bundle.*",
24+
"!**/dist",
25+
"!**/pnpm-lock.yaml",
26+
"!**/testdata",
27+
"!**/third_party",
28+
"!**/visualizer",
29+
"!packages/wasm/runtime/**"
30+
]
31+
},
32+
"linter": { "enabled": false },
33+
"javascript": {
34+
// These options should be kept in sync with .pretterrc.
35+
// We do that because various editors read the prettier config.
36+
"formatter": {
37+
"bracketSpacing": false,
38+
"quoteStyle": "single",
39+
"trailingCommas": "es5",
40+
"arrowParentheses": "asNeeded", // "avoid" not supported in biome
41+
// printWidth: see `lineWidth` above
42+
43+
"jsxQuoteStyle": "double",
44+
"quoteProperties": "asNeeded",
45+
"semicolons": "always",
46+
"bracketSameLine": false,
47+
"attributePosition": "auto"
48+
}
49+
},
50+
"html": { "formatter": { "selfCloseVoidElements": "always" } },
51+
"assist": {
52+
"enabled": true,
53+
"actions": { "source": { "organizeImports": "on" } }
54+
}
55+
}

examples/ecmascript/package.json

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@
1010
"type": "git",
1111
"url": "git+https://github.com/ohmjs/ohm.git"
1212
},
13-
"keywords": [
14-
"ohm",
15-
"ohm-grammar",
16-
"es5",
17-
"ecmascript",
18-
"javascript",
19-
"peg"
20-
],
13+
"keywords": ["ohm", "ohm-grammar", "es5", "ecmascript", "javascript", "peg"],
2114
"license": "MIT",
2215
"bugs": {
2316
"url": "https://github.com/ohmjs/ohm/issues"
@@ -31,16 +24,9 @@
3124
"ohm-js": "^17.0.0"
3225
},
3326
"ava": {
34-
"files": [
35-
"!**/test/data/**/*"
36-
]
27+
"files": ["!**/test/data/**/*"]
3728
},
38-
"files": [
39-
"src",
40-
"index.js",
41-
"!**/*.test.*",
42-
"!**/testdata/**"
43-
],
29+
"files": ["src", "index.js", "!**/*.test.*", "!**/testdata/**"],
4430
"dependencies": {
4531
"@pkgjs/parseargs": "^0.11.0",
4632
"jsdom": "^21.1.1"

examples/operators/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66
"scripts": {
77
"test": "ava"
88
},
9-
"keywords": [
10-
"ohm",
11-
"precedence",
12-
"associativity",
13-
"javascript",
14-
"parsing"
15-
],
9+
"keywords": ["ohm", "precedence", "associativity", "javascript", "parsing"],
1610
"author": "",
1711
"license": "MIT",
1812
"devDependencies": {

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"scripts": {
55
"build": "pnpm -r build",
66
"ci-test": "bin/ci-test.sh",
7-
"format": "prettier --write . && eslint --fix .",
7+
"format": "biome format --write . && eslint --fix .",
88
"lint": "eslint .",
99
"test": "pnpm -r test"
1010
},
@@ -14,9 +14,7 @@
1414
"@eslint/js": "^9.35.0",
1515
"@types/node": "^20.19.13",
1616
"eslint": "^9.35.0",
17-
"eslint-config-google": "^0.14.0",
1817
"eslint-plugin-ava": "^15.1.0",
19-
"prettier": "^3.0.0",
2018
"typescript": "^5.8.3"
2119
},
2220
"version": "0.0.0"

packages/cli/package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"repository": "https://github.com/ohmjs/ohm",
88
"author": "Patrick Dubroy <pdubroy@gmail.com>",
99
"license": "MIT",
10-
"files": [
11-
"**/*.js"
12-
],
10+
"files": ["**/*.js"],
1311
"dependencies": {
1412
"commander": "^8.1.0",
1513
"fast-glob": "^3.2.7"
@@ -33,9 +31,6 @@
3331
"ts-morph": "^26.0.0"
3432
},
3533
"ava": {
36-
"extensions": [
37-
"mjs",
38-
"js"
39-
]
34+
"extensions": ["mjs", "js"]
4035
}
4136
}

packages/es-grammars/package.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,16 @@
33
"version": "1.0.1",
44
"description": "Ohm grammars for modern versions of ECMAScript/JavaScript (ES2015+).",
55
"exports": "./index.mjs",
6-
"files": [
7-
"index.mjs",
8-
"gen/*.ohm"
9-
],
6+
"files": ["index.mjs", "gen/*.ohm"],
107
"scripts": {
118
"build": "for year in $(seq 2015 2022); do YEAR=$year npm run gen-grammar; done",
129
"test": "node test/es2015.test.mjs",
1310
"gen-grammar": "node scripts/generate-ecmascript-grammar.mjs --verbose --name ES$YEAR --overrides spec/es$YEAR/overrides.json spec/es$YEAR/spec.grammar > gen/es$YEAR.grammar.ohm",
1411
"gen-grammar:es2015": "YEAR=2015 pnpm run gen-grammar"
1512
},
16-
"keywords": [
17-
"ohm",
18-
"grammar",
19-
"ecmascript",
20-
"javascript"
21-
],
13+
"keywords": ["ohm", "grammar", "ecmascript", "javascript"],
2214
"author": "Patrick Dubroy <pdubroy@gmail.com>",
23-
"contributors": [
24-
"Andrew Elgert <andrew.elgert@gmail.com>"
25-
],
15+
"contributors": ["Andrew Elgert <andrew.elgert@gmail.com>"],
2616
"license": "MIT",
2717
"peerDependencies": {
2818
"ohm-js": "^17.1.0"

packages/miniohm-js/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
"publishConfig": {
1919
"main": "dist/index.js"
2020
},
21-
"files": [
22-
"dist"
23-
],
21+
"files": ["dist"],
2422
"scripts": {
2523
"build": "tsc",
2624
"check": "tsc --noEmit"

packages/ohm-js/package.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,7 @@
3838
"./dist/ohm-extras.cjs"
3939
]
4040
},
41-
"files": [
42-
"src",
43-
"dist",
44-
"extras",
45-
"index.mjs",
46-
"index.d.ts",
47-
"!**/*.old"
48-
],
41+
"files": ["src", "dist", "extras", "index.mjs", "index.d.ts", "!**/*.old"],
4942
"types": "index.d.ts",
5043
"scripts": {
5144
"prebootstrap": "bash scripts/prebootstrap",
@@ -146,9 +139,7 @@
146139
},
147140
"ava": {
148141
"watchMode": {
149-
"ignoreChanges": [
150-
"version.js"
151-
]
142+
"ignoreChanges": ["version.js"]
152143
}
153144
}
154145
}

packages/ohm-js/test/test-ohm-syntax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ test('ranges w/ code points > 0xFFFF, special cases', t => {
253253
`);
254254
// Try matching against a string where the first unit is a high surrogate,
255255
// but the second unit is *not* a low surrogate.
256-
assertSucceeds(t, g2.match('\u{D83D}x'));
256+
assertSucceeds(t, g2.match('\uD83Dx'));
257257
});
258258

259259
test('any consumes an entire code point', t => {

packages/ohm-js/test/test-recipes.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,7 @@ test('recipes with U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR', t => {
136136
t.falsy(ohm.grammar('G { x = "blah\u2029" }').toRecipe().includes('\u2029'));
137137

138138
// ...and with an escaped separator.
139-
t.falsy(
140-
ohm
141-
.grammar(String.raw`G { x = "blah\u2028" }`)
142-
.toRecipe()
143-
.includes('\u2028')
144-
);
139+
t.falsy(ohm.grammar(String.raw`G { x = "blah\u2028" }`).toRecipe().includes('\u2028'));
145140
});
146141

147142
test('semantics recipes', t => {

0 commit comments

Comments
 (0)