src/rules/no-useless-path-segments.js
function toRelativePath(relativePath) {
  const stripped = relativePath.replace(/\/$/g, '') // Remove trailing /

  return /^((\.\.)|(\.))($|\/)/.test(stripped) ? stripped : `./${stripped}`
}
function toRelativePath(relativePath) {
  const stripped = relativePath.replace(/\/$/g, '') // Remove trailing /

  return /^((\.\.)|(\.))($|\/)/.test(stripped) ? stripped : `./${stripped}`
}
function toRelativePath ( relativePath ) { const stripped = relativePath . replace ( / \/$ / g , '' ) // Remove trailing / return / ^((\.\.)|(\.))($|\/) / . test ( stripped ) ? stripped : ` ${ stripped } ` }
convert a potentially relative path from node utils into a true
relative path.

../ -> ..
./ -> .
.foo/bar -> ./.foo/bar
..foo/bar -> ./..foo/bar
foo/bar -> ./foo/bar

@param relativePath {string} relative posix path potentially missing leading './'
@returns {string} relative posix path that always starts with a ./
convert a potentially relative path from node utils into a true relative path .