@antelopejs/tooling-configs 0.7.0 → 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.
@@ -0,0 +1,18 @@
1
+ import { c as object, t as child, u as optStr } from "./json-CG2L7YFl.mjs";
2
+ //#region src/garden/npm.ts
3
+ const TOOLING_PACKAGE = "@antelopejs/tooling-configs";
4
+ function distTags(packument) {
5
+ return child(object(packument, "packument"), "dist-tags");
6
+ }
7
+ function tagVersion(packument, tag) {
8
+ return optStr(distTags(packument), tag);
9
+ }
10
+ /** The `latest` dist-tag of tooling-configs. */
11
+ async function tooling(context) {
12
+ const packument = await context.packument(TOOLING_PACKAGE);
13
+ const latest = packument === void 0 ? void 0 : tagVersion(packument, "latest");
14
+ if (latest === void 0) throw new Error(`${TOOLING_PACKAGE} has no latest version on npm.`);
15
+ return latest;
16
+ }
17
+ //#endregion
18
+ export { tagVersion as n, tooling as r, TOOLING_PACKAGE as t };
@@ -1,6 +1,6 @@
1
1
  import { n as TEST_FILE_GLOBS, t as ASSERTION_FUNCTION_NAMES } from "../../shared-BG0Nkzh0.mjs";
2
2
  //#region src/oxc/guardrails/index.d.ts
3
- /** AntelopeJS rules that reject comments, inherited-key lookups, presence-only type guards, inserts that follow a read of the same table or that a called function makes once an awaited read found nothing, unrun interface-database queries an awaited function returns, unchecked Object.assign writes, low-evidence tests, files no tsconfig lists and tsconfigs that list no `types`. */
3
+ /** AntelopeJS rules that reject comments, inherited-key lookups, presence-only type guards, inserts that follow a read of the same table or that a called function makes once an awaited read found nothing, unrun interface-database queries an awaited function returns, unchecked Object.assign writes, `any` assigned, passed or returned in a Vue script, low-evidence tests, files no tsconfig lists and tsconfigs that list no `types`. */
4
4
  declare const guardrailsPlugin: import("@oxlint/plugins").Plugin;
5
5
  //#endregion
6
6
  export { ASSERTION_FUNCTION_NAMES, TEST_FILE_GLOBS, guardrailsPlugin as default };
@@ -1,3 +1,3 @@
1
1
  import { n as TEST_FILE_GLOBS, t as ASSERTION_FUNCTION_NAMES } from "../../shared-WC0z3y9F.mjs";
2
- import { t as guardrailsPlugin } from "../../guardrails-BfGwehVj.mjs";
2
+ import { t as guardrailsPlugin } from "../../guardrails-PoMIcyGb.mjs";
3
3
  export { ASSERTION_FUNCTION_NAMES, TEST_FILE_GLOBS, guardrailsPlugin as default };
@@ -37,8 +37,10 @@ interface AntelopePresetOptions {
37
37
  /**
38
38
  * Type-aware rules. Defaults to true. Consumers must also set options.typeAware
39
39
  * in their root config because oxlint never reads that field from extends.
40
- * oxlint-tsgolint reads only TypeScript files, so `.vue` script blocks get
41
- * these rules from `antelopeNuxtConfig({ typeAware })` in ESLint instead.
40
+ * oxlint-tsgolint reads only TypeScript files, so in `.vue` script blocks
41
+ * `antelopejs/no-unsafe-any-in-vue` runs the `typescript/no-unsafe-*`
42
+ * checks, and `antelopeNuxtConfig({ typeAware })` runs every type-aware rule
43
+ * in ESLint.
42
44
  */
43
45
  typeAware?: boolean;
44
46
  }
@@ -142,6 +144,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
142
144
  rules: {
143
145
  [k: string]: "error" | ["error", {
144
146
  checkUnknown: boolean;
147
+ ignoredTypeNames: string[];
145
148
  }];
146
149
  };
