@ttsc/lint 0.7.1 → 0.7.2

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.
Files changed (2) hide show
  1. package/README.md +62 -24
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -9,7 +9,48 @@
9
9
  [![Guide Documents](https://img.shields.io/badge/Guide-Documents-forestgreen)](https://github.com/samchon/ttsc/tree/master/docs)
10
10
  [![Discord Badge](https://img.shields.io/badge/discord-samchon-d91965?style=flat&labelColor=5866f2&logo=discord&logoColor=white&link=https://discord.gg/E94XhzrUCZ)](https://discord.gg/E94XhzrUCZ)
11
11
 
12
- `@ttsc/lint` reports ESLint-style diagnostics from the same TypeScript-Go type-check pass that `ttsc` already runs.
12
+ Lint as compile errors.
13
+
14
+ Rules run inside `ttsc`'s `typescript-go` type-check pass — one compile, both checks.
15
+
16
+ ## Demonstration
17
+
18
+ Given this file:
19
+
20
+ ```typescript
21
+ // src/lint.ts
22
+ var x: number = 3;
23
+ let y: number = 4;
24
+ const z: string = 5;
25
+
26
+ console.log(x + y + z);
27
+ ```
28
+
29
+ Run `ttsc` with `@ttsc/lint` enabled (see [Setup](#setup)):
30
+
31
+ ```bash
32
+ $ pnpm ttsc
33
+ src/lint.ts:3:7 - error TS2322: Type 'number' is not assignable to type 'string'.
34
+
35
+ 3 const z: string = 5;
36
+ ~
37
+
38
+ src/lint.ts:2:5 - error TS17397: [prefer-const] Use const instead of let.
39
+
40
+ 2 let y: number = 4;
41
+ ~~~~~~~~~~~~~
42
+
43
+ src/lint.ts:1:1 - error TS11966: [no-var] Unexpected var, use let or const instead.
44
+
45
+ 1 var x: number = 3;
46
+ ~~~~~~~~~~~~~~~~~~
47
+
48
+ Found 3 errors in the same file, starting at: src/lint.ts:3
49
+ ```
50
+
51
+ Type errors (`TS2322`) and lint violations (`TS17397`, `TS11966`) come out together, in the same `error TSxxxxx` shape.
52
+
53
+ CI that already runs `ttsc` blocks on lint with no extra wiring.
13
54
 
14
55
  ## Setup
15
56
 
@@ -19,7 +60,9 @@ Install `ttsc`, TypeScript-Go, and the lint plugin:
19
60
  npm install -D ttsc @typescript/native-preview @ttsc/lint
20
61
  ```
21
62
 
22
- Open your project's `tsconfig.json`, then add this entry under `compilerOptions.plugins`. If the file already has `compilerOptions`, merge this into the existing object and keep `@ttsc/lint` as the first active plugin:
63
+ Add the plugin under `compilerOptions.plugins` in your `tsconfig.json`.
64
+
65
+ Keep `@ttsc/lint` as the first plugin entry — see [Plugin order](#plugin-order).
23
66
 
24
67
  ```jsonc
25
68
  {
@@ -39,16 +82,20 @@ Open your project's `tsconfig.json`, then add this entry under `compilerOptions.
39
82
  }
40
83
  ```
41
84
 
42
- Run your normal `ttsc` or `ttsx` command:
85
+ Then run your normal `ttsc` or `ttsx`:
43
86
 
44
87
  ```bash
45
88
  npx ttsc
46
89
  npx ttsx src/index.ts
47
90
  ```
48
91
 
49
- Lint errors fail the command. With `ttsx`, lint errors stop the program before your entrypoint runs. Lint warnings are printed without changing the exit code.
92
+ - Lint errors fail the command.
93
+ - Under `ttsx`, lint errors stop the program before your entrypoint runs.
94
+ - Lint warnings are printed without changing the exit code.
95
+
96
+ ### External config file
50
97
 
51
- You can also keep the lint rules in a standalone config file and leave only the file reference in `tsconfig.json`:
98
+ You can also keep the rules in a standalone file and reference it from `tsconfig.json`:
52
99
 
53
100
  ```jsonc
54
101
  {
@@ -73,28 +120,17 @@ export default {
73
120
  };
74
121
  ```
75
122
 
76
- `config` accepts either a config object or a path to `.json`, `.js`, `.cjs`, `.mjs`, `.ts`, `.cts`, or `.mts`. JavaScript and TypeScript config files may export the object directly, as `default`, as `config`, or as a function that returns the object. Relative paths are resolved from the owning tsconfig directory.
123
+ The `config` field accepts:
77
124
 
78
- Inline `config` is also accepted:
125
+ - An inline object (shown earlier), **or** a path to a file ending in `.json`, `.js`, `.cjs`, `.mjs`, `.ts`, `.cts`, or `.mts`.
126
+ - For JS/TS configs: a `default` export, a named `config` export, a direct module export, or a function that returns the object.
127
+ - Relative paths resolve from the directory of the owning `tsconfig.json`.
79
128
 
80
- ```jsonc
81
- {
82
- "compilerOptions": {
83
- "plugins": [
84
- {
85
- "transform": "@ttsc/lint",
86
- "config": {
87
- "no-var": "error"
88
- }
89
- }
90
- ]
91
- }
92
- }
93
- ```
129
+ ## Plugin order
94
130
 
95
- ## Notes
131
+ `@ttsc/lint` must be the first plugin in `compilerOptions.plugins`.
96
132
 
97
- `@ttsc/lint` must be the first active plugin entry because it reports on the source code you wrote. Output plugins such as `@ttsc/banner`, `@ttsc/paths`, and `@ttsc/strip` can come after it.
133
+ It inspects the source you wrote, so output plugins (`@ttsc/banner`, `@ttsc/paths`, `@ttsc/strip`) have to come after it.
98
134
 
99
135
  ```jsonc
100
136
  {
@@ -112,7 +148,9 @@ Inline `config` is also accepted:
112
148
  }
113
149
  ```
114
150
 
115
- This package is diagnostic-only today: no autofix, no recommended preset, no custom rule loading, and no cross-file lint rules.
151
+ ## Scope
152
+
153
+ Diagnostic-only today: no autofix, no recommended preset, no custom rule loading, and no cross-file lint rules.
116
154
 
117
155
  ## Rules
118
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttsc/lint",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Reference ttsc plugin: ESLint-style lint rules hosted in the same Program/Checker as the type-check pass.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "@typescript/native-preview": "7.0.0-dev.20260430.1",
31
31
  "@types/node": "^25.3.0",
32
32
  "rimraf": "^6.1.2",
33
- "ttsc": "0.7.1"
33
+ "ttsc": "0.7.2"
34
34
  },
35
35
  "repository": {
36
36
  "type": "git",