Skip to content

Commit 3fbdeba

Browse files
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.
1 parent f834d02 commit 3fbdeba

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

‎_tools/check_mod_exports.ts‎

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Copyright 2018-2026 the Deno authors. MIT license.
33

44
import { walk } from "../fs/walk.ts";
5+
import { basename } from "../path/basename.ts";
56
import { relative } from "../path/relative.ts";
67
import { dirname } from "../path/dirname.ts";
78
import * as colors from "../fmt/colors.ts";
@@ -11,6 +12,28 @@ import { fromFileUrl } from "@std/path/from-file-url";
1112

1213
const FAIL_FAST = Deno.args.includes("--fail-fast");
1314

15+
const ROOT = fromFileUrl(new URL("../", import.meta.url));
16+
17+
// Matched against paths relative to ROOT, with `/` separators.
18+
const SKIP = [
19+
/unstable/,
20+
/^dotenv\/load\.ts$/,
21+
/^front_matter\/yaml\.ts$/,
22+
/^front_matter\/json\.ts$/,
23+
/^front_matter\/toml\.ts$/,
24+
/^front_matter\/any\.ts$/,
25+
/^uuid\/v1\.ts$/,
26+
/^uuid\/v3\.ts$/,
27+
/^uuid\/v4\.ts$/,
28+
/^uuid\/v5\.ts$/,
29+
/^uuid\/v7\.ts$/,
30+
/_test\.ts$/,
31+
/_bench\.ts$/,
32+
/\.d\.ts$/,
33+
/\/_/,
34+
/\/mod\.ts$/,
35+
];
36+
1437
let shouldFail = false;
1538

1639
const MOD_FILE_PATHS = (await getEntrypoints())
@@ -24,7 +47,7 @@ for (const modFilePath of MOD_FILE_PATHS) {
2447
modSource,
2548
ts.ScriptTarget.Latest,
2649
);
27-
const modExportSpecifiers = new Set();
50+
const modExportSpecifiers = new Set<string>();
2851
modSourceFile.forEachChild((node) => {
2952
if (
3053
ts.isExportDeclaration(node) &&
@@ -40,29 +63,12 @@ for (const modFilePath of MOD_FILE_PATHS) {
4063
exts: [".ts"],
4164
includeDirs: false,
4265
maxDepth: 1,
43-
skip: [
44-
/unstable/,
45-
/dotenv(\/|\\)load\.ts$/,
46-
/front_matter(\/|\\)yaml\.ts$/,
47-
/front_matter(\/|\\)json\.ts$/,
48-
/front_matter(\/|\\)toml\.ts$/,
49-
/front_matter(\/|\\)any\.ts$/,
50-
/uuid(\/|\\)v1\.ts$/,
51-
/uuid(\/|\\)v3\.ts$/,
52-
/uuid(\/|\\)v4\.ts$/,
53-
/uuid(\/|\\)v5\.ts$/,
54-
/uuid(\/|\\)v6\.ts$/,
55-
/uuid(\/|\\)v7\.ts$/,
56-
/_test\.ts$/,
57-
/_bench\.ts$/,
58-
/\.d\.ts$/,
59-
/(\/|\\)_/,
60-
/mod\.ts$/,
61-
],
6266
})
6367
) {
64-
const relativeSpecifier = relative(modFilePath, filePath).slice(1)
65-
.replaceAll("\\", "/");
68+
const relativePath = relative(ROOT, filePath).replaceAll("\\", "/");
69+
if (SKIP.some((pattern) => pattern.test(relativePath))) continue;
70+
71+
const relativeSpecifier = `./${basename(filePath)}`;
6672

6773
if (!modExportSpecifiers.has(relativeSpecifier)) {
6874
if (

0 commit comments

Comments
 (0)