@antelopejs/tooling-configs 0.5.8 → 0.7.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/README.md +39 -49
- package/dist/{api-CCOiLN3w.mjs → api-BQLrI_S1.mjs} +19 -2
- package/dist/bin/api-diff.mjs +155 -37
- package/dist/bin/body-check.mjs +6 -3
- package/dist/bin/check-size.mjs +1 -1
- package/dist/bin/checks.mjs +1 -1
- package/dist/bin/comment-proof.mjs +3 -5
- package/dist/bin/garden.mjs +86 -34
- package/dist/bin/lease.mjs +314 -26
- package/dist/bin/ratchet.mjs +4 -4
- package/dist/bin/readme-strip.mjs +1 -1
- package/dist/bin/suppressions.mjs +10 -6
- package/dist/bin/sync.mjs +23 -98
- package/dist/bin/triage.mjs +1 -1
- package/dist/bin/verify.mjs +1 -1
- package/dist/{checks-BC-F8bsv.mjs → checks-BefrkjiT.mjs} +729 -25
- package/dist/{docs-compat-Ft1r2sf0.mjs → docs-compat-CSljVi3O.mjs} +13 -8
- package/dist/eslint.d.mts +13 -4
- package/dist/eslint.mjs +48 -6
- package/dist/guardrails-BfGwehVj.mjs +2414 -0
- package/dist/installed-typescript-6MtIWlE4.mjs +84 -0
- package/dist/oxc/anti-slop/index.mjs +541 -34
- package/dist/oxc/guardrails/index.d.mts +1 -1
- package/dist/oxc/guardrails/index.mjs +2 -1854
- package/dist/oxc/lint.d.mts +10 -1
- package/dist/oxc/lint.mjs +13 -5
- package/dist/{oxlint-CCOJqj3d.mjs → oxlint-CkHhK5K_.mjs} +33 -11
- package/dist/{package-DnxZ2CXZ.mjs → package-DDG3YH7W.mjs} +10 -5
- package/dist/{ports-DGP6bPJy.mjs → ports-DAeEJsYh.mjs} +22 -0
- package/dist/{proof-stamp-lyD84zmj.mjs → proof-stamp-BFV7JTZT.mjs} +5 -4
- package/dist/{ratchet-SQ7vTR0i.mjs → ratchet-2FeMs1kh.mjs} +4 -3
- package/dist/{suppression-base-whhvw-IJ.mjs → suppression-base-CYaLZAq7.mjs} +2 -2
- package/dist/{suppression-budget-CtIYSoDO.mjs → suppression-budget-CPDSFg4X.mjs} +1 -1
- package/dist/{suppressions-C79kRvYI.mjs → suppressions-CxPnh4sC.mjs} +2 -2
- package/dist/{templates-Dg188oRC.mjs → templates-HG0fel2S.mjs} +1 -1
- package/dist/{type-aware-rules-DMuN6sHb.mjs → type-aware-rules-Da3769fI.mjs} +9 -1
- package/dist/{typescript--_8og8AM.mjs → typescript-CxfNxyr2.mjs} +59 -98
- package/dist/{workflow-CPcNc8KL.mjs → workflow-C-oBwL2H.mjs} +25 -1
- package/package.json +9 -5
- package/dist/bin/check-interface-ranges.d.mts +0 -1
- package/dist/bin/check-interface-ranges.mjs +0 -44
- package/dist/interface-ranges-CcVSr59f.mjs +0 -116
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/tooling-configs",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Shared tooling presets for AntelopeJS repositories: oxlint (with the vendored anti-slop rules), oxfmt, ESLint for Nuxt layers, Knip, and a dependency range check",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antelopejs",
|
|
7
7
|
"anti-slop",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"antelopejs-api-diff": "./dist/bin/api-diff.mjs",
|
|
25
25
|
"antelopejs-body-check": "./dist/bin/body-check.mjs",
|
|
26
26
|
"antelopejs-capture": "./dist/bin/capture.mjs",
|
|
27
|
-
"antelopejs-check-interface-ranges": "./dist/bin/check-interface-ranges.mjs",
|
|
28
27
|
"antelopejs-check-size": "./dist/bin/check-size.mjs",
|
|
29
28
|
"antelopejs-checks": "./dist/bin/checks.mjs",
|
|
30
29
|
"antelopejs-comment-proof": "./dist/bin/comment-proof.mjs",
|
|
@@ -82,16 +81,19 @@
|
|
|
82
81
|
},
|
|
83
82
|
"dependencies": {
|
|
84
83
|
"@oxlint/plugins": "1.81.0",
|
|
84
|
+
"@typescript/typescript6": "^6.0.2",
|
|
85
85
|
"dts-bundle-generator": "^9.5.1",
|
|
86
86
|
"minimatch": "^10.2.6",
|
|
87
|
-
"
|
|
87
|
+
"semver": "^7.8.5",
|
|
88
88
|
"yaml": "^2.9.1"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
+
"@antelopejs/interface-database": ">=0.4.0 <0.5.0",
|
|
91
92
|
"@nuxt/eslint-config": "^1.17.0",
|
|
92
93
|
"@types/node": "^24.13.3",
|
|
93
94
|
"@types/semver": "^7.8.0",
|
|
94
95
|
"@typescript-eslint/parser": "8.69.0",
|
|
96
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
95
97
|
"eslint": "10.9.1",
|
|
96
98
|
"eslint-plugin-perfectionist": "^5.11.0",
|
|
97
99
|
"knip": "^6.34.0",
|
|
@@ -101,11 +103,13 @@
|
|
|
101
103
|
"oxlint": "1.81.0",
|
|
102
104
|
"oxlint-tsgolint": "^7.0.2001",
|
|
103
105
|
"pixelmatch": "^8.0.0",
|
|
104
|
-
"playwright-core": "^1.
|
|
106
|
+
"playwright-core": "^1.65.0",
|
|
105
107
|
"release-it": "^19.2.4",
|
|
106
108
|
"release-it-changelogen": "^0.1.0",
|
|
107
109
|
"sharp": "^0.35.5",
|
|
108
110
|
"tsdown": "^0.22.14",
|
|
111
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
112
|
+
"typescript5": "npm:typescript@^5.9.3",
|
|
109
113
|
"vite": "^8.3.4"
|
|
110
114
|
},
|
|
111
115
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { n as describeViolation, r as localVersions, t as checkInterfaceRanges } from "../interface-ranges-CcVSr59f.mjs";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { join, relative } from "node:path";
|
|
5
|
-
import { execFileSync } from "node:child_process";
|
|
6
|
-
//#region src/bin/check-interface-ranges.ts
|
|
7
|
-
/**
|
|
8
|
-
* Every manifest in the repository by default, whatever directory the lint
|
|
9
|
-
* runs from: playgrounds and front-end layers are loaded by the runtime too, a
|
|
10
|
-
* playground is where a stale interface range first broke a startup, and an
|
|
11
|
-
* implemented interface usually sits in a sibling package.
|
|
12
|
-
*/
|
|
13
|
-
function trackedManifests() {
|
|
14
|
-
const git = (args) => execFileSync("git", args, { encoding: "utf8" }).trim();
|
|
15
|
-
const root = git(["rev-parse", "--show-toplevel"]);
|
|
16
|
-
return git([
|
|
17
|
-
"-C",
|
|
18
|
-
root,
|
|
19
|
-
"ls-files",
|
|
20
|
-
"--",
|
|
21
|
-
"package.json",
|
|
22
|
-
"**/package.json"
|
|
23
|
-
]).split("\n").filter((line) => line.length > 0).map((file) => relative(process.cwd(), join(root, file)));
|
|
24
|
-
}
|
|
25
|
-
function main() {
|
|
26
|
-
const manifests = (process.argv.length > 2 ? process.argv.slice(2) : trackedManifests()).map((path) => ({
|
|
27
|
-
path,
|
|
28
|
-
manifest: JSON.parse(readFileSync(path, "utf8"))
|
|
29
|
-
}));
|
|
30
|
-
const versions = localVersions(manifests.map(({ manifest }) => manifest));
|
|
31
|
-
let failures = 0;
|
|
32
|
-
for (const { path, manifest } of manifests) for (const violation of checkInterfaceRanges(manifest, versions)) {
|
|
33
|
-
console.error(`${path}: ${describeViolation(violation)}`);
|
|
34
|
-
failures += 1;
|
|
35
|
-
}
|
|
36
|
-
if (failures > 0) {
|
|
37
|
-
console.error(`\n${failures} interface range(s) would stop a module from starting at the next interface release.`);
|
|
38
|
-
return 1;
|
|
39
|
-
}
|
|
40
|
-
return 0;
|
|
41
|
-
}
|
|
42
|
-
process.exitCode = main();
|
|
43
|
-
//#endregion
|
|
44
|
-
export {};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
//#region src/interface-ranges.ts
|
|
2
|
-
/**
|
|
3
|
-
* At startup `@antelopejs/core` keeps one copy of each interface package, the
|
|
4
|
-
* one its implementing module installed, and refuses to start when any loaded
|
|
5
|
-
* module declares a range that copy falls outside. An exact pin (`0.1.7`) or a
|
|
6
|
-
* 0.x caret (`^0.1.2` means `<0.2.0`) therefore stops a module from starting
|
|
7
|
-
* as soon as the implementer resolves the next interface release, with no
|
|
8
|
-
* change to the module itself.
|
|
9
|
-
*
|
|
10
|
-
* A consumer accepts every release from its floor up to the next breaking one
|
|
11
|
-
* (`>=0.1.7 <1.0.0`). The module that implements an interface is the opposite
|
|
12
|
-
* case: it must never be handed a breaking minor it does not implement, so it
|
|
13
|
-
* caps the range below the next minor (`>=0.3.0 <0.4.0`) while the interface
|
|
14
|
-
* is 0.x.
|
|
15
|
-
*/
|
|
16
|
-
const INTERFACE_PACKAGE_PREFIX = "@antelopejs/interface-";
|
|
17
|
-
/** A module's own interface linked from the workspace is the copy it builds against, not a release it resolves. */
|
|
18
|
-
const LOCAL_SPEC_PREFIXES = [
|
|
19
|
-
"workspace:",
|
|
20
|
-
"file:",
|
|
21
|
-
"link:"
|
|
22
|
-
];
|
|
23
|
-
/** The fields `@antelopejs/core` checks at startup. */
|
|
24
|
-
const CHECKED_FIELDS = ["dependencies", "optionalDependencies"];
|
|
25
|
-
const BOUNDED_RANGE = /^>=(\d+)\.(\d+)\.(\d+) <(\d+)\.(\d+)\.(\d+)$/;
|
|
26
|
-
const SINGLE_VERSION = /^[\^~=]?v?(\d+)\.(\d+)\.(\d+)$/;
|
|
27
|
-
const formatVersion = ([major, minor, patch]) => `${major}.${minor}.${patch}`;
|
|
28
|
-
const sameVersion = (a, b) => a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
29
|
-
/** The first release a module declaring `floor` must not be handed. */
|
|
30
|
-
function rangeCeiling(floor, role) {
|
|
31
|
-
const [major, minor] = floor;
|
|
32
|
-
if (major > 0) return [
|
|
33
|
-
major + 1,
|
|
34
|
-
0,
|
|
35
|
-
0
|
|
36
|
-
];
|
|
37
|
-
return role === "implementer" ? [
|
|
38
|
-
0,
|
|
39
|
-
minor + 1,
|
|
40
|
-
0
|
|
41
|
-
] : [
|
|
42
|
-
1,
|
|
43
|
-
0,
|
|
44
|
-
0
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
function expectedRange(floor, role) {
|
|
48
|
-
return `>=${formatVersion(floor)} <${formatVersion(rangeCeiling(floor, role))}`;
|
|
49
|
-
}
|
|
50
|
-
function toVersion(match, offset) {
|
|
51
|
-
return [
|
|
52
|
-
Number(match[offset]),
|
|
53
|
-
Number(match[offset + 1]),
|
|
54
|
-
Number(match[offset + 2])
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
/** The lowest release `spec` accepts, when it is a shape this check reads. */
|
|
58
|
-
function readFloor(spec) {
|
|
59
|
-
const bounded = BOUNDED_RANGE.exec(spec);
|
|
60
|
-
if (bounded) return toVersion(bounded, 1);
|
|
61
|
-
const single = SINGLE_VERSION.exec(spec);
|
|
62
|
-
return single ? toVersion(single, 1) : void 0;
|
|
63
|
-
}
|
|
64
|
-
function compareVersions(a, b) {
|
|
65
|
-
return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
66
|
-
}
|
|
67
|
-
/** A range is accepted when it is bounded for its role and admits the interface this package builds against. */
|
|
68
|
-
function isAcceptedRange(spec, role, local) {
|
|
69
|
-
const bounded = BOUNDED_RANGE.exec(spec);
|
|
70
|
-
if (!bounded) return false;
|
|
71
|
-
const floor = toVersion(bounded, 1);
|
|
72
|
-
const ceiling = toVersion(bounded, 4);
|
|
73
|
-
if (!sameVersion(ceiling, rangeCeiling(floor, role))) return false;
|
|
74
|
-
return local === void 0 || compareVersions(local, floor) >= 0 && compareVersions(local, ceiling) < 0;
|
|
75
|
-
}
|
|
76
|
-
function isLocalSpec(spec) {
|
|
77
|
-
return LOCAL_SPEC_PREFIXES.some((prefix) => spec.startsWith(prefix));
|
|
78
|
-
}
|
|
79
|
-
/** The version of each named package among `manifests`, the packages that sit in the same repository. */
|
|
80
|
-
function localVersions(manifests) {
|
|
81
|
-
const versions = /* @__PURE__ */ new Map();
|
|
82
|
-
for (const { name, version } of manifests) if (name && version) versions.set(name, version);
|
|
83
|
-
return versions;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* `localVersions` holds the versions of the packages that sit in the same
|
|
87
|
-
* repository. An implemented interface is usually one of them, and its
|
|
88
|
-
* version, rather than the declared floor, decides the minor to stop below.
|
|
89
|
-
*/
|
|
90
|
-
function checkInterfaceRanges(manifest, localVersions = /* @__PURE__ */ new Map()) {
|
|
91
|
-
const implemented = new Set(manifest.antelopeJs?.implements ?? []);
|
|
92
|
-
const violations = [];
|
|
93
|
-
for (const field of CHECKED_FIELDS) for (const [name, spec] of Object.entries(manifest[field] ?? {})) {
|
|
94
|
-
if (!name.startsWith(INTERFACE_PACKAGE_PREFIX) || isLocalSpec(spec)) continue;
|
|
95
|
-
const role = implemented.has(name) ? "implementer" : "consumer";
|
|
96
|
-
const localVersion = localVersions.get(name);
|
|
97
|
-
const local = role === "implementer" && localVersion !== void 0 ? readFloor(localVersion) : void 0;
|
|
98
|
-
if (isAcceptedRange(spec, role, local)) continue;
|
|
99
|
-
const floor = local ?? readFloor(spec);
|
|
100
|
-
violations.push({
|
|
101
|
-
field,
|
|
102
|
-
name,
|
|
103
|
-
spec,
|
|
104
|
-
role,
|
|
105
|
-
expected: floor ? expectedRange(floor, role) : void 0
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
return violations;
|
|
109
|
-
}
|
|
110
|
-
function describeViolation(violation) {
|
|
111
|
-
const { field, name, spec, role, expected } = violation;
|
|
112
|
-
const fix = expected ? `use "${expected}"` : role === "implementer" ? "declare it as >=<floor> <next minor>" : "declare it as >=<floor> <1.0.0";
|
|
113
|
-
return `${field}["${name}"] is "${spec}": ${role === "implementer" ? "this package implements it, so it must stop below the next minor" : "it must accept every release up to the next breaking one"}; ${fix}`;
|
|
114
|
-
}
|
|
115
|
-
//#endregion
|
|
116
|
-
export { describeViolation as n, localVersions as r, checkInterfaceRanges as t };
|