Skip to content

Commit

Permalink
refactor: simplify toPosixPath for the sake of coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
forivall committed Feb 8, 2022
1 parent 2ffc5bd commit e7a72b9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/rules/no-relative-packages.js
Expand Up @@ -6,11 +6,10 @@ import moduleVisitor, { makeOptionsSchema } from 'eslint-module-utils/moduleVisi
import importType from '../core/importType';
import docsUrl from '../docsUrl';

/** @type {(filePath: string) => string} */
const toPosixPath =
path.sep === '\\'
? (filePath) => filePath.replace(/\\/g, '/')
: (filePath) => filePath;
/** @param {string} filePath */
function toPosixPath(filePath) {
return filePath.replace(/\\/g, '/');
}

function findNamedPackage(filePath) {
const found = readPkgUp({ cwd: filePath });
Expand Down

0 comments on commit e7a72b9

Please sign in to comment.