@ttsc/lint 0.5.0-dev.20260429

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.
@@ -0,0 +1,50 @@
1
+ // Command @ttsc/lint is the native backend for the `@ttsc/lint` plugin.
2
+ //
3
+ // The plugin host (ttsc / ttsx) spawns this binary with one of four
4
+ // subcommands:
5
+ //
6
+ // - `version` / `-v` / `--version` — print the binary banner.
7
+ // - `check` — typecheck + lint without emit. Failure exit code if any
8
+ // error-severity diagnostic fires.
9
+ // - `build` — typecheck + lint, then run the standard tsgo emit pipeline
10
+ // so JS files land on disk.
11
+ // - `transform --file=PATH` — single-file emit with the same lint pass.
12
+ //
13
+ // Diagnostics share the renderer with tsgo's own output, so warnings come
14
+ // out yellow, errors come out red, and the trailing `Found N errors`
15
+ // summary is consistent with `tsc --noEmit`.
16
+ package main
17
+
18
+ import (
19
+ "fmt"
20
+ "os"
21
+
22
+ "github.com/samchon/ttsc/packages/lint/go-plugin/lint"
23
+ )
24
+
25
+ const version = "0.0.1"
26
+
27
+ func main() {
28
+ os.Exit(run(os.Args[1:]))
29
+ }
30
+
31
+ func run(args []string) int {
32
+ if len(args) == 0 {
33
+ fmt.Fprintln(os.Stderr, "@ttsc/lint: command required (expected check|build|transform|version)")
34
+ return 2
35
+ }
36
+ switch args[0] {
37
+ case "-v", "--version", "version":
38
+ fmt.Fprintf(os.Stdout, "@ttsc/lint %s\n", version)
39
+ return 0
40
+ case "check":
41
+ return lint.RunCheck(args[1:])
42
+ case "build":
43
+ return lint.RunBuild(args[1:])
44
+ case "transform":
45
+ return lint.RunTransform(args[1:])
46
+ default:
47
+ fmt.Fprintf(os.Stderr, "@ttsc/lint: unknown command %q\n", args[0])
48
+ return 2
49
+ }
50
+ }
package/index.cjs ADDED
@@ -0,0 +1,28 @@
1
+ // @ts-check
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+
6
+ /**
7
+ * `@ttsc/lint` plugin descriptor.
8
+ *
9
+ * The `rules` field on the tsconfig plugin entry flows straight through to
10
+ * the native binary via `--plugins-json`. Documented severity values are
11
+ * `"off"`, `"warning"`, or `"error"`.
12
+ *
13
+ * @param {Record<string, unknown>} _config
14
+ * @returns {{ name: string; native: { mode: string; source: { dir: string }; contractVersion: 1; capabilities: string[] } }}
15
+ */
16
+ module.exports = function createTtscLint(_config) {
17
+ return {
18
+ name: "@ttsc/lint",
19
+ native: {
20
+ mode: "ttsc-lint",
21
+ source: {
22
+ dir: path.resolve(__dirname, "go-plugin"),
23
+ },
24
+ contractVersion: 1,
25
+ capabilities: ["check"],
26
+ },
27
+ };
28
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@ttsc/lint",
3
+ "version": "0.5.0-dev.20260429",
4
+ "description": "Reference ttsc plugin: ESLint-style lint rules hosted in the same Program/Checker as the type-check pass.",
5
+ "main": "index.cjs",
6
+ "exports": {
7
+ ".": "./index.cjs",
8
+ "./package.json": "./package.json"
9
+ },
10
+ "keywords": [
11
+ "ttsc",
12
+ "lint",
13
+ "eslint",
14
+ "typescript",
15
+ "tsgo"
16
+ ],
17
+ "files": [
18
+ "README.md",
19
+ "index.cjs",
20
+ "go-plugin/go.mod",
21
+ "go-plugin/main.go",
22
+ "go-plugin/lint"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/samchon/ttsc"
27
+ },
28
+ "author": "Jeongho Nam",
29
+ "license": "MIT",
30
+ "bugs": {
31
+ "url": "https://github.com/samchon/ttsc/issues"
32
+ },
33
+ "homepage": "https://github.com/samchon/ttsc/tree/master/packages/lint#readme",
34
+ "deprecation": {
35
+ "preferred": "@typescript-eslint/eslint-plugin",
36
+ "rationale": "@ttsc/lint is a curated reference implementation. The strongly preferred outcome is for eslint / @typescript-eslint maintainers to take ownership of the host slot. If they do, this package will be deprecated and re-pointed at theirs."
37
+ },
38
+ "scripts": {
39
+ "test": "pnpm --dir ../../tests/lint start"
40
+ }
41
+ }