From 0e54c5154f34a1821ec839260344aec99844f481 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 13 Aug 2024 10:47:03 -0700 Subject: [PATCH 1/3] Revert unix-style warning --- packages/compiler/src/config/config-loader.ts | 14 +++++------ .../compiler/src/core/schema-validator.ts | 25 ++++++------------- .../test/core/emitter-options.test.ts | 3 ++- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/packages/compiler/src/config/config-loader.ts b/packages/compiler/src/config/config-loader.ts index be487838ca..fad9997534 100644 --- a/packages/compiler/src/config/config-loader.ts +++ b/packages/compiler/src/config/config-loader.ts @@ -260,13 +260,13 @@ function validatePathAbsolute( target: target === NoTarget ? target : getLocationInYamlScript(target.file, target.path), }); } - if (path.includes("\\")) { - return createDiagnostic({ - code: "path-unix-style", - format: { path }, - target: target === NoTarget ? target : getLocationInYamlScript(target.file, target.path), - }); - } + // if (path.includes("\\")) { + // return createDiagnostic({ + // code: "path-unix-style", + // format: { path }, + // target: target === NoTarget ? target : getLocationInYamlScript(target.file, target.path), + // }); + // } return undefined; } diff --git a/packages/compiler/src/core/schema-validator.ts b/packages/compiler/src/core/schema-validator.ts index 4c3a2894c1..b11ee8b047 100644 --- a/packages/compiler/src/core/schema-validator.ts +++ b/packages/compiler/src/core/schema-validator.ts @@ -22,9 +22,9 @@ function absolutePathStatus(path: string): "valid" | "not-absolute" | "windows-s if (path.startsWith(".") || !isPathAbsolute(path)) { return "not-absolute"; } - if (path.includes("\\")) { - return "windows-style"; - } + // if (path.includes("\\")) { + // return "windows-style"; + // } return "valid"; } @@ -75,20 +75,11 @@ function ajvErrorToDiagnostic( const tspTarget = resolveTarget(error, target); if (error.params.format === "absolute-path") { const value = getErrorValue(obj, error) as any; - const status = absolutePathStatus(value); - if (status === "windows-style") { - return createDiagnostic({ - code: "path-unix-style", - format: { path: value }, - target: tspTarget, - }); - } else { - return createDiagnostic({ - code: "config-path-absolute", - format: { path: value }, - target: tspTarget, - }); - } + return createDiagnostic({ + code: "config-path-absolute", + format: { path: value }, + target: tspTarget, + }); } const messageLines = [`Schema violation: ${error.message} (${error.instancePath || "/"})`]; diff --git a/packages/compiler/test/core/emitter-options.test.ts b/packages/compiler/test/core/emitter-options.test.ts index b4ea88c8d9..1e21be1f13 100644 --- a/packages/compiler/test/core/emitter-options.test.ts +++ b/packages/compiler/test/core/emitter-options.test.ts @@ -118,7 +118,8 @@ describe("compiler: emitter options", () => { }); }); - it("emit diagnostic if passing windows style path", async () => { + // This was disabled + it.skip("emit diagnostic if passing windows style path", async () => { const diagnostics = await diagnoseEmitterOptions({ "asset-dir": "C:\\abc\\def", }); From 862f8cd42ae206e74a9012c35757036924b287ec Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 13 Aug 2024 10:50:32 -0700 Subject: [PATCH 2/3] . --- packages/compiler/test/core/emitter-options.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compiler/test/core/emitter-options.test.ts b/packages/compiler/test/core/emitter-options.test.ts index 1e21be1f13..ae51a51f69 100644 --- a/packages/compiler/test/core/emitter-options.test.ts +++ b/packages/compiler/test/core/emitter-options.test.ts @@ -118,7 +118,7 @@ describe("compiler: emitter options", () => { }); }); - // This was disabled + // This was disabled due to making it impossible to use windows path via the cli https://github.com/microsoft/typespec/pull/4173 it.skip("emit diagnostic if passing windows style path", async () => { const diagnostics = await diagnoseEmitterOptions({ "asset-dir": "C:\\abc\\def", From ff271d5e6ddedf26a7410abfe5104bf6383e8f78 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Tue, 13 Aug 2024 10:51:03 -0700 Subject: [PATCH 3/3] Create fix-revert-unix-path-warning-2024-7-13-17-50-15.md --- .../fix-revert-unix-path-warning-2024-7-13-17-50-15.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .chronus/changes/fix-revert-unix-path-warning-2024-7-13-17-50-15.md diff --git a/.chronus/changes/fix-revert-unix-path-warning-2024-7-13-17-50-15.md b/.chronus/changes/fix-revert-unix-path-warning-2024-7-13-17-50-15.md new file mode 100644 index 0000000000..5837e2aff6 --- /dev/null +++ b/.chronus/changes/fix-revert-unix-path-warning-2024-7-13-17-50-15.md @@ -0,0 +1,8 @@ +--- +# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking +changeKind: fix +packages: + - "@typespec/compiler" +--- + +Fix: Revert `unix-style` warning that was preventing windows path via the CLI as well