[precommit hook] resolve relative file paths from cwd (#52157)

This commit is contained in:
Spencer 2019-12-05 09:08:01 -07:00 committed by GitHub
parent 3c55e55b7a
commit 8122b8b908
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,8 +19,6 @@
import { dirname, extname, join, relative, resolve, sep } from 'path';
import { REPO_ROOT } from './constants';
export class File {
private path: string;
private relativePath: string;
@ -28,7 +26,7 @@ export class File {
constructor(path: string) {
this.path = resolve(path);
this.relativePath = relative(REPO_ROOT, this.path);
this.relativePath = relative(process.cwd(), this.path);
this.ext = extname(this.path);
}