get-alex / alex

Catch insensitive, inconsiderate writing
https://alexjs.com
MIT License
4.81k stars 208 forks source link

alex can't resolve paths in home directory #266

Closed fhemberger closed 4 years ago

fhemberger commented 5 years ago

Subject of the issue

alex can't resolve paths in home directory

Your environment

Steps to reproduce

  1. Install alex as global dependency: npm i -g alex
  2. Try to check a file in your home directory: alex ~/my_file.txt

Expected behaviour

File should be linted

Actual behaviour

alex ~/my_file.txt
/usr/local/lib/node_modules/alex/node_modules/ignore/index.js:337
  throw new Ctor(message)
  ^

RangeError: path should be a `path.relative()`d string, but got "../Users/frederic/my_file.txt"
    at throwError (/usr/local/lib/node_modules/alex/node_modules/ignore/index.js:337:9)
    at checkPath (/usr/local/lib/node_modules/alex/node_modules/ignore/index.js:356:12)
    at Ignore._test (/usr/local/lib/node_modules/alex/node_modules/ignore/index.js:473:5)
    at Ignore.ignores (/usr/local/lib/node_modules/alex/node_modules/ignore/index.js:512:17)
    at one (/usr/local/lib/node_modules/alex/node_modules/unified-engine/lib/finder.js:255:51)
    at handleIgnore (/usr/local/lib/node_modules/alex/node_modules/unified-engine/lib/finder.js:243:5)
    at done (/usr/local/lib/node_modules/alex/node_modules/unified-engine/lib/ignore.js:41:7)
    at apply (/usr/local/lib/node_modules/alex/node_modules/unified-engine/lib/find-up.js:190:7)
    at applyAll (/usr/local/lib/node_modules/alex/node_modules/unified-engine/lib/find-up.js:180:7)
    at found (/usr/local/lib/node_modules/alex/node_modules/unified-engine/lib/find-up.js:172:7)
wooorm commented 4 years ago

Are you sure? I just did npm i -g alex and:

tilde in ~
$ alex example.md 
example.md: no issues found

tilde in ~
$ alex --version
8.1.0

Works for me? 🤷‍♂️

wooorm commented 4 years ago

Btw, sorry for letting this sit too long (also: I’m on Node v13.0.1 and npm 6.13.6. Does updating your dependencies help?)

fhemberger commented 4 years ago

Fixed in alex 8.1.0, closing. Thanks!

wooorm commented 4 years ago

Oh funky; well good!