@kirill.konshin/lint 0.6.8 → 0.7.1
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 +255 -94
- package/dist/configs/imports.js +3 -30
- package/dist/configs/react.d.ts +0 -15
- package/dist/configs/react.js +2 -36
- package/dist/configs/tailwind.d.ts +10 -0
- package/dist/configs/tailwind.js +25 -9
- package/dist/configs/testing.js +2 -41
- package/dist/configs/unicorn.js +2 -10
- package/dist/conventions.d.ts +12 -0
- package/dist/conventions.js +53 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/lib.d.ts +18 -1
- package/dist/lib.js +36 -2
- package/dist/lintPrepare.d.ts +2 -1
- package/dist/lintPrepare.js +13 -1
- package/dist/oxlintPlugin.d.ts +10 -0
- package/dist/oxlintPlugin.js +13 -0
- package/dist/testColocation.d.ts +10 -0
- package/dist/testColocation.js +45 -0
- package/dist/vitePlus.d.ts +58 -0
- package/dist/vitePlus.js +434 -0
- package/package.json +32 -9
- package/rules/agent.md +3 -0
- package/rules/code-style.md +1 -1
- package/rules/github.md +2 -1
- package/rules/gitlab.md +2 -1
- package/rules/jest.md +1 -1
- package/rules/markdown.md +11 -0
- package/rules/monorepo-turbo-nx.md +9 -0
- package/rules/mui.md +0 -2
- package/rules/npm-yarn.md +13 -2
- package/rules/nx.md +3 -2
- package/rules/playwright.md +18 -0
- package/rules/react.md +1 -3
- package/rules/tailwind.md +1 -0
- package/rules/testing.md +5 -2
- package/rules/typescript.md +5 -4
- package/rules/vite.md +5 -1
- package/skills/lint-electron/SKILL.md +80 -0
- package/skills/lint-github/SKILL.md +31 -1
- package/skills/lint-gitlab/SKILL.md +22 -1
- package/skills/lint-migrate/SKILL.md +24 -0
- package/skills/lint-repo/SKILL.md +21 -5
- package/skills/lint-webstorm/SKILL.md +57 -3
- package/skills/spec-steward/SKILL.md +72 -15
- package/skills/spec-steward/references/contract.md +6 -6
- package/skills/spec-tools/SKILL.md +11 -11
- package/skills/spec-tools/references/rules/common.md +32 -7
- package/skills/spec-tools/scripts/cli.js +18 -12
- package/rules/electron.md +0 -25
|
@@ -14,18 +14,18 @@ One CLI, `spec-tools`, installed with `@kirill.konshin/lint` beside `spec-stewar
|
|
|
14
14
|
|
|
15
15
|
## Commands
|
|
16
16
|
|
|
17
|
-
| Need
|
|
18
|
-
|
|
|
19
|
-
| The gate a merge request runs
|
|
20
|
-
| Is this branch's change finished?
|
|
21
|
-
| What changed in the specifications, by requirement
|
|
22
|
-
| Check a spec edit before handing it back
|
|
23
|
-
| The full code-conformance audit, locally
|
|
17
|
+
| Need | Command |
|
|
18
|
+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| The gate a merge request runs | `spec-tools gates` (spec-steward's check, then the change gates) |
|
|
20
|
+
| Is this branch's change finished? | `spec-tools evidence` |
|
|
21
|
+
| What changed in the specifications, by requirement | `spec-tools diff [<base>]` |
|
|
22
|
+
| Check a spec edit before handing it back | `spec-tools changed`, then `/spec-verify changed` |
|
|
23
|
+
| The full code-conformance audit, locally | `spec-tools audit` (`--here` for uncommitted edits, `--dry` to stop after the scope) |
|
|
24
24
|
| spec-steward's corpus-quality audit, on the same engine | `spec-tools audit --audit spec-steward`, then consolidate `.spec-audit/spec-review.yaml` as the `spec-steward` skill says |
|
|
25
|
-
| One pass of a CI audit
|
|
26
|
-
| A headless skill review in CI
|
|
27
|
-
| Gate a review's report
|
|
28
|
-
| The merge-request comment and HTML reports
|
|
25
|
+
| One pass of a CI audit | `spec-tools tier`, `scope`, `workers [--complete\|--verify]`, `report [--gate]` |
|
|
26
|
+
| A headless skill review in CI | `spec-tools run <skill> --verdict .spec-audit/<report>.yaml` |
|
|
27
|
+
| Gate a review's report | `spec-tools verdict .spec-audit/spec-verify.yaml` or `.spec-audit/<report>.yaml` |
|
|
28
|
+
| The merge-request comment and HTML reports | `spec-tools comment <name>=<report.md>...`, `spec-tools html <file.md>...` |
|
|
29
29
|
|
|
30
30
|
In CI: `gates`, `evidence`, `diff`, `tier`, `scope`, `workers`, `report`, `verdict`, `comment`, `html`, for spec-verify. Locally: any of them, plus `audit --audit spec-steward`, which never runs in CI.
|
|
31
31
|
|
|
@@ -25,13 +25,38 @@ These rules tell what a finding is, how severe it is, and how sure you are of it
|
|
|
25
25
|
|
|
26
26
|
- Give each finding a severity, an integer from 0 to 100, on this scale:
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
<table>
|
|
29
|
+
<thead>
|
|
30
|
+
<tr><th>Band</th><th>Severity</th><th>The finding is</th></tr>
|
|
31
|
+
</thead>
|
|
32
|
+
<tbody>
|
|
33
|
+
<tr>
|
|
34
|
+
<td>ERROR</td>
|
|
35
|
+
<td>90–100</td>
|
|
36
|
+
<td>data loss, a leak of sensitive data, a security hole, or a main flow that fails in production</td>
|
|
37
|
+
</tr>
|
|
38
|
+
<tr>
|
|
39
|
+
<td>ERROR</td>
|
|
40
|
+
<td>70–89</td>
|
|
41
|
+
<td>a demonstrated defect with a production effect: a flow fails, a contract or an invariant is broken, or users or operators see a performance problem</td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>WARN</td>
|
|
45
|
+
<td>40–69</td>
|
|
46
|
+
<td>a suspected defect; a demonstrated defect with no production effect; a conflict between rules</td>
|
|
47
|
+
</tr>
|
|
48
|
+
<tr>
|
|
49
|
+
<td>INFO</td>
|
|
50
|
+
<td>1–39</td>
|
|
51
|
+
<td>a state or a risk for a reviewer: a duplicate rule, a test that asserts less than its scenario, a wording problem. It is never a failure.</td>
|
|
52
|
+
</tr>
|
|
53
|
+
<tr>
|
|
54
|
+
<td>—</td>
|
|
55
|
+
<td>0</td>
|
|
56
|
+
<td>not true</td>
|
|
57
|
+
</tr>
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
35
60
|
|
|
36
61
|
- For a severity in the ERROR band, write the production scenario in one sentence: what occurs, to whom, and what breaks, leaks or becomes slow.
|
|
37
62
|
- The tool turns severity and confidence into ERROR, WARN or INFO with its thresholds. The bands above are its defaults; a run can move them. Give the severity that the finding has. Do not aim at a band.
|
|
@@ -15,7 +15,7 @@ var __esmMin = (fn, res, err) => () => {
|
|
|
15
15
|
throw err = [e], e;
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
18
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
19
19
|
var __exportAll = (all, no_symbols) => {
|
|
20
20
|
let target = {};
|
|
21
21
|
for (var name in all) __defProp(target, name, {
|
|
@@ -1564,13 +1564,13 @@ var require_stringifyPair = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1564
1564
|
//#endregion
|
|
1565
1565
|
//#region ../../node_modules/yaml/dist/log.js
|
|
1566
1566
|
var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1567
|
-
var node_process
|
|
1567
|
+
var node_process = __require("process");
|
|
1568
1568
|
function debug(logLevel, ...messages) {
|
|
1569
1569
|
if (logLevel === "debug") console.log(...messages);
|
|
1570
1570
|
}
|
|
1571
1571
|
function warn(logLevel, warning) {
|
|
1572
1572
|
if (logLevel === "debug" || logLevel === "warn") {
|
|
1573
|
-
if (typeof node_process
|
|
1573
|
+
if (typeof node_process.emitWarning === "function") node_process.emitWarning(warning);
|
|
1574
1574
|
else console.warn(warning);
|
|
1575
1575
|
}
|
|
1576
1576
|
}
|
|
@@ -4488,7 +4488,7 @@ var require_compose_doc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4488
4488
|
//#endregion
|
|
4489
4489
|
//#region ../../node_modules/yaml/dist/compose/composer.js
|
|
4490
4490
|
var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4491
|
-
var node_process
|
|
4491
|
+
var node_process = __require("process");
|
|
4492
4492
|
var directives = require_directives();
|
|
4493
4493
|
var Document = require_Document();
|
|
4494
4494
|
var errors = require_errors();
|
|
@@ -4605,7 +4605,7 @@ var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4605
4605
|
}
|
|
4606
4606
|
/** Advance the composer by one CST token. */
|
|
4607
4607
|
*next(token) {
|
|
4608
|
-
if (node_process
|
|
4608
|
+
if (node_process.env.LOG_STREAM) console.dir(token, { depth: null });
|
|
4609
4609
|
switch (token.type) {
|
|
4610
4610
|
case "directive":
|
|
4611
4611
|
this.directives.add(token.source, (offset, message, warning) => {
|
|
@@ -7476,7 +7476,7 @@ var isCLike, isDoc, REGEX_AFTER, REGEX_KEYWORD, OPEN, indentOf, TEST_NAME, TEST_
|
|
|
7476
7476
|
var init_scan = __esmMin((() => {
|
|
7477
7477
|
isCLike = (file) => /\.(?:[cm]?[jt]sx?|go)$/i.test(file);
|
|
7478
7478
|
isDoc = (file) => /\.mdx?$/i.test(file);
|
|
7479
|
-
REGEX_AFTER = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^", ""]);
|
|
7479
|
+
REGEX_AFTER = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^".split(""), ""]);
|
|
7480
7480
|
REGEX_KEYWORD = /^(?:return|typeof|instanceof|in|of|new|delete|void|throw|case|do|else|yield|await)$/;
|
|
7481
7481
|
OPEN = {
|
|
7482
7482
|
"(": ")",
|
|
@@ -7689,7 +7689,7 @@ var init_citations = __esmMin((() => {
|
|
|
7689
7689
|
CITE = /((?:\.{1,2}\/)*(?:[\w@.-]+\/)*?openspec\/specs\/[\w./-]*?spec\.md)(?:#([\w-]+))?/g;
|
|
7690
7690
|
SKIP = /(?:^|\/)(?:node_modules|dist|build|coverage|\.git|\.nx|\.yarn|\.yalc|\.turbo|\.next|\.docusaurus|\.eve)(?:\/|$)|^openspec\/changes\/|(?:^|\/)spec\.md$/;
|
|
7691
7691
|
TEST_FILE = /(?:^|\/)(?:__tests__|e2e)\/|\.(?:test|spec|test-d)\.[cm]?[jt]sx?$|(?:^|\/)test_[^/]+\.py$|_test\.(?:py|go)$/;
|
|
7692
|
-
LINT_CONFIG = /(?:^|\/)(?:eslint\.config\.[cm]?[jt]s|yarn\.config\.cjs)$/;
|
|
7692
|
+
LINT_CONFIG = /(?:^|\/)(?:(?:eslint|vite)\.config\.[cm]?[jt]s|yarn\.config\.cjs)$/;
|
|
7693
7693
|
isTestFile = (file) => TEST_FILE.test(file) && !isDoc(file);
|
|
7694
7694
|
isLintConfig = (file) => LINT_CONFIG.test(file);
|
|
7695
7695
|
anchorCache = /* @__PURE__ */ new Map();
|
|
@@ -9389,6 +9389,7 @@ function rootsOf(opts, cwd = process.cwd()) {
|
|
|
9389
9389
|
/** A `P,F` pair of size lines, or the default. */
|
|
9390
9390
|
function pair(value, fallback) {
|
|
9391
9391
|
if (value === void 0) return fallback;
|
|
9392
|
+
if (typeof value !== "string" && typeof value !== "number") throw new UsageError(`bad size line: ${JSON.stringify(value)}`);
|
|
9392
9393
|
const [p, f] = String(value).split(",").map(Number);
|
|
9393
9394
|
if (!Number.isFinite(p) || f !== void 0 && !Number.isFinite(f)) throw new UsageError(`bad size line: ${value}`);
|
|
9394
9395
|
return [p, f ?? fallback[1]];
|
|
@@ -11648,7 +11649,7 @@ async function runClaude(run, wrote, budget, env, cwd) {
|
|
|
11648
11649
|
session
|
|
11649
11650
|
};
|
|
11650
11651
|
if (code !== 0) {
|
|
11651
|
-
const why =
|
|
11652
|
+
const why = typeof r?.result === "string" ? r.result.slice(0, 200) : "";
|
|
11652
11653
|
return {
|
|
11653
11654
|
status: `exit ${code}${why ? ` (${why})` : ""}`,
|
|
11654
11655
|
session
|
|
@@ -12364,7 +12365,7 @@ function scopeHeader(scope) {
|
|
|
12364
12365
|
}
|
|
12365
12366
|
function main$1(read = commitReader, env = process.env) {
|
|
12366
12367
|
const t = thresholds(env);
|
|
12367
|
-
const units = tryReadData(path$1.join(root(),
|
|
12368
|
+
const units = tryReadData(path$1.join(root(), ".spec-audit/parts/units.yaml")) ?? {};
|
|
12368
12369
|
const advisory = new Set(Object.entries(units).flatMap(([id, u]) => u.advisory ? [id] : []));
|
|
12369
12370
|
const scopePath = path$1.join(root(), SCOPE_FILE);
|
|
12370
12371
|
const scope = fs$1.existsSync(scopePath) ? readData(scopePath) : void 0;
|
|
@@ -12650,8 +12651,13 @@ function progress(event, now = /* @__PURE__ */ new Date()) {
|
|
|
12650
12651
|
const clock = now.toTimeString().slice(0, 8);
|
|
12651
12652
|
return (event.message?.content ?? []).filter((c) => c.type === "tool_use").map((c) => {
|
|
12652
12653
|
const i = c.input ?? {};
|
|
12653
|
-
const what =
|
|
12654
|
-
|
|
12654
|
+
const what = [
|
|
12655
|
+
i.description,
|
|
12656
|
+
i.file_path,
|
|
12657
|
+
i.pattern,
|
|
12658
|
+
i.command
|
|
12659
|
+
].find((v) => typeof v === "string") ?? "";
|
|
12660
|
+
return `[${clock}]${event.parent_tool_use_id ? " ↳" : ""} ${c.name} ${what.slice(0, 120)}\n`;
|
|
12655
12661
|
}).join("");
|
|
12656
12662
|
}
|
|
12657
12663
|
/** One headless session, streamed to the job log; its exit code, its result text and its session id. */
|
|
@@ -12879,7 +12885,7 @@ function comment(reviews, env = process.env) {
|
|
|
12879
12885
|
out.push(`| ${name} | ${MARKS[v.state] ?? `⚠️ ${v.state}`} | ${v.errors} | ${v.warnings} | ${reports(file.replace(/\.md$/, ""))} |`);
|
|
12880
12886
|
}
|
|
12881
12887
|
out.push("");
|
|
12882
|
-
if (fs$1.existsSync(
|
|
12888
|
+
if (fs$1.existsSync(".spec-audit/coverage.md")) out.push(`Coverage: ${reports(COVERAGE_REPORT.replace(/\.md$/, ""))}`, "");
|
|
12883
12889
|
const diff = read(DIFF_FILE);
|
|
12884
12890
|
if (diff !== void 0) out.push(`Specification diff — ${diff.split("\n")[0]}: ${reports(DIFF_FILE.replace(/\.md$/, ""))}`, "");
|
|
12885
12891
|
const gating = env.AUDIT_GATING || "gating";
|
package/rules/electron.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: always_apply
|
|
3
|
-
description: Set of rules for projects which use Electron
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# CI Builds
|
|
7
|
-
|
|
8
|
-
```yml
|
|
9
|
-
variables:
|
|
10
|
-
USE_HARD_LINKS: 'false' # https://github.com/electron-userland/electron-builder/issues/3179#issuecomment-408347702
|
|
11
|
-
|
|
12
|
-
build:
|
|
13
|
-
image: macos-12-xcode-13
|
|
14
|
-
tags:
|
|
15
|
-
- shared-macos-amd64
|
|
16
|
-
script:
|
|
17
|
-
- yarn --immutable
|
|
18
|
-
- yarn build
|
|
19
|
-
- rm -rf electron/dist/mac # some cleanup to make artifacts leaner
|
|
20
|
-
only:
|
|
21
|
-
- master
|
|
22
|
-
artifacts:
|
|
23
|
-
paths:
|
|
24
|
-
- electron/dist
|
|
25
|
-
```
|