ricardofbarros / linter-js-standard

Atom linter plugin for JavaScript, using JavaScript Standard Style
https://atom.io/packages/linter-js-standard
MIT License
99 stars 48 forks source link

'Could not get file path' when opening file outside of project #152

Closed chrisdothtml closed 7 years ago

chrisdothtml commented 7 years ago

If I open a file in Atom that is outside of the project directory, the 'Could not get file path' warning shows up. It also shows up every time I switch to the tab of the file.

I initially thought this was an Atom issue, then I disabled this package, and the issue stopped happening.

Based on what I've read about past issues with this warning, I'm guessing it's happening on init.js:90. It seems like it tries to get the path based on the current project, but it's unable to since the file isn't a part of the project directory.

ricardofbarros commented 7 years ago

Hey @chrisdothtml, this is a known issue, what is your suggestion to fix it?

chrisdothtml commented 7 years ago

@ricardofbarros scratch that, the error is in style-settings.js:25-27 where it tries to look for a matching project for the active file.

If it were me, I'd silently fail if the active file has no matching project. The only reason you're looking for a project in the first place is to see if they have a style set in their package.json, right? If it's a file that has no project (e.g. an unsaved file), I can't imagine anyone would want it to use the style settings from any other project

ricardofbarros commented 7 years ago

Hey @chrisdothtml, I've just release a new version that should fix this v.3.9.0. Care to test?

Thanks

chrisdothtml commented 7 years ago

@ricardofbarros Fixed it for me, thanks!