Skip to content

Commit 90f96b1

Browse files
committed
feat(linter): convert oxlint to NAPI app
1 parent fb2d087 commit 90f96b1

File tree

95 files changed

+148
-338
lines changed

Some content is hidden

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

95 files changed

+148
-338
lines changed

.github/generated/ast_changes_watch_list.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
src:
55
- '.github/generated/ast_changes_watch_list.yml'
6+
- 'apps/oxlint/src-js/generated/constants.mjs'
7+
- 'apps/oxlint/src/generated/raw_transfer_constants.rs'
68
- 'crates/oxc_allocator/src/generated/assert_layouts.rs'
79
- 'crates/oxc_allocator/src/generated/fixed_size_constants.rs'
810
- 'crates/oxc_allocator/src/pool/fixed_size.rs'
@@ -64,8 +66,6 @@ src:
6466
- 'crates/oxc_syntax/src/serialize.rs'
6567
- 'crates/oxc_syntax/src/symbol.rs'
6668
- 'crates/oxc_traverse/src/generated/scopes_collector.rs'
67-
- 'napi/oxlint/src-js/generated/constants.mjs'
68-
- 'napi/oxlint/src/generated/raw_transfer_constants.rs'
6969
- 'napi/parser/generated/constants.mjs'
7070
- 'napi/parser/generated/deserialize/js.mjs'
7171
- 'napi/parser/generated/deserialize/ts.mjs'

Cargo.lock

Lines changed: 3 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/oxlint/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
*.node
3+
dist/

apps/oxlint/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ authors.workspace = true
55
categories.workspace = true
66
edition.workspace = true
77
homepage.workspace = true
8+
include = ["/src", "build.rs"]
89
keywords.workspace = true
910
license.workspace = true
1011
publish = false
@@ -16,16 +17,10 @@ description.workspace = true
1617
workspace = true
1718

1819
[lib]
19-
crate-type = ["lib"]
20+
crate-type = ["cdylib", "lib"]
2021
path = "src/lib.rs"
2122
doctest = false
2223

23-
[[bin]]
24-
name = "oxlint"
25-
path = "src/main.rs"
26-
test = false
27-
doctest = false
28-
2924
[dependencies]
3025
oxc_allocator = { workspace = true, features = ["fixed_size"] }
3126
oxc_diagnostics = { workspace = true }
@@ -36,13 +31,15 @@ bpaf = { workspace = true, features = ["autocomplete", "bright-color", "derive"]
3631
cow-utils = { workspace = true }
3732
ignore = { workspace = true, features = ["simd-accel"] }
3833
miette = { workspace = true }
39-
napi = { workspace = true }
34+
napi = { workspace = true, features = ["async"] }
35+
napi-derive = { workspace = true }
4036
rayon = { workspace = true }
4137
rustc-hash = { workspace = true }
4238
serde = { workspace = true }
4339
serde_json = { workspace = true }
4440
simdutf8 = { workspace = true }
4541
tempfile = { workspace = true }
42+
tokio = { workspace = true, features = ["rt-multi-thread"] }
4643
tracing-subscriber = { workspace = true, features = [] } # Omit the `regex` feature
4744

4845
[target.'cfg(not(any(target_os = "linux", target_os = "freebsd", target_arch = "arm", target_family = "wasm")))'.dependencies]
@@ -54,6 +51,9 @@ mimalloc-safe = { workspace = true, optional = true, features = ["skip_collect_o
5451
[target.'cfg(all(target_os = "linux", target_arch = "aarch64"))'.dependencies]
5552
mimalloc-safe = { workspace = true, optional = true, features = ["skip_collect_on_exit", "local_dynamic_tls", "no_opt_arch"] }
5653

54+
[build-dependencies]
55+
napi-build = { workspace = true }
56+
5757
[dev-dependencies]
5858
insta = { workspace = true }
5959
lazy-regex = { workspace = true }
File renamed without changes.

napi/oxlint/package.json renamed to apps/oxlint/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,28 @@
1414
"test": "tsc && vitest --dir ./test run"
1515
},
1616
"engines": {
17-
"node": ">=20.0.0"
17+
"node": ">=8.*"
1818
},
19-
"description": "Staging package for oxlint while we integrate custom JS plugins into oxlint",
19+
"description": "Linter for the JavaScript Oxidation Compiler",
2020
"author": "Boshen and oxc contributors",
2121
"license": "MIT",
2222
"homepage": "https://oxc.rs",
2323
"bugs": "https://github.com/oxc-project/oxc/issues",
2424
"repository": {
2525
"type": "git",
2626
"url": "https://github.com/oxc-project/oxc.git",
27-
"directory": "napi/oxlint"
27+
"directory": "apps/oxlint"
2828
},
2929
"publishConfig": {
3030
"registry": "https://registry.npmjs.org/",
3131
"access": "public"
3232
},
3333
"files": [
34-
"dist"
34+
"dist",
35+
"bin/oxlint",
36+
"bin/oxc_language_server",
37+
"configuration_schema.json",
38+
"README.md"
3539
],
3640
"devDependencies": {
3741
"execa": "^9.6.0",

napi/oxlint/scripts/build.js renamed to apps/oxlint/scripts/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { join } from 'node:path';
44

55
const oxlintDirPath = join(import.meta.dirname, '..'),
66
distDirPath = join(oxlintDirPath, 'dist'),
7-
parserDirPath = join(oxlintDirPath, '../parser');
7+
parserDirPath = join(oxlintDirPath, '../../napi/parser');
88

99
// Build with tsdown
1010
console.log('Building with tsdown...');
1111
execSync('pnpm tsdown', { stdio: 'inherit', cwd: oxlintDirPath });
1212

13-
// Copy files from `napi/parser` to `napi/oxlint/dist`
13+
// Copy files from `napi/parser` to `apps/oxlint/dist`
1414
console.log('Copying files from parser...');
1515

1616
const parserFilePaths = [
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)