@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as parseManifest } from "./package-
|
|
1
|
+
import { s as parseManifest } from "./package-DDG3YH7W.mjs";
|
|
2
2
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { isMap, isScalar, isSeq, parseDocument } from "yaml";
|
|
@@ -210,7 +210,6 @@ const LOCKFILE = "pnpm-lock.yaml";
|
|
|
210
210
|
const REQUIREMENTS_HEADING = /^##\s+Requirements\s*$/i;
|
|
211
211
|
const SCOPE = "@antelopejs/";
|
|
212
212
|
const UNRESOLVED = "—";
|
|
213
|
-
const WORKSPACE = "workspace";
|
|
214
213
|
const LEGACY_MARKER = /^<!--\s*docs-compat:\s*\.\/package\.json#\w+\s*-->\s*$/;
|
|
215
214
|
const COMPATIBILITY_HEADING = /^##\s+Compatibility\s*$/i;
|
|
216
215
|
const RESOLVED_SECTIONS = [
|
|
@@ -373,8 +372,13 @@ function declaredRanges(manifest) {
|
|
|
373
372
|
function readManifest(root, directory) {
|
|
374
373
|
return parseManifest(readFileSync(join(root, directory, "package.json"), "utf8"));
|
|
375
374
|
}
|
|
376
|
-
/** The version
|
|
377
|
-
function
|
|
375
|
+
/** The version a `link:` path, relative to the linking package's directory, names in the linked package's `package.json`. */
|
|
376
|
+
function linkedVersion(root, directory, link) {
|
|
377
|
+
const path = join(root, directory, link, "package.json");
|
|
378
|
+
return existsSync(path) ? parseManifest(readFileSync(path, "utf8")).version : void 0;
|
|
379
|
+
}
|
|
380
|
+
/** The version the lockfile resolves for a dependency; a `link:` resolves to the linked workspace package's version. */
|
|
381
|
+
function resolvedVersion(root, { document, importer, directory }, name) {
|
|
378
382
|
for (const section of RESOLVED_SECTIONS) {
|
|
379
383
|
const entry = document.getIn([
|
|
380
384
|
"importers",
|
|
@@ -385,7 +389,7 @@ function resolvedVersion({ document, importer }, name) {
|
|
|
385
389
|
const version = isMap(entry) ? entry.get("version", true) : entry;
|
|
386
390
|
if (!isScalar(version)) continue;
|
|
387
391
|
const resolved = String(version.value).split("(")[0];
|
|
388
|
-
return resolved.startsWith("link:") ?
|
|
392
|
+
return resolved.startsWith("link:") ? linkedVersion(root, directory, resolved.slice(5)) : resolved;
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
395
|
const UNSHARED_NPMRC = /^\s*shared-workspace-lockfile\s*=\s*false\s*(?:[#;].*)?$/m;
|
|
@@ -406,7 +410,8 @@ function readLock(root, shared, directory, documents) {
|
|
|
406
410
|
const document = documents.get(path);
|
|
407
411
|
return document && {
|
|
408
412
|
document,
|
|
409
|
-
importer: shared ? directory || "." : "."
|
|
413
|
+
importer: shared ? directory || "." : ".",
|
|
414
|
+
directory
|
|
410
415
|
};
|
|
411
416
|
}
|
|
412
417
|
/** Adds one package's `docs-files` lines and, when it needs one, its README with the generated blocks. */
|
|
@@ -422,7 +427,7 @@ function planPackage(root, plan, lock, standard, { directory, name, ranges, publ
|
|
|
422
427
|
const rows = [...ranges].map(([name, supported]) => ({
|
|
423
428
|
name,
|
|
424
429
|
supported,
|
|
425
|
-
tested: lock && resolvedVersion(lock, name)
|
|
430
|
+
tested: lock && resolvedVersion(root, lock, name)
|
|
426
431
|
}));
|
|
427
432
|
try {
|
|
428
433
|
const withRequirements = nodeRange !== void 0 && current !== void 0 ? placeNodeBlock(current, nodeBlock(nodeRange)) : current;
|
|
@@ -439,7 +444,7 @@ function planPackage(root, plan, lock, standard, { directory, name, ranges, publ
|
|
|
439
444
|
* Plans the docs-compat block of the root and of every workspace package that is not private and declares an
|
|
440
445
|
* `@antelopejs/*` peer, runtime or optional dependency, and the `docs-files` lines covering the root and every workspace
|
|
441
446
|
* package that is not private.
|
|
442
|
-
* Tested with comes from pnpm-lock.yaml, each package's own when `shared-workspace-lockfile=false`, and is
|
|
447
|
+
* Tested with comes from pnpm-lock.yaml, each package's own when `shared-workspace-lockfile=false`, and is the linked package's version for a `link:` dependency; other package managers get a dash.
|
|
443
448
|
*/
|
|
444
449
|
function planDocs(root, manager) {
|
|
445
450
|
const rootManifest = readManifest(root, "");
|
package/dist/eslint.d.mts
CHANGED
|
@@ -9,12 +9,21 @@ interface AntelopeNuxtConfigOptions {
|
|
|
9
9
|
rules?: NuxtRules;
|
|
10
10
|
/**
|
|
11
11
|
* Runs the type-aware rules of the oxlint preset on `.vue` script blocks,
|
|
12
|
-
* which oxlint-tsgolint cannot read
|
|
12
|
+
* which oxlint-tsgolint cannot read, along with the guardrail rules
|
|
13
|
+
* `antelopejs/no-unsafe-object-assign` and
|
|
14
|
+
* `antelopejs/require-tsconfig-include`; TypeScript files stay with oxlint.
|
|
13
15
|
* `tsconfigRootDir` is the project root, usually `import.meta.dirname`.
|
|
14
16
|
* Each `.vue` file must be listed by its nearest `tsconfig.json`, or it
|
|
15
|
-
* fails to parse.
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
17
|
+
* fails to parse. In a Nuxt layer that tsconfig extends the generated
|
|
18
|
+
* `.nuxt/tsconfig.json`, which carries the `paths` of the layer's aliases,
|
|
19
|
+
* and the lint script runs `nuxt prepare` first so it exists. An import the
|
|
20
|
+
* tsconfig cannot resolve, such as `#dms-core/user` without those `paths`,
|
|
21
|
+
* is reported by `antelopejs/require-tsconfig-include`, because everything
|
|
22
|
+
* imported through it is an error type. Without Volar, a type imported
|
|
23
|
+
* from another `.vue` file is an error type, which the `no-unsafe-*` rules
|
|
24
|
+
* report, and a `lang="tsx"` block fails to parse.
|
|
25
|
+
* `antelopejs/no-unsafe-object-assign` skips a component with `generic`
|
|
26
|
+
* type parameters.
|
|
18
27
|
*/
|
|
19
28
|
typeAware?: {
|
|
20
29
|
tsconfigRootDir: string;
|
package/dist/eslint.mjs
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { t as TYPE_AWARE_RULES } from "./type-aware-rules-
|
|
1
|
+
import { n as typeAwareRuleSetting, t as TYPE_AWARE_RULES } from "./type-aware-rules-Da3769fI.mjs";
|
|
2
|
+
import { t as guardrailsPlugin } from "./guardrails-BfGwehVj.mjs";
|
|
2
3
|
import { createConfigForNuxt } from "@nuxt/eslint-config/flat";
|
|
3
4
|
//#region src/eslint.ts
|
|
5
|
+
/** Whether every rule of `plugin` has the `create` function ESLint calls, which `eslintCompatPlugin` gives each oxlint rule. */
|
|
6
|
+
function isEslintPlugin(plugin) {
|
|
7
|
+
return Object.values(plugin.rules).every((rule) => rule.create !== void 0);
|
|
8
|
+
}
|
|
9
|
+
/** The guardrail rules as ESLint registers them. */
|
|
10
|
+
function eslintGuardrails() {
|
|
11
|
+
if (!isEslintPlugin(guardrailsPlugin)) throw new Error("A guardrails rule has no `create` function for ESLint");
|
|
12
|
+
return guardrailsPlugin;
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* The shared rules for a Nuxt layer. oxlint runs no Vue template rule and no
|
|
6
16
|
* type-aware rule on `.vue` files, so the front end stays on ESLint, and
|
|
@@ -15,9 +25,25 @@ const ANTELOPE_NUXT_RULES = {
|
|
|
15
25
|
/** Import order follows side-effectful setup and belongs to the formatter. */
|
|
16
26
|
"import/first": "off",
|
|
17
27
|
"import/order": "off",
|
|
18
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Single-word pages are intentional. The Vue 3 style guide asks no default
|
|
30
|
+
* of a type-based optional prop, whose absence can carry meaning.
|
|
31
|
+
*/
|
|
19
32
|
"vue/multi-word-component-names": "off",
|
|
20
33
|
"vue/require-default-prop": "off",
|
|
34
|
+
/**
|
|
35
|
+
* TypeScript reports unreachable code only under
|
|
36
|
+
* `allowUnreachableCode: false`, which no layer sets.
|
|
37
|
+
*/
|
|
38
|
+
"no-unreachable": "error",
|
|
39
|
+
/** A best-effort cleanup swallows its failure in an empty `catch`. */
|
|
40
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
41
|
+
/**
|
|
42
|
+
* The formatter writes a void element as `<input />` and a hex literal in
|
|
43
|
+
* lower case, so these rules agree with it or stay off.
|
|
44
|
+
*/
|
|
45
|
+
"vue/html-self-closing": ["error", { html: { void: "always" } }],
|
|
46
|
+
"unicorn/number-literal-case": "off",
|
|
21
47
|
/** CMS blocks and forms require structural types in the interface layer. */
|
|
22
48
|
"@typescript-eslint/no-explicit-any": "off",
|
|
23
49
|
"@typescript-eslint/no-empty-object-type": "off",
|
|
@@ -31,6 +57,11 @@ const ANTELOPE_NUXT_RULES = {
|
|
|
31
57
|
}]
|
|
32
58
|
};
|
|
33
59
|
/**
|
|
60
|
+
* The script files that also get the `nuxt/vue/rules` rules, so a composable
|
|
61
|
+
* keeps `vue/no-ref-as-operand` and the other script checks.
|
|
62
|
+
*/
|
|
63
|
+
const SCRIPT_FILES = ["**/*.?([cm])[jt]s?(x)"];
|
|
64
|
+
/**
|
|
34
65
|
* ESLint config for an AntelopeJS Nuxt layer.
|
|
35
66
|
*
|
|
36
67
|
* @example
|
|
@@ -60,10 +91,15 @@ function antelopeNuxtConfig(options = {}) {
|
|
|
60
91
|
projectService: true,
|
|
61
92
|
tsconfigRootDir: options.typeAware.tsconfigRootDir
|
|
62
93
|
} },
|
|
63
|
-
|
|
94
|
+
plugins: { antelopejs: eslintGuardrails() },
|
|
95
|
+
rules: {
|
|
96
|
+
...Object.fromEntries(TYPE_AWARE_RULES.map((rule) => [`@typescript-eslint/${rule}`, typeAwareRuleSetting(rule)])),
|
|
97
|
+
"antelopejs/no-unsafe-object-assign": "error",
|
|
98
|
+
"antelopejs/require-tsconfig-include": "error"
|
|
99
|
+
}
|
|
64
100
|
});
|
|
65
|
-
return composer.onResolved((configs) => configs.
|
|
66
|
-
if (config.rules === void 0) return config;
|
|
101
|
+
return composer.onResolved((configs) => configs.flatMap((config) => {
|
|
102
|
+
if (config.rules === void 0) return [config];
|
|
67
103
|
const rules = { ...config.rules };
|
|
68
104
|
for (const [name, original] of Object.entries(rules)) {
|
|
69
105
|
const rule = overrides[name] === void 0 ? original : overrides[name];
|
|
@@ -72,10 +108,16 @@ function antelopeNuxtConfig(options = {}) {
|
|
|
72
108
|
else if (Array.isArray(rule) && (rule[0] === "warn" || rule[0] === 1)) rules[name] = ["error", ...rule.slice(1)];
|
|
73
109
|
else rules[name] = rule;
|
|
74
110
|
}
|
|
75
|
-
|
|
111
|
+
const resolved = {
|
|
76
112
|
...config,
|
|
77
113
|
rules
|
|
78
114
|
};
|
|
115
|
+
if (config.name !== "nuxt/vue/rules") return [resolved];
|
|
116
|
+
return [resolved, {
|
|
117
|
+
name: "antelopejs/vue-script",
|
|
118
|
+
files: SCRIPT_FILES,
|
|
119
|
+
rules: Object.fromEntries(Object.entries(rules).filter(([name]) => name.startsWith("vue/")))
|
|
120
|
+
}];
|
|
79
121
|
}));
|
|
80
122
|
}
|
|
81
123
|
//#endregion
|