147
150
  } | {
@@ -199,6 +202,7 @@ declare function antelopePreset(options?: AntelopePresetOptions): {
199
202
  }[];
200
203
  rules: {
201
204
  "antelopejs/no-unrun-query": "off" | "error";
205
+ "antelopejs/no-unsafe-any-in-vue": "off" | "error";
202
206
  "antelopejs/no-unsafe-object-assign": "off" | "error";
203
207
  "antelopejs/require-tsconfig-include": "off" | "error";
204
208
  "antelopejs/require-tsconfig-types": "off" | "error";
package/dist/oxc/lint.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { i as findGitRoot } from "../ceilings-B7KayYIG.mjs";
2
2
  import { t as readCarriedCeilings } from "../renames-L2owF5GD.mjs";
3
3
  import { t as PRESET_CONFIGS } from "../templates-HG0fel2S.mjs";
4
- import { n as typeAwareRuleSetting, t as TYPE_AWARE_RULES } from "../type-aware-rules-Da3769fI.mjs";
4
+ import { n as typeAwareRuleSetting, t as TYPE_AWARE_RULES } from "../type-aware-rules-BxhHbizU.mjs";
5
5
  import { n as TEST_FILE_GLOBS, t as ASSERTION_FUNCTION_NAMES } from "../shared-WC0z3y9F.mjs";
6
6
  import { n as IGNORE_PATTERNS, r as SYNCED_AGENT_PATTERNS } from "../shared-BCFFyp3l.mjs";
7
7
  import { defineConfig } from "oxlint";
@@ -155,6 +155,7 @@ function guardrailsPreset(typeAware) {
155
155
  }],
156
156
  rules: {
157
157
  "antelopejs/no-unrun-query": typeAware ? "error" : "off",
158
+ "antelopejs/no-unsafe-any-in-vue": typeAware ? "error" : "off",
158
159
  "antelopejs/no-unsafe-object-assign": typeAware ? "error" : "off",
159
160
  "antelopejs/require-tsconfig-include": typeAware ? "error" : "off",
160
161
  "antelopejs/require-tsconfig-types": typeAware ? "error" : "off"
@@ -35,7 +35,11 @@ function parseReport(text) {
35
35
  return report.diagnostics;
36
36
  }
37
37
  function toDiagnostic(item, root) {
38
- const rule = ruleId(item.code ?? "");
38
+ if (item.code === void 0 || item.code === "") {
39
+ const where = item.filename === void 0 ? "" : `${repositoryPath(root, item.filename)}: `;
40
+ throw new Error(`${where}${item.message}. Fix this parser or configuration error before measuring.`);
41
+ }
42
+ const rule = ruleId(item.code);
39
43
  if (item.filename === void 0) throw new Error(`oxlint reported ${rule} with no file: ${item.message}`);
40
44
  const file = repositoryPath(root, item.filename);
41
45
  const span = item.labels?.[0]?.span;
@@ -0,0 +1,40 @@
1
+ import { t as runCommand } from "./run-command-BlFRPORx.mjs";
2
+ //#region src/guardrails/pack-tarball.ts
3
+ /** The flag that stops `pack` from running lifecycle scripts, by package manager. */
4
+ const IGNORE_SCRIPTS = {
5
+ pnpm: "--config.ignore-scripts=true",
6
+ npm: "--ignore-scripts"
7
+ };
8
+ /**
9
+ * The arguments to `manager` that pack the package in the working directory into `destination`, in order: its `prepack`
10
+ * through `<manager> run`, which uses the configured script shell, then `<manager> pack` with lifecycle scripts off,
11
+ * since `pnpm pack` runs them through cmd.exe on Windows whatever the script shell, so a POSIX `prepare` fails there.
12
+ * Stop at the first that fails.
13
+ */
14
+ function packSteps(manager, destination) {
15
+ return [[
16
+ "run",
17
+ "--if-present",
18
+ "prepack"
19
+ ], [
20
+ "pack",
21
+ IGNORE_SCRIPTS[manager],
22
+ "--pack-destination",
23
+ destination
24
+ ]];
25
+ }
26
+ /** Packs the package in `cwd` into `destination` through {@link packSteps}. Returns the first failed command, else the pack. */
27
+ async function packTarball(manager, cwd, destination, signal) {
28
+ const [prepackArgs, packArgs] = packSteps(manager, destination);
29
+ const prepack = await runCommand(manager, prepackArgs, {
30
+ cwd,
31
+ signal
32
+ });
33
+ if (prepack.status !== 0) return prepack;
34
+ return runCommand(manager, packArgs, {
35
+ cwd,
36
+ signal
37
+ });
38
+ }
39
+ //#endregion
40
+ export { packTarball as n, packSteps as t };
@@ -2,7 +2,7 @@ import { a as formatCeilings, c as parseCeilings, n as MAX_FILE_BYTES, o as isPa
2
2
  import { n as renamedPaths, t as readCarriedCeilings } from "./renames-L2owF5GD.mjs";
3
3
  import { f as toolingVersions } from "./package-DDG3YH7W.mjs";
4
4
  import { n as authoredSizes, o as isAgentFile, r as changedFiles, t as LINT_CONFIG } from "./files-C-JJhExM.mjs";
5
- import { n as lintDiagnostics } from "./oxlint-CkHhK5K_.mjs";
5
+ import { n as lintDiagnostics } from "./oxlint-CIeonWMB.mjs";
6
6
  import "./suppression-budget-CPDSFg4X.mjs";
7
7
  import { n as sizeFailure } from "./size-CCGLY4Ke.mjs";
8
8
  import { copyFileSync, existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
@@ -22,6 +22,7 @@ const PACK_NEW_RULES = /* @__PURE__ */ new Map([
22
22
  ["antelopejs/no-presence-only-type-guard", "0.2.17"],
23
23
  ["antelopejs/no-read-then-insert", "0.5.1"],
24
24
  ["antelopejs/no-unrun-query", "0.6.0"],
25
+ ["antelopejs/no-unsafe-any-in-vue", "0.7.1"],
25
26
  ["antelopejs/no-unsafe-object-assign", "0.4.2"],
26
27
  ["antelopejs/require-tsconfig-include", "0.2.18"],
27
28
  ["antelopejs/require-tsconfig-types", "0.4.2"],
@@ -29,10 +29,23 @@ const TYPE_AWARE_RULES = [
29
29
  /**
30
30
  * The setting a type-aware rule runs at. `no-base-to-string` pins
31
31
  * `checkUnknown: false`, typescript-eslint's default, so `String(value)` on an
32
- * `unknown` stays allowed if a release changes that default.
32
+ * `unknown` stays allowed if a release changes that default. It adds `{}` to
33
+ * the default `ignoredTypeNames`, so the same call stays allowed once `null`
34
+ * and `undefined` checks narrow the `unknown` to `{}`. Every other value typed
35
+ * `{}` is skipped too: one declared `{}`, the empty literal, a `T extends {}`,
36
+ * a union holding `{}`, and a `NonNullable<T>` or `T & {}` over a generic.
33
37
  */
34
38
  function typeAwareRuleSetting(rule) {
35
- return rule === "no-base-to-string" ? ["error", { checkUnknown: false }] : "error";
39
+ return rule === "no-base-to-string" ? ["error", {
40
+ checkUnknown: false,
41
+ ignoredTypeNames: [
42
+ "Error",
43
+ "RegExp",
44
+ "URL",
45
+ "URLSearchParams",
46
+ "{}"
47
+ ]
48
+ }] : "error";
36
49
  }
37
50
  //#endregion
38
51
  export { typeAwareRuleSetting as n, TYPE_AWARE_RULES as t };
@@ -1,7 +1,7 @@
1
1
  import { s as parseManifest } from "./package-DDG3YH7W.mjs";
2
2
  import { n as installedCompilerDefaults, r as installedTypeScriptMajor } from "./installed-typescript-6MtIWlE4.mjs";
3
3
  import { u as trackedManifests } from "./files-C-JJhExM.mjs";
4
- import { n as workspaceDirectories, r as workspacePatterns } from "./docs-compat-CSljVi3O.mjs";
4
+ import { n as workspaceDirectories, r as workspacePatterns } from "./docs-compat-BAZiPLZt.mjs";
5
5
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
6
  import { dirname, join, matchesGlob, relative, resolve, sep } from "node:path";
7
7
  import ts from "@typescript/typescript6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/tooling-configs",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
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",