@jliocsar/oxlint-plugin-traitor 0.0.0-stage → 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 +21 -0
- package/README.md +72 -2
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +326 -0
- package/package.json +67 -4
- package/preset.json +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jliocsar
|
|
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
CHANGED
|
@@ -1,3 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @jliocsar/oxlint-plugin-traitor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runs [traitor](https://github.com/jliocsar/traitor) once per oxlint run and reports its findings as oxlint diagnostics, on the lines of the snippet each one is about.
|
|
4
|
+
|
|
5
|
+
traitor knows nothing about oxlint. This plugin reads its `check --format json` report (contract version 1) and nothing else.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
bun add -D oxlint @jliocsar/traitor @jliocsar/oxlint-plugin-traitor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"extends": ["./node_modules/@jliocsar/oxlint-plugin-traitor/preset.json"],
|
|
16
|
+
"jsPlugins": ["@jliocsar/oxlint-plugin-traitor"]
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
traitor needs `TYPESAFE_API_KEY` in the environment, as it does on its own.
|
|
21
|
+
|
|
22
|
+
## Rules
|
|
23
|
+
|
|
24
|
+
| Rule | Preset | Reports |
|
|
25
|
+
| ---------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| `traitor/fail` | error | Findings with `failsCheck: true`: pFail reached the trait's threshold. These are the ones that make `traitor check` exit 1. |
|
|
27
|
+
| `traitor/review` | warn | Findings that lean `fail` but stay under the threshold, `fail` verdicts of traits with no threshold, and `unsure` verdicts. |
|
|
28
|
+
|
|
29
|
+
They're two rules because oxlint sets severity per rule, not per diagnostic. Passes and `n/a` verdicts report nothing.
|
|
30
|
+
|
|
31
|
+
## What it checks
|
|
32
|
+
|
|
33
|
+
One `traitor check --format json` runs per oxlint run, the first time a file is linted. Every file and both rules read that one report. A file traitor didn't judge gets nothing.
|
|
34
|
+
|
|
35
|
+
By default traitor judges what you haven't pushed, as plain `traitor check` does. Change that in `settings.traitor`:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"settings": {
|
|
40
|
+
"traitor": {
|
|
41
|
+
"base": "origin/main"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| Setting | Default | Meaning |
|
|
48
|
+
| --------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `base` | none | A revision. traitor judges what changed since it. Use it in CI. |
|
|
50
|
+
| `files` | none | Paths traitor judges whole, as they are on disk (`--files`). Can't be combined with `base`. |
|
|
51
|
+
| `command` | `node_modules/.bin/traitor`, then `traitor` on PATH | The traitor binary to run. |
|
|
52
|
+
|
|
53
|
+
The files oxlint lints don't choose what traitor judges. A rule sees one file at a time and can't wait for the end of the run, so the plugin can't hand oxlint's file list to `--files`.
|
|
54
|
+
|
|
55
|
+
When traitor can't run (no API key, not a git repository, a report version this plugin doesn't read), the first linted file gets one diagnostic that says why, and no trait is judged.
|
|
56
|
+
|
|
57
|
+
## CLI and CI only
|
|
58
|
+
|
|
59
|
+
Keep this plugin out of your editor. The editor's oxlint stays running, so the cached report goes stale, and checking on every save costs Jev calls. Run it from the command line, in CI, from a pre-push hook, or from an agent's Stop hook.
|
|
60
|
+
|
|
61
|
+
One way is a separate config that only CI and hooks use:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
oxlint -c .oxlintrc.traitor.json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## The contract
|
|
68
|
+
|
|
69
|
+
`schema/check-report.schema.json` is a copy of traitor's. `src/report.generated.ts` is generated from it (`bun run schema:types`), and `src/boundary.ts` decodes traitor's output into those types and refuses any version but 1. CI fails when the copy drifts from traitor main.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { definePlugin, defineRule } from "@oxlint/plugins";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
// src/boundary.ts
|
|
6
|
+
const SUPPORTED_VERSION = 1;
|
|
7
|
+
const SETTINGS_KEY = "traitor";
|
|
8
|
+
const VERDICTS = [
|
|
9
|
+
"pass",
|
|
10
|
+
"fail",
|
|
11
|
+
"n/a",
|
|
12
|
+
"unsure"
|
|
13
|
+
];
|
|
14
|
+
const NO_SETTINGS = {
|
|
15
|
+
command: void 0,
|
|
16
|
+
base: void 0,
|
|
17
|
+
files: []
|
|
18
|
+
};
|
|
19
|
+
function succeed(value) {
|
|
20
|
+
return {
|
|
21
|
+
ok: true,
|
|
22
|
+
value
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function refuse(problem) {
|
|
26
|
+
return {
|
|
27
|
+
ok: false,
|
|
28
|
+
problem
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function asObject(value) {
|
|
32
|
+
if (value === null || value === void 0 || Array.isArray(value)) return;
|
|
33
|
+
return typeof value === "object" ? value : void 0;
|
|
34
|
+
}
|
|
35
|
+
function asArray(value) {
|
|
36
|
+
return Array.isArray(value) ? value : void 0;
|
|
37
|
+
}
|
|
38
|
+
function asString(value) {
|
|
39
|
+
return typeof value === "string" ? value : void 0;
|
|
40
|
+
}
|
|
41
|
+
function asNumber(value) {
|
|
42
|
+
return typeof value === "number" ? value : void 0;
|
|
43
|
+
}
|
|
44
|
+
function asInteger(value) {
|
|
45
|
+
const number = asNumber(value);
|
|
46
|
+
return number !== void 0 && Number.isInteger(number) ? number : void 0;
|
|
47
|
+
}
|
|
48
|
+
function asBoolean(value) {
|
|
49
|
+
return typeof value === "boolean" ? value : void 0;
|
|
50
|
+
}
|
|
51
|
+
function asVerdict(value) {
|
|
52
|
+
return VERDICTS.find((verdict) => verdict === value);
|
|
53
|
+
}
|
|
54
|
+
function asStrings(value) {
|
|
55
|
+
const strings = asArray(value)?.flatMap((item) => {
|
|
56
|
+
const text = asString(item);
|
|
57
|
+
return text === void 0 ? [] : [text];
|
|
58
|
+
});
|
|
59
|
+
return strings?.length === asArray(value)?.length ? strings : void 0;
|
|
60
|
+
}
|
|
61
|
+
function complete(fields) {
|
|
62
|
+
if (Object.values(fields).some((field) => field === void 0)) return;
|
|
63
|
+
return fields;
|
|
64
|
+
}
|
|
65
|
+
function parseJson(text) {
|
|
66
|
+
try {
|
|
67
|
+
return succeed(JSON.parse(text));
|
|
68
|
+
} catch (cause) {
|
|
69
|
+
return refuse(`its output is not JSON (${String(cause)})`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function decodeThreshold(value) {
|
|
73
|
+
return value === null ? null : asNumber(value);
|
|
74
|
+
}
|
|
75
|
+
function decodeFinding(value) {
|
|
76
|
+
const finding = asObject(value);
|
|
77
|
+
if (finding === void 0) return;
|
|
78
|
+
const threshold = decodeThreshold(finding["threshold"]);
|
|
79
|
+
const thresholdIsValid = finding["threshold"] === void 0 || threshold !== void 0;
|
|
80
|
+
const fields = complete({
|
|
81
|
+
path: asString(finding["path"]),
|
|
82
|
+
firstLine: asInteger(finding["firstLine"]),
|
|
83
|
+
lastLine: asInteger(finding["lastLine"]),
|
|
84
|
+
trait: asString(finding["trait"]),
|
|
85
|
+
title: asString(finding["title"]),
|
|
86
|
+
why: asString(finding["why"]),
|
|
87
|
+
verdict: asVerdict(finding["verdict"]),
|
|
88
|
+
pFail: asNumber(finding["pFail"]),
|
|
89
|
+
failsCheck: asBoolean(finding["failsCheck"]),
|
|
90
|
+
fromCache: asBoolean(finding["fromCache"])
|
|
91
|
+
});
|
|
92
|
+
if (fields === void 0 || !thresholdIsValid) return;
|
|
93
|
+
return {
|
|
94
|
+
...fields,
|
|
95
|
+
threshold: threshold ?? null
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function decodeFindings(value) {
|
|
99
|
+
const items = asArray(value);
|
|
100
|
+
const findings = items?.flatMap((item) => {
|
|
101
|
+
const finding = decodeFinding(item);
|
|
102
|
+
return finding === void 0 ? [] : [finding];
|
|
103
|
+
});
|
|
104
|
+
return findings?.length === items?.length ? findings : void 0;
|
|
105
|
+
}
|
|
106
|
+
function decodeReport(text) {
|
|
107
|
+
const parsed = parseJson(text);
|
|
108
|
+
if (!parsed.ok) return parsed;
|
|
109
|
+
const report = asObject(parsed.value);
|
|
110
|
+
const version = asInteger(report?.["version"]);
|
|
111
|
+
if (version !== SUPPORTED_VERSION) return refuse(`it sent report version ${String(version)}, and this plugin reads version ${SUPPORTED_VERSION}. Upgrade @jliocsar/oxlint-plugin-traitor`);
|
|
112
|
+
const findings = decodeFindings(report?.["findings"]);
|
|
113
|
+
const nonUtf8Paths = asStrings(report?.["nonUtf8Paths"]);
|
|
114
|
+
const decoded = complete({
|
|
115
|
+
version,
|
|
116
|
+
root: asString(report?.["root"]),
|
|
117
|
+
snippetCount: asInteger(report?.["snippetCount"]),
|
|
118
|
+
failsCheck: asBoolean(report?.["failsCheck"]),
|
|
119
|
+
findings: findings === void 0 ? void 0 : [...findings],
|
|
120
|
+
nonUtf8Paths: nonUtf8Paths === void 0 ? void 0 : [...nonUtf8Paths]
|
|
121
|
+
});
|
|
122
|
+
return decoded === void 0 ? refuse("its report does not match the version 1 contract") : succeed(decoded);
|
|
123
|
+
}
|
|
124
|
+
function decodeSettings(settings) {
|
|
125
|
+
const raw = settings[SETTINGS_KEY];
|
|
126
|
+
if (raw === void 0) return succeed(NO_SETTINGS);
|
|
127
|
+
const traitor = asObject(raw);
|
|
128
|
+
const command = traitor?.["command"];
|
|
129
|
+
const base = traitor?.["base"];
|
|
130
|
+
const files = traitor?.["files"] === void 0 ? [] : asStrings(traitor["files"]);
|
|
131
|
+
if (traitor === void 0 || command !== void 0 && asString(command) === void 0 || base !== void 0 && asString(base) === void 0 || files === void 0) return refuse("`settings.traitor` takes `command` (a path), `base` (a revision) and `files` (a list of paths)");
|
|
132
|
+
if (base !== void 0 && files.length > 0) return refuse("`settings.traitor` takes `base` or `files`, not both, as traitor does");
|
|
133
|
+
return succeed({
|
|
134
|
+
command: asString(command),
|
|
135
|
+
base: asString(base),
|
|
136
|
+
files
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// src/findings.ts
|
|
140
|
+
const FAIL = "fail";
|
|
141
|
+
const UNSURE = "unsure";
|
|
142
|
+
function diagnosticFor(tier, finding) {
|
|
143
|
+
if (finding.failsCheck) return tier === FAIL ? {
|
|
144
|
+
messageId: "failsCheck",
|
|
145
|
+
finding
|
|
146
|
+
} : void 0;
|
|
147
|
+
if (tier === FAIL) return;
|
|
148
|
+
if (finding.verdict === UNSURE) return {
|
|
149
|
+
messageId: "unsure",
|
|
150
|
+
finding
|
|
151
|
+
};
|
|
152
|
+
if (finding.verdict !== FAIL) return;
|
|
153
|
+
return {
|
|
154
|
+
messageId: (finding.threshold ?? null) === null ? "reportOnly" : "leansFail",
|
|
155
|
+
finding
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function diagnosticsFor(report, filename, tier) {
|
|
159
|
+
const file = resolve(filename);
|
|
160
|
+
return report.findings.flatMap((finding) => {
|
|
161
|
+
const diagnostic = resolve(report.root, finding.path) === file ? diagnosticFor(tier, finding) : void 0;
|
|
162
|
+
return diagnostic === void 0 ? [] : [diagnostic];
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
// src/run.ts
|
|
166
|
+
const PATH_COMMAND = "traitor";
|
|
167
|
+
const LOCAL_COMMAND = [
|
|
168
|
+
"node_modules",
|
|
169
|
+
".bin",
|
|
170
|
+
"traitor"
|
|
171
|
+
];
|
|
172
|
+
const CHECK_ARGUMENTS = [
|
|
173
|
+
"check",
|
|
174
|
+
"--format",
|
|
175
|
+
"json"
|
|
176
|
+
];
|
|
177
|
+
const FILES_FLAG = "--files";
|
|
178
|
+
const REPORTING_EXIT_CODES = /* @__PURE__ */ new Set([0, 1]);
|
|
179
|
+
const MAXIMUM_OUTPUT_BYTES = 268435456;
|
|
180
|
+
const RUNS = /* @__PURE__ */ new Map();
|
|
181
|
+
function commandFor(settings, cwd) {
|
|
182
|
+
if (settings.command !== void 0) return settings.command;
|
|
183
|
+
const local = join(cwd, ...LOCAL_COMMAND);
|
|
184
|
+
return existsSync(local) ? local : PATH_COMMAND;
|
|
185
|
+
}
|
|
186
|
+
function argumentsFor(settings) {
|
|
187
|
+
if (settings.files.length > 0) return [
|
|
188
|
+
...CHECK_ARGUMENTS,
|
|
189
|
+
FILES_FLAG,
|
|
190
|
+
...settings.files
|
|
191
|
+
];
|
|
192
|
+
return settings.base === void 0 ? CHECK_ARGUMENTS : [...CHECK_ARGUMENTS, settings.base];
|
|
193
|
+
}
|
|
194
|
+
function runOnce(settings, cwd) {
|
|
195
|
+
const command = commandFor(settings, cwd);
|
|
196
|
+
const result = spawnSync(command, argumentsFor(settings), {
|
|
197
|
+
cwd,
|
|
198
|
+
encoding: "utf8",
|
|
199
|
+
maxBuffer: MAXIMUM_OUTPUT_BYTES
|
|
200
|
+
});
|
|
201
|
+
if (result.error !== void 0) return {
|
|
202
|
+
ok: false,
|
|
203
|
+
problem: `\`${command}\` could not start: ${result.error.message}`
|
|
204
|
+
};
|
|
205
|
+
if (result.status === null || !REPORTING_EXIT_CODES.has(result.status)) {
|
|
206
|
+
const reason = result.stderr.trim();
|
|
207
|
+
return {
|
|
208
|
+
ok: false,
|
|
209
|
+
problem: `it exited with ${result.status === null ? `signal ${String(result.signal)}` : `code ${result.status}`}: ${reason.length > 0 ? reason : "no reason given"}`
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return decodeReport(result.stdout);
|
|
213
|
+
}
|
|
214
|
+
function runKey(settings, cwd) {
|
|
215
|
+
return JSON.stringify([
|
|
216
|
+
cwd,
|
|
217
|
+
settings.command,
|
|
218
|
+
settings.base,
|
|
219
|
+
settings.files
|
|
220
|
+
]);
|
|
221
|
+
}
|
|
222
|
+
function traitorReport(settings, cwd) {
|
|
223
|
+
const key = runKey(settings, cwd);
|
|
224
|
+
const cached = RUNS.get(key);
|
|
225
|
+
if (cached !== void 0) return cached;
|
|
226
|
+
const outcome = runOnce(settings, cwd);
|
|
227
|
+
RUNS.set(key, outcome);
|
|
228
|
+
return outcome;
|
|
229
|
+
}
|
|
230
|
+
// src/rule.ts
|
|
231
|
+
const SETTINGS_PROBLEM_KEY = "settings";
|
|
232
|
+
const FIRST_LINE = 1;
|
|
233
|
+
const REPORTED_PROBLEMS = /* @__PURE__ */ new Set();
|
|
234
|
+
const MESSAGES = {
|
|
235
|
+
failsCheck: "{{title}}: {{why}} Trait `{{trait}}` fails this snippet (pFail {{pFail}}, threshold {{threshold}}).",
|
|
236
|
+
leansFail: "{{title}}: {{why}} Trait `{{trait}}` leans fail here (pFail {{pFail}}) but stays under its threshold of {{threshold}}. Worth a look.",
|
|
237
|
+
reportOnly: "{{title}}: {{why}} Trait `{{trait}}` fails this snippet (pFail {{pFail}}). It has no threshold, so it only reports.",
|
|
238
|
+
unsure: "{{title}}: {{why}} Jev could not tell from this snippet alone whether it holds trait `{{trait}}`. A person should read it.",
|
|
239
|
+
traitorFailed: "traitor could not check this run, so no trait was judged: {{problem}}."
|
|
240
|
+
};
|
|
241
|
+
const DESCRIPTIONS = {
|
|
242
|
+
fail: "report traitor findings that fail their trait threshold",
|
|
243
|
+
review: "report traitor findings that lean fail under their threshold, or that Jev was unsure of"
|
|
244
|
+
};
|
|
245
|
+
function reportProblemOnce(context, key, problem) {
|
|
246
|
+
if (REPORTED_PROBLEMS.has(key)) return;
|
|
247
|
+
REPORTED_PROBLEMS.add(key);
|
|
248
|
+
context.report({
|
|
249
|
+
loc: {
|
|
250
|
+
start: {
|
|
251
|
+
line: FIRST_LINE,
|
|
252
|
+
column: 0
|
|
253
|
+
},
|
|
254
|
+
end: {
|
|
255
|
+
line: FIRST_LINE,
|
|
256
|
+
column: 0
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
messageId: "traitorFailed",
|
|
260
|
+
data: { problem }
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function reportDiagnostic(context, { messageId, finding }) {
|
|
264
|
+
const { lines } = context.sourceCode;
|
|
265
|
+
const lastLine = Math.min(Math.max(finding.lastLine, finding.firstLine), lines.length);
|
|
266
|
+
const firstLine = Math.min(finding.firstLine, lastLine);
|
|
267
|
+
context.report({
|
|
268
|
+
loc: {
|
|
269
|
+
start: {
|
|
270
|
+
line: firstLine,
|
|
271
|
+
column: 0
|
|
272
|
+
},
|
|
273
|
+
end: {
|
|
274
|
+
line: lastLine,
|
|
275
|
+
column: lines[lastLine - 1]?.length ?? 0
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
messageId,
|
|
279
|
+
data: {
|
|
280
|
+
title: finding.title,
|
|
281
|
+
why: finding.why,
|
|
282
|
+
trait: finding.trait,
|
|
283
|
+
pFail: finding.pFail.toFixed(2),
|
|
284
|
+
threshold: finding.threshold?.toFixed(2) ?? "none"
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function reportFor(context) {
|
|
289
|
+
const settings = decodeSettings(context.settings);
|
|
290
|
+
if (!settings.ok) return {
|
|
291
|
+
...settings,
|
|
292
|
+
key: SETTINGS_PROBLEM_KEY
|
|
293
|
+
};
|
|
294
|
+
return {
|
|
295
|
+
...traitorReport(settings.value, context.cwd),
|
|
296
|
+
key: runKey(settings.value, context.cwd)
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function traitorRule(tier) {
|
|
300
|
+
return defineRule({
|
|
301
|
+
meta: {
|
|
302
|
+
type: "problem",
|
|
303
|
+
docs: { description: DESCRIPTIONS[tier] },
|
|
304
|
+
messages: MESSAGES
|
|
305
|
+
},
|
|
306
|
+
create(context) {
|
|
307
|
+
return { Program() {
|
|
308
|
+
const outcome = reportFor(context);
|
|
309
|
+
if (!outcome.ok) {
|
|
310
|
+
reportProblemOnce(context, outcome.key, outcome.problem);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
for (const diagnostic of diagnosticsFor(outcome.value, context.filename, tier)) reportDiagnostic(context, diagnostic);
|
|
314
|
+
} };
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
// src/index.ts
|
|
319
|
+
var src_default = definePlugin({
|
|
320
|
+
meta: { name: "traitor" },
|
|
321
|
+
rules: {
|
|
322
|
+
fail: traitorRule("fail"),
|
|
323
|
+
review: traitorRule("review")
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
export { src_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "http://json.schemastore.org/package",
|
|
2
3
|
"name": "@jliocsar/oxlint-plugin-traitor",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Runs traitor once per oxlint run and reports its findings as diagnostics",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"jev",
|
|
8
|
+
"lint",
|
|
9
|
+
"oxlint",
|
|
10
|
+
"plugin",
|
|
11
|
+
"traitor"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/jliocsar/oxlint-plugin-traitor#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/jliocsar/oxlint-plugin-traitor/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "jliocsar",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/jliocsar/oxlint-plugin-traitor.git"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"preset.json",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"import": "./dist/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./preset.json": "./preset.json"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "bunx --bun tsdown src/index.ts --format esm --dts --clean",
|
|
43
|
+
"test": "bun test ./test/",
|
|
44
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
45
|
+
"lint": "bunx --bun oxlint --deny-warnings",
|
|
46
|
+
"lint:fix": "bunx --bun oxlint --fix --deny-warnings",
|
|
47
|
+
"fmt": "oxfmt",
|
|
48
|
+
"fmt:check": "oxfmt --check",
|
|
49
|
+
"schema:types": "json2ts -i schema/check-report.schema.json -o src/report.generated.ts --additionalProperties false && oxfmt src/report.generated.ts",
|
|
50
|
+
"schema:check": "bun scripts/check-schema.ts",
|
|
51
|
+
"prepack": "bun run build"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@oxlint/plugins": "^1.91.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@jliocsar/begone-slop": "0.2.12",
|
|
58
|
+
"@types/bun": "^1.3.14",
|
|
59
|
+
"json-schema-to-typescript": "16.0.0",
|
|
60
|
+
"oxfmt": "^0.62.0",
|
|
61
|
+
"oxlint": "1.91.0",
|
|
62
|
+
"oxlint-tsgolint": "7.0.2006",
|
|
63
|
+
"tsdown": "^0.22.0",
|
|
64
|
+
"typescript": "7.0.2"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"oxlint": ">=1.91.0"
|
|
68
|
+
}
|
|
69
|
+
}
|