From 1353935f77fb8ac05a12a2e3276e03f343a238c0 Mon Sep 17 00:00:00 2001 From: Arya Emami Date: Wed, 15 Jan 2025 13:08:22 -0600 Subject: [PATCH] fix(eslint-plugin-internal): `debug-namespace` on Windows --- packages/eslint-plugin-internal/src/rules/debug-namespace.ts | 2 +- packages/rule-tester/src/RuleTester.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin-internal/src/rules/debug-namespace.ts b/packages/eslint-plugin-internal/src/rules/debug-namespace.ts index 7aa735053f48..ca76f5e1870f 100755 --- a/packages/eslint-plugin-internal/src/rules/debug-namespace.ts +++ b/packages/eslint-plugin-internal/src/rules/debug-namespace.ts @@ -12,7 +12,7 @@ function filePathToNamespace(filePath: string) { const relativeNamespace = relativePath .replace(/^[\\/]/, '') - .replace(/(?:dist|lib|src)\//, '') + .replace(/(?:dist|lib|src)(\/|\\)/, '') .replace(/\.\w+$/, '') .replaceAll(/[^a-z0-9-]+/gi, ':'); diff --git a/packages/rule-tester/src/RuleTester.ts b/packages/rule-tester/src/RuleTester.ts index 71be9eb872fe..6553f88afe06 100644 --- a/packages/rule-tester/src/RuleTester.ts +++ b/packages/rule-tester/src/RuleTester.ts @@ -210,7 +210,7 @@ export class RuleTester extends TestFramework { // file name (`foo.ts`), don't change the base path. if ( filename != null && - (filename.startsWith('/') || filename.startsWith('..')) + (path.isAbsolute(filename) || filename.startsWith('..')) ) { basePath = path.parse( path.resolve(basePath ?? process.cwd(), filename),