Skip to content

Commit 6609b72

Browse files
xirzecCopilot
andcommitted
Derive allow-list paths from a single source of truth
APPROVED_DEPENDENCIES_RELATIVE_PATH and APPROVED_DEPENDENCIES_DISPLAY_PATH previously duplicated the path segments, so a rename could update one and miss the other. Derive both from a shared APPROVED_DEPENDENCIES_PATH_SEGMENTS array to prevent drift. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 475316b commit 6609b72

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

common/tools/eslint-plugin-azure-sdk/src/utils/approvedDependencies.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,23 @@ export const FIRST_PARTY_PREFIXES = [
2626
"@typespec/",
2727
] as const;
2828

29+
/**
30+
* The path segments, relative to the monorepo root, of the allow-list file.
31+
* Single source of truth so the platform-specific and display paths below
32+
* cannot drift apart if the location ever changes.
33+
*/
34+
const APPROVED_DEPENDENCIES_PATH_SEGMENTS = ["eng", "approved-third-party-dependencies.yml"];
35+
2936
/**
3037
* The path, relative to the monorepo root, of the allow-list file.
3138
*/
32-
export const APPROVED_DEPENDENCIES_RELATIVE_PATH = path.join(
33-
"eng",
34-
"approved-third-party-dependencies.yml",
35-
);
39+
export const APPROVED_DEPENDENCIES_RELATIVE_PATH = path.join(...APPROVED_DEPENDENCIES_PATH_SEGMENTS);
3640

3741
/**
3842
* The allow-list path as displayed in user-facing messages, always using
3943
* forward slashes regardless of platform.
4044
*/
41-
export const APPROVED_DEPENDENCIES_DISPLAY_PATH = "eng/approved-third-party-dependencies.yml";
45+
export const APPROVED_DEPENDENCIES_DISPLAY_PATH = APPROVED_DEPENDENCIES_PATH_SEGMENTS.join("/");
4246

4347
/**
4448
* The parsed and normalized allow-list.

0 commit comments

Comments
 (0)