@tyndall/lint 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -5,13 +5,13 @@ Lint and format execution package for Hyper tooling and scaffolding workflows.
5
5
 
6
6
  ## Responsibilities
7
7
  - Provide `runLint` / `runFormat` programmatic APIs for Hyper CLI and scaffolding.
8
- - Build deterministic Biome command invocations from typed options.
9
- - Provide a resilient runtime path by falling back from `biome` to `bunx @biomejs/biome` when needed.
8
+ - Delegate lint/format execution to `@tyndall/oxc` (oxlint/oxfmt).
9
+ - Provide a resilient runtime path by falling back to Bunx when OXC binaries are missing.
10
10
 
11
11
  ## Public API Highlights
12
12
  - runLint
13
13
  - runFormat
14
- - `commandArgs` support for custom command prefixes (for example, `bunx --bun @biomejs/biome`).
14
+ - `commandArgs` support for custom command prefixes (for example, `bunx --bun oxlint`).
15
15
 
16
16
  ## Development
17
17
  - Build: bun run --filter @tyndall/lint build
package/dist/index.d.ts CHANGED
@@ -1,34 +1,2 @@
1
- export interface LintOptions {
2
- cwd: string;
3
- fix?: boolean;
4
- files?: string[];
5
- command?: string;
6
- commandArgs?: string[];
7
- exec?: ExecFn;
8
- }
9
- export interface FormatOptions {
10
- cwd: string;
11
- write?: boolean;
12
- files?: string[];
13
- command?: string;
14
- commandArgs?: string[];
15
- exec?: ExecFn;
16
- }
17
- export interface ExecPayload {
18
- command: string;
19
- args: string[];
20
- cwd: string;
21
- }
22
- export interface ExecResult {
23
- code: number;
24
- error?: Error;
25
- }
26
- export type ExecFn = (payload: ExecPayload) => Promise<ExecResult>;
27
- export interface LintResult extends ExecResult {
28
- command: string;
29
- args: string[];
30
- cwd: string;
31
- }
32
- export declare const runLint: (options: LintOptions) => Promise<LintResult>;
33
- export declare const runFormat: (options: FormatOptions) => Promise<LintResult>;
1
+ export { runLint, runFormat, type ExecFn, type ExecPayload, type ExecResult, type FormatOptions, type LintOptions, type LintResult, } from "@tyndall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{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,47 +1 @@
1
- import { spawn } from "node:child_process";
2
- const BUNX_BIOME_FALLBACK = {
3
- command: "bunx",
4
- commandArgs: ["--bun", "@biomejs/biome"],
5
- };
6
- const buildArgs = (mode, options) => {
7
- const args = [...(options.commandArgs ?? []), mode];
8
- if (mode === "lint" && options.fix) {
9
- args.push("--fix");
10
- }
11
- if (mode === "format" && options.write) {
12
- args.push("--write");
13
- }
14
- // Default to the current working directory when no files are specified.
15
- const files = options.files && options.files.length > 0 ? options.files : ["."];
16
- args.push(...files);
17
- return args;
18
- };
19
- const defaultExec = async ({ command, args, cwd }) => new Promise((resolve) => {
20
- const child = spawn(command, args, { cwd, stdio: "inherit" });
21
- child.once("error", (error) => {
22
- const code = error.code === "ENOENT" ? 127 : 1;
23
- resolve({ code, error });
24
- });
25
- child.once("exit", (code) => resolve({ code: code ?? 0 }));
26
- });
27
- const runBiome = async (mode, options) => {
28
- const exec = options.exec ?? defaultExec;
29
- const canFallbackToBunx = options.command === undefined && options.commandArgs === undefined;
30
- let command = options.command ?? "biome";
31
- let args = buildArgs(mode, options);
32
- let result = await exec({ command, args, cwd: options.cwd });
33
- if (result.code === 127 && canFallbackToBunx) {
34
- command = BUNX_BIOME_FALLBACK.command;
35
- args = buildArgs(mode, { ...options, commandArgs: BUNX_BIOME_FALLBACK.commandArgs });
36
- result = await exec({ command, args, cwd: options.cwd });
37
- }
38
- return {
39
- command,
40
- args,
41
- cwd: options.cwd,
42
- code: result.code,
43
- error: result.error,
44
- };
45
- };
46
- export const runLint = async (options) => runBiome("lint", options);
47
- export const runFormat = async (options) => runBiome("format", options);
1
+ export { runLint, runFormat, } from "@tyndall/oxc";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tyndall/lint",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,7 +10,7 @@
10
10
  "exports": {
11
11
  ".": {
12
12
  "types": "./dist/index.d.ts",
13
- "bun": "./src/index.ts",
13
+ "bun": "./dist/index.js",
14
14
  "default": "./dist/index.js"
15
15
  }
16
16
  },
@@ -19,7 +19,10 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "build": "tsc -p tsconfig.json",
22
- "lint": "bunx --bun @biomejs/biome lint .",
23
- "format": "bunx --bun @biomejs/biome format --write ."
22
+ "lint": "oxlint .",
23
+ "format": "oxfmt ."
24
+ },
25
+ "dependencies": {
26
+ "@tyndall/oxc": "^0.0.3"
24
27
  }
25
28
  }