Skip to content

Commit e7a72b9

Browse files
committed
refactor: simplify toPosixPath for the sake of coverage
1 parent 2ffc5bd commit e7a72b9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/rules/no-relative-packages.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import moduleVisitor, { makeOptionsSchema } from 'eslint-module-utils/moduleVisi
66
import importType from '../core/importType';
77
import docsUrl from '../docsUrl';
88

9-
/** @type {(filePath: string) => string} */
10-
const toPosixPath =
11-
path.sep === '\\'
12-
? (filePath) => filePath.replace(/\\/g, '/')
13-
: (filePath) => filePath;
9+
/** @param {string} filePath */
10+
function toPosixPath(filePath) {
11+
return filePath.replace(/\\/g, '/');
12+
}
1413

1514
function findNamedPackage(filePath) {
1615
const found = readPkgUp({ cwd: filePath });

0 commit comments

Comments
 (0)