Skip to content

Commit 82bb2d3

Browse files
committed
enable lint for js
1 parent 51c30f9 commit 82bb2d3

File tree

85 files changed

+1013
-806
lines changed

Some content is hidden

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

85 files changed

+1013
-806
lines changed

.github/workflows/get_artifact_dir_name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs = require("fs");
2-
const os = require("os");
1+
const fs = require("node:fs");
2+
const os = require("node:os");
33

44
const { dirName: artifactDirName } = require("../../cli/bin_path.js");
55

.github/workflows/prepare_package_upload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const fs = require("fs");
2-
const os = require("os");
1+
const fs = require("node:fs");
2+
const os = require("node:os");
33

44
const packageSpec = require("rescript/package.json");
55
const { version } = packageSpec;

analysis/examples/example-project/types.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
}
99
],
1010
"custom": [
11-
{"module": "Belt_HashMapInt", "path": [], "name": "t", "args": 1}
11+
{ "module": "Belt_HashMapInt", "path": [], "name": "t", "args": 1 }
1212
]
13-
}
13+
}

analysis/examples/larger-project/.watchmanconfig

Whitespace-only changes.

biome.json

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
"useIgnoreFile": true
88
},
99
"linter": {
10-
"enabled": false
10+
"enabled": true,
11+
"rules": {
12+
"recommended": true
13+
}
1114
},
1215
"organizeImports": {
13-
"enabled": false
16+
"enabled": true
1417
},
1518
"formatter": {
1619
"enabled": true,
@@ -19,23 +22,7 @@
1922
"indentWidth": 2,
2023
"lineEnding": "lf",
2124
"lineWidth": 80,
22-
"attributePosition": "auto",
23-
"ignore": [
24-
"tests/build_tests/**",
25-
"tests/tests/**",
26-
"tests/tools_tests/**",
27-
"tests/analysis_tests/**",
28-
"tests/docstring_tests/**",
29-
"analysis/examples/**",
30-
"analysis/reanalyze/examples/**",
31-
"lib/**",
32-
"ninja/**",
33-
"playground/**",
34-
"**/*.bs.js",
35-
"**/*.res.js",
36-
"**/*.gen.ts*",
37-
"package.json"
38-
]
25+
"attributePosition": "auto"
3926
},
4027
"javascript": {
4128
"formatter": {
@@ -49,5 +36,25 @@
4936
"quoteStyle": "double",
5037
"attributePosition": "auto"
5138
}
39+
},
40+
"files": {
41+
"include": ["tests/build_tests/**/node_modules/**"],
42+
"ignore": [
43+
"tests/analysis_tests/**/src/**",
44+
"tests/build_tests/**/src/**",
45+
"tests/docstring_tests/**",
46+
"tests/tests/**/src/**",
47+
"tests/tools_tests/**/src/**",
48+
"analysis/examples/**/src/**",
49+
"lib/es6/**",
50+
"lib/js/**",
51+
"ninja/**",
52+
"playground/packages/**",
53+
"*.bs.js",
54+
"*.res.js",
55+
"*.res.mjs",
56+
"*.gen.ts*",
57+
"package.json"
58+
]
5259
}
5360
}

cli/bin_path.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
//@ts-check
1+
// @ts-check
22

3-
const path = require("path");
3+
const path = require("node:path");
44

55
/**
6-
* @type{string}
7-
*
86
* For compatibility reasons, if the architecture is x64, omit it from the bin directory name.
97
* So we'll have "darwin", "linux" and "win32" for x64 arch,
108
* but "darwinarm64" and "linuxarm64" for arm64 arch.
119
* Also, we do not have Windows ARM binaries yet. But the x64 binaries do work on Windows 11 ARM.
1210
* So omit the architecture for Windows, too.
1311
*/
14-
const binDirName =
12+
const platformName =
1513
process.arch === "x64" || process.platform === "win32"
1614
? process.platform
1715
: process.platform + process.arch;
1816

1917
/**
20-
*
21-
* @type{string}
18+
* @type {string}
2219
*/
23-
const binAbsolutePath = path.join(__dirname, "..", binDirName);
20+
const platformDir = path.resolve(__dirname, "..", platformName);
2421

