From 3fbdeba37301709a0c6cda90f4e169424ef6fadd Mon Sep 17 00:00:00 2001 From: Tomas Zijdemans Date: Mon, 28 Sep 2026 19:36:24 +0200 Subject: [PATCH] chore(internal): stop `lint:mod-exports` skipping every file under some checkout paths The skip list is now matched against repo-relative paths, so a parent directory named `_something` or `*unstable*` no longer disables the check. Also anchors the `mod.ts` pattern so it can't skip `chmod.ts`, and removes the dead `uuid/v6.ts` entry. --- _tools/check_mod_exports.ts | 50 +++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/_tools/check_mod_exports.ts b/_tools/check_mod_exports.ts index e33f5f8ff963..ba5cbc1d04bd 100644 --- a/_tools/check_mod_exports.ts +++ b/_tools/check_mod_exports.ts @@ -2,6 +2,7 @@ // Copyright 2018-2026 the Deno authors. MIT license. import { walk } from "../fs/walk.ts"; +import { basename } from "../path/basename.ts"; import { relative } from "../path/relative.ts"; import { dirname } from "../path/dirname.ts"; import * as colors from "../fmt/colors.ts"; @@ -11,6 +12,28 @@ import { fromFileUrl } from "@std/path/from-file-url"; const FAIL_FAST = Deno.args.includes("--fail-fast"); +const ROOT = fromFileUrl(new URL("../", import.meta.url)); + +// Matched against paths relative to ROOT, with `/` separators. +const SKIP = [ + /unstable/, + /^dotenv\/load\.ts$/, + /^front_matter\/yaml\.ts$/, + /^front_matter\/json\.ts$/, + /^front_matter\/toml\.ts$/, + /^front_matter\/any\.ts$/, + /^uuid\/v1\.ts$/, + /^uuid\/v3\.ts$/, + /^uuid\/v4\.ts$/, + /^uuid\/v5\.ts$/, + /^uuid\/v7\.ts$/, + /_test\.ts$/, + /_bench\.ts$/, + /\.d\.ts$/, + /\/_/, + /\/mod\.ts$/, +]; + let shouldFail = false; const MOD_FILE_PATHS = (await getEntrypoints()) @@ -24,7 +47,7 @@ for (const modFilePath of MOD_FILE_PATHS) { modSource, ts.ScriptTarget.Latest, ); - const modExportSpecifiers = new Set(); + const modExportSpecifiers = new Set(); modSourceFile.forEachChild((node) => { if ( ts.isExportDeclaration(node) && @@ -40,29 +63,12 @@ for (const modFilePath of MOD_FILE_PATHS) { exts: [".ts"], includeDirs: false, maxDepth: 1, - skip: [ - /unstable/, - /dotenv(\/|\\)load\.ts$/, - /front_matter(\/|\\)yaml\.ts$/, - /front_matter(\/|\\)json\.ts$/, - /front_matter(\/|\\)toml\.ts$/, - /front_matter(\/|\\)any\.ts$/, - /uuid(\/|\\)v1\.ts$/, - /uuid(\/|\\)v3\.ts$/, - /uuid(\/|\\)v4\.ts$/, - /uuid(\/|\\)v5\.ts$/, - /uuid(\/|\\)v6\.ts$/, - /uuid(\/|\\)v7\.ts$/, - /_test\.ts$/, - /_bench\.ts$/, - /\.d\.ts$/, - /(\/|\\)_/, - /mod\.ts$/, - ], }) ) { - const relativeSpecifier = relative(modFilePath, filePath).slice(1) - .replaceAll("\\", "/"); + const relativePath = relative(ROOT, filePath).replaceAll("\\", "/"); + if (SKIP.some((pattern) => pattern.test(relativePath))) continue; + + const relativeSpecifier = `./${basename(filePath)}`; if (!modExportSpecifiers.has(relativeSpecifier)) { if (