Skip to content

Commit dd4a4bf

Browse files
authored
Switch to Biome (#6838)
* switch to Biome * do check format first * check only changes * ignore generated codes * dedupe ignore list that already ignored by vcs integration * update Biome ignore list * did `npm run format:all` once * use Biome for gentype tests too * add VSCode extension recommendation * fix more json errors * jsx runtime should be match
1 parent 4ef6668 commit dd4a4bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+692
-1873
lines changed

.github/workflows/get_artifact_dir_name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ const { dirName: artifactDirName } = require("../../cli/bin_path.js");
66
// Pass artifactDirName to subsequent GitHub actions
77
fs.appendFileSync(
88
process.env.GITHUB_ENV,
9-
`artifact_dir_name=${artifactDirName}${os.EOL}`
9+
`artifact_dir_name=${artifactDirName}${os.EOL}`,
1010
);

.github/workflows/prepare_package_upload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ const commitHashShort = commitHash.substring(0, 7);
99

1010
fs.renameSync(
1111
`rescript-${version}.tgz`,
12-
`rescript-${version}-${commitHashShort}.tgz`
12+
`rescript-${version}-${commitHashShort}.tgz`,
1313
);
1414
fs.renameSync(
1515
`packages/std/rescript-std-${version}.tgz`,
16-
`rescript-std-${version}-${commitHashShort}.tgz`
16+
`rescript-std-${version}-${commitHashShort}.tgz`,
1717
);
1818

1919
// Pass information to subsequent GitHub actions
2020
fs.appendFileSync(
2121
process.env.GITHUB_ENV,
22-
`rescript_version=${version}-${commitHashShort}${os.EOL}`
22+
`rescript_version=${version}-${commitHashShort}${os.EOL}`,
2323
);

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,6 @@ playground/*.cmj
9393
playground/*.cmi
9494
playground/.netrc
9595
playground/compiler.js
96+
97+
rewatch/target/
98+
rewatch/rewatch

.prettierignore

Lines changed: 0 additions & 14 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": ["biomejs.biome", "chenglou92.rescript-vscode"],
3+
"unwantedRecommendations": [
4+
"dbaeumer.vscode-eslint",
5+
"esbenp.prettier-vscode"
6+
]
7+
}

biome.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"defaultBranch": "master",
7+
"useIgnoreFile": true
8+
},
9+
"linter": {
10+
"enabled": false
11+
},
12+
"organizeImports": {
13+
"enabled": false
14+
},
15+
"formatter": {
16+
"enabled": true,
17+
"formatWithErrors": false,
18+
"indentStyle": "space",
19+
"indentWidth": 2,
20+
"lineEnding": "lf",
21+
"lineWidth": 80,
22+
"attributePosition": "auto",
23+
"ignore": [
24+
"jscomp/build_tests/**/lib/**",
25+
"jscomp/build_tests/**/src/**",
26+
"jscomp/test/**",
27+
"lib/**",
28+
"ninja/**",
29+
"playground/**",
30+
"**/*.bs.js",
31+
"**/*.res.js",
32+
"**/*.gen.ts*",
33+
"package.json"
34+
]
35+
},
36+
"javascript": {
37+
"formatter": {
38+
"jsxQuoteStyle": "double",
39+
"quoteProperties": "asNeeded",
40+
"trailingCommas": "all",
41+
"semicolons": "always",
42+
"arrowParentheses": "asNeeded",
43+
"bracketSpacing": true,
44+
"bracketSameLine": false,
45+
"quoteStyle": "double",
46+
"attributePosition": "auto"
47+
}
48+
}
49+
}

cli/rescript_arg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function parse_exn(
112112
annofun,
113113
start = 0,
114114
// first 3 are [node, rescript, subcommand]
115-
finish = argv.length
115+
finish = argv.length,
116116
) {
117117
var current = start;
118118
var list = [];

cli/rescript_bsb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ Please pick a different one using the \`-ws [host:]port\` flag from bsb.`);
363363
function outputError(error, highlight) {
364364
if (isTtyError && highlight) {
365365
process.stderr.write(
366-
error.replace(highlight, "\x1b[1;31m" + highlight + "\x1b[0m")
366+
error.replace(highlight, "\x1b[1;31m" + highlight + "\x1b[0m"),
367367
);
368368
} else {
369369
process.stderr.write(error);
@@ -408,7 +408,7 @@ Please pick a different one using the \`-ws [host:]port\` flag from bsb.`);
408408
// it could fail due to other issues like .bsb.lock
409409
else {
410410
dlog(
411-
`Acquire lock failed, do the build later ${depth} : ${reasonsToRebuild}`
411+
`Acquire lock failed, do the build later ${depth} : ${reasonsToRebuild}`,
412412
);
413413
const waitTime = Math.pow(2, depth) * 40;
414414
setTimeout(() => {

cli/rescript_convert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function handleOneFile(file, bsc_exe) {
5959
console.error(`Error when converting ${file}`);
6060
console.log(stderr);
6161
}
62-
}
62+
},
6363
);
6464
}
6565
/**
@@ -91,7 +91,7 @@ function main(argv, rescript_exe, bsc_exe) {
9191
["info", "-list-files"],
9292
{
9393
encoding: "utf-8",
94-
}
94+
},
9595
);
9696
if (output.status !== 0) {
9797
console.error(output.stdout);

0 commit comments

Comments
 (0)