2522
/**
26-
* @type{string}
23+
* @type {string}
2724
*/
28-
const bsc_exe = path.join(binAbsolutePath, "bsc.exe");
25+
const bsc_exe = path.join(platformDir, "bsc.exe");
2926

3027
/**
31-
* @type{string}
28+
* @type {string}
3229
*/
33-
const ninja_exe = path.join(binAbsolutePath, "ninja.exe");
30+
const ninja_exe = path.join(platformDir, "ninja.exe");
3431

3532
/**
36-
* @type{string}
33+
* @type {string}
3734
*/
38-
const rescript_exe = path.join(binAbsolutePath, "rescript.exe");
35+
const rescript_exe = path.join(platformDir, "rescript.exe");
3936

4037
/**
41-
* @type{string}
38+
* @type {string}
4239
*/
43-
const rescript_tools_exe = path.join(binAbsolutePath, "rescript-tools.exe");
40+
const rescript_tools_exe = path.join(platformDir, "rescript-tools.exe");
4441

4542
/**
46-
* @type{string}
43+
* @type {string}
4744
*/
4845
const rescript_editor_analysis_exe = path.join(
49-
binAbsolutePath,
46+
platformDir,
5047
"rescript-editor-analysis.exe",
5148
);
5249

53-
exports.dirName = binDirName;
54-
exports.absolutePath = binAbsolutePath;
50+
/**
51+
* @type {string}
52+
*/
53+
const rewatch_exe = path.join(platformDir, "rewatch.exe");
54+
55+
exports.platformDir = platformDir;
5556
exports.bsc_exe = bsc_exe;
5657
exports.ninja_exe = ninja_exe;
5758
exports.rescript_exe = rescript_exe;
5859
exports.rescript_tools_exe = rescript_tools_exe;
5960
exports.rescript_editor_analysis_exe = rescript_editor_analysis_exe;
61+
exports.rewatch_exe = rewatch_exe;

cli/bsc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/usr/bin/env node
2+
3+
// @ts-check
4+
25
"use strict";
36

4-
var child_process = require("child_process");
5-
var { bsc_exe } = require("./bin_path");
7+
const child_process = require("child_process");
8+
const { bsc_exe } = require("./bin_path.js");
69

7-
var delegate_args = process.argv.slice(2);
10+
const delegate_args = process.argv.slice(2);
811

912
try {
1013
child_process.execFileSync(bsc_exe, delegate_args, { stdio: "inherit" });

cli/rescript

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#!/usr/bin/env node
2+
23
//@ts-check
4+
35
"use strict";
46

5-
/**
6-
* This script is supposed to be running in project root directory
7-
* It matters since we need read .sourcedirs(location)
8-
* and its content are file/directories with regard to project root
9-
*/
7+
// This script is supposed to be running in project root directory
8+
// It matters since we need read .sourcedirs(location)
9+
// and its content are file/directories with regard to project root
1010

11-
var { bsc_exe, rescript_exe } = require("./bin_path.js");
12-
var bsb = require("./rescript_bsb.js");
11+
const tty = require("node:tty");
12+
const { bsc_exe, rescript_exe } = require("./bin_path.js");
13+
const bsb = require("./rescript_bsb.js");
1314

14-
var cwd = process.cwd();
15+
const cwd = process.cwd();
1516
process.env.BSB_PROJECT_ROOT = cwd;
1617

1718
if (process.env.FORCE_COLOR === undefined) {
18-
if (require("tty").isatty(1)) {
19+
if (tty.isatty(1)) {
1920
process.env.FORCE_COLOR = "1";
2021
process.env.NINJA_ANSI_FORCED = "1";
2122
}

cli/rescript-tools

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env node
2-
//@ts-check
3-
"use strict";
42

5-
const path = require("path");
6-
const child_process = require("child_process");
3+
// @ts-check
4+
5+
"use strict";
76

8-
const { absolutePath: binAbsolutePath } = require("./bin_path");
9-
const rewatchExe = path.join(binAbsolutePath, "rescript-tools.exe");
7+
const child_process = require("node:child_process");
8+
const { rescript_tools_exe } = require("./bin_path.js");
109

1110
const args = process.argv.slice(2);
1211

13-
child_process.spawnSync(rewatchExe, args, { stdio: "inherit" });
12+
child_process.spawnSync(rescript_tools_exe, args, { stdio: "inherit" });

0 commit comments

Comments
 (0)