starlint 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ogghead
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # starlint
2
+
3
+ A fast, Rust-based JavaScript/TypeScript linter with first-class WASM plugin support.
4
+
5
+ ## Features
6
+
7
+ - **Fast**: Built on [oxc](https://oxc.rs) for parsing, with single-pass AST traversal
8
+ - **WASM Plugins**: Write lint rules in Rust (or any language targeting WASM) using the Component Model
9
+ - **Native Rules**: High-performance rules that operate directly on the oxc AST
10
+ - **Parallel**: File-level parallelism via rayon
11
+ - **Configurable**: `starlint.toml` with rule severity overrides and file pattern overrides
12
+
13
+ ## Benchmarks
14
+
15
+ <!-- BENCHMARKS_START -->
16
+ Compared against [oxlint](https://oxc.rs) and [eslint](https://eslint.org) on real-world codebases with 20 equivalent lint rules.
17
+
18
+ | Corpus | Files | starlint | oxlint | eslint |
19
+ |--------|------:|----------|--------|--------|
20
+ | express | 141 | **13ms (11 MB)** | 108ms (110 MB) | 1.50s (259 MB) |
21
+ | date-fns | 1562 | **74ms (11 MB)** | 91ms (113 MB) | 4.78s (433 MB) |
22
+ | grafana | 6201 | **310ms (18 MB)** | 389ms (133 MB) | 31.47s (557 MB) |
23
+ <details>
24
+ <summary>Full defaults (all rules enabled per tool)</summary>
25
+
26
+ | Corpus | Files | starlint | oxlint | eslint |
27
+ |--------|------:|----------|--------|--------|
28
+ | express | 141 | 91ms (18 MB) | **71ms (108 MB)** | 1.79s (262 MB) |
29
+ | date-fns | 1562 | 529ms (36 MB) | **140ms (109 MB)** | 6.00s (460 MB) |
30
+ | grafana | 6201 | 3.26s (270 MB) | **695ms (152 MB)** | 4.88s (526 MB) |
31
+ </details>
32
+
33
+ *Last updated: 2026-03-04. Benchmarked with [hyperfine](https://github.com/sharkdp/hyperfine) (3 warmup, 10+ runs).*
34
+ <!-- BENCHMARKS_END -->
35
+
36
+ ## Flamegraph
37
+
38
+ Profiling starlint on the [Grafana](https://github.com/grafana/grafana) codebase (~6k files) with default rules:
39
+
40
+ [![Flamegraph](https://raw.githubusercontent.com/ogghead/starlint/flamegraph-assets/flamegraph.svg)](https://raw.githubusercontent.com/ogghead/starlint/flamegraph-assets/flamegraph.svg)
41
+
42
+ <sub>Click for interactive view. Auto-generated on each push to master.</sub>
43
+
44
+ ## Status
45
+
46
+ **Early development** — the framework is being built. The first plugin (Storybook rules) will be ported from [oxlint-plugin-storybook](https://github.com/ogghead/oxlint-plugin-storybook).
47
+
48
+ ## Quick Start
49
+
50
+ ```bash
51
+ # Build
52
+ cargo build --workspace
53
+
54
+ # Run
55
+ cargo run -- .
56
+
57
+ # Initialize config
58
+ cargo run -- init
59
+ ```
60
+
61
+ ## Configuration
62
+
63
+ Create a `starlint.toml` in your project root:
64
+
65
+ ```toml
66
+ [settings]
67
+ threads = 0 # 0 = auto-detect
68
+
69
+ [[plugins]]
70
+ name = "storybook"
71
+ path = "./plugins/starlint-plugin-storybook.wasm"
72
+
73
+ [rules]
74
+ "no-debugger" = "error"
75
+ "storybook/default-exports" = "error"
76
+
77
+ [[overrides]]
78
+ files = ["**/*.stories.tsx"]
79
+ [overrides.rules]
80
+ "storybook/default-exports" = "error"
81
+ ```
82
+
83
+ ## Plugin Development
84
+
85
+ Plugins implement the WIT interface defined in `wit/plugin.wit`. See the `examples/` directory for sample plugins.
86
+
87
+ ## License
88
+
89
+ MIT
package/bin/starlint ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const { platform, arch } = require("os");
5
+ const { join } = require("path");
6
+
7
+ const PLATFORMS = {
8
+ "linux-x64": {
9
+ package: "@starlint/cli-linux-x64-gnu",
10
+ binary: "starlint",
11
+ },
12
+ "linux-arm64": {
13
+ package: "@starlint/cli-linux-arm64-gnu",
14
+ binary: "starlint",
15
+ },
16
+ "darwin-x64": {
17
+ package: "@starlint/cli-darwin-x64",
18
+ binary: "starlint",
19
+ },
20
+ "darwin-arm64": {
21
+ package: "@starlint/cli-darwin-arm64",
22
+ binary: "starlint",
23
+ },
24
+ "win32-x64": {
25
+ package: "@starlint/cli-win32-x64-msvc",
26
+ binary: "starlint.exe",
27
+ },
28
+ };
29
+
30
+ function getBinaryPath() {
31
+ const key = `${platform()}-${arch()}`;
32
+ const config = PLATFORMS[key];
33
+
34
+ if (!config) {
35
+ console.error(
36
+ `Error: starlint does not have a prebuilt binary for ${platform()} ${arch()}.\n` +
37
+ `Supported platforms: ${Object.keys(PLATFORMS).join(", ")}.\n` +
38
+ `You can build from source: https://github.com/ogghead/starlint`
39
+ );
40
+ process.exit(1);
41
+ }
42
+
43
+ try {
44
+ const packageDir = require.resolve(`${config.package}/package.json`);
45
+ return join(packageDir, "..", config.binary);
46
+ } catch {
47
+ console.error(
48
+ `Error: The platform-specific package "${config.package}" is not installed.\n` +
49
+ `This usually means your package manager did not install the optional dependency.\n\n` +
50
+ `Try reinstalling:\n` +
51
+ ` npm install starlint\n\n` +
52
+ `If the problem persists, install the platform package directly:\n` +
53
+ ` npm install ${config.package}\n\n` +
54
+ `Or build from source: https://github.com/ogghead/starlint`
55
+ );
56
+ process.exit(1);
57
+ }
58
+ }
59
+
60
+ const binaryPath = getBinaryPath();
61
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
62
+ stdio: "inherit",
63
+ shell: platform() === "win32",
64
+ });
65
+
66
+ if (result.error) {
67
+ if (result.error.code === "ENOENT") {
68
+ console.error(
69
+ `Error: Could not find the starlint binary at ${binaryPath}.\n` +
70
+ `The platform package may be corrupted. Try reinstalling:\n` +
71
+ ` npm install starlint`
72
+ );
73
+ process.exit(1);
74
+ }
75
+ throw result.error;
76
+ }
77
+
78
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "starlint",
3
+ "version": "0.1.0",
4
+ "description": "A fast, Rust-based JavaScript/TypeScript linter",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ogghead/starlint"
9
+ },
10
+ "homepage": "https://github.com/ogghead/starlint",
11
+ "keywords": [
12
+ "linter",
13
+ "javascript",
14
+ "typescript",
15
+ "lint",
16
+ "static-analysis"
17
+ ],
18
+ "bin": {
19
+ "starlint": "bin/starlint"
20
+ },
21
+ "files": [
22
+ "bin/starlint",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "engines": {
27
+ "node": ">=14"
28
+ },
29
+ "optionalDependencies": {
30
+ "@starlint/cli-linux-x64-gnu": "0.1.0",
31
+ "@starlint/cli-linux-arm64-gnu": "0.1.0",
32
+ "@starlint/cli-darwin-x64": "0.1.0",
33
+ "@starlint/cli-darwin-arm64": "0.1.0",
34
+ "@starlint/cli-win32-x64-msvc": "0.1.0"
35
+ }
36
+ }