Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local or Relative <linter> paths #366

Closed
tbremer opened this issue Nov 3, 2015 · 14 comments
Closed

Local or Relative <linter> paths #366

tbremer opened this issue Nov 3, 2015 · 14 comments

Comments

@tbremer
Copy link

tbremer commented Nov 3, 2015

I was hoping to find a solution in the, but did not see one in the Issues or on the Documentation…

But, is it possible to load relative paths? Such as ./node_modules/.bin, it'd be nice to not have to globally install linters…

@tbremer tbremer changed the title Local or Relative paths Local or Relative <linter> paths Nov 3, 2015
@groteworld
Copy link
Member

What linter in specific are you using? If the SL- inherits from the NodeLinter generic class, then it should find the executable from the node_modules directory automatically. If not you should be able to use setting tokens to point the path to the ./node_modules/.bin of every project with ${project}.

@tbremer
Copy link
Author

tbremer commented Nov 4, 2015

I am using JSHint, and was previously using CSSLint, but have since dropped it. I tried searching their repo for references to NodeLinter with no luck… I will try this token thing. Thanks!

@tbremer
Copy link
Author

tbremer commented Nov 4, 2015

So, I followed along in the setting tokens link that you sent, and it appears they aren't expanding properly OR i am doing it wrong…

I am setting the paths in both the User settings and project settings, just in case. They are set up like:

/** sublime-project file */
{

    "SublimeLinter":
    {
        "paths": {
            "osx": [
                "${project}/node_modules/.bin/",
                "${directory}/node_modules/.bin/"
            ]
        },
    }

}

/** SublimeLinter.sublim-settings */
{
    "user":
    {
    
    "paths": {
            "osx": [
                "${directory}/node_modules/.bin/",
                "${project}/node_modules/.bin/",
                "/Users/thomas.bremer/.rbenv/shims/"
            ]
        },
    
    }
}

but as you can see in the attachment I am getting a error message of SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint'

This is the entire console log on a fresh load:

startup, version: 3083 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/thomas.bremer/Library/Application Support/Sublime Text 3/Packages
state path: /Users/thomas.bremer/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/thomas.bremer/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.333738
using gpu buffer for window
startup time: 0.386509
first paint time: 0.450886
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_file_settings
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.quick_panel
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.02-bz2
reloading plugin Block Cursor Everywhere.SublimeBlockCursor
reloading plugin DocBlockr.jsdocs
reloading plugin EditorConfig.EditorConfig
reloading plugin Emmet.emmet-plugin
reloading plugin Origami.origami
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin SCSS.scss_completions
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading plugin SublimeLinter-contrib-scss-lint.linter
SublimeLinter: scss linter loaded 
reloading plugin SublimeLinter-jshint.linter
SublimeLinter: jshint linter loaded 
reloading plugin Babel.Babel
reloading plugin SublimeLinter.commands
reloading plugin SublimeLinter.sublimelinter
plugins loaded
SublimeLinter: debug mode: on 
SublimeLinter: temp directory: /var/folders/qb/xqgj4d4d1qv1k25ffp90_9380000gp/T/SublimeLinter3-thomas.bremer 
SublimeLinter: user shell: /bin/zsh 
SublimeLinter: computed PATH using /bin/zsh:
${directory}/node_modules/.bin/
${project}/node_modules/.bin/
/Users/thomas.bremer/.rbenv/shims/
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 288, in on_selection_modified
    callback.on_selection_modified(v)
  File "SublimeBlockCursor in /Users/thomas.bremer/Library/Application Support/Sublime Text 3/Installed Packages/Block Cursor Everywhere.sublime-package", line 31, in on_selection_modified
AttributeError: 'BlockCursorEverywhere' object has no attribute 'vi_enabled'
reloading Packages/User/SublimeLinter.sublime-settings
Emmet: No need to update PyV8
Package Control: Skipping automatic upgrade, last run at 2015-11-04 13:48:31, next run at 2015-11-04 14:48:31 or after
SublimeLinter: WARNING: jshint deactivated, cannot locate 'jshint' 

paths

@kevinastone
Copy link

👍 having the same issue (eslint in my case)

@rb0w
Copy link

rb0w commented Feb 1, 2016

Hi,

I'm having similar path issues with sublimeLinter-jshint too. In my case, ditched the ${home} and typed the full path seems to for me.

Affected systems:
ArchLinux x64 linux kernel lts-4.1.16-1, KDE 5
LinuxMint/Ubuntu x64 linux kernel 3.13.0-76, KDE 4

From your console log

[snip]
SublimeLinter: computed PATH using /bin/zsh:
${directory}/node_modules/.bin/
${project}/node_modules/.bin/
/Users/thomas.bremer/.rbenv/shims/
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

ST3 is not reading your path correctly. The computed paths should be spelled exactly, eg.

/Users/...

and not

${directory}/...

In SublimeLinter.sublime-settings, try replacing with actual path instead of using these ${home}, ${project}, ${directory} tokens. Seems that tokens do not work in the "paths" setting.

Hope this helps.

@karolyi
Copy link

karolyi commented Feb 18, 2016

+1 here, it boggles the mind how this wasn't implemented in sublimelinter per default. I don't want to install things globally, but project-locally. Fought about 2 hours with this, there seems no option to resolve this other than setting absolute paths, which is obviously not a solution.

@dieend
Copy link

dieend commented Feb 24, 2016

I had the same issue using eslint. I want to use eslint in my project instead of global eslint, hence all my fellow developer can uses the same eslint version and same dependencies.

@lime
Copy link

lime commented Feb 24, 2016

Was having the same issue as others here (node_modules/.bin/eslint), and found this thread. I then went to the source for node_linter.py to see that it indeed should attempt to use local binaries.

After forcing an update of all my packages and restarting Sublime I can confirm that it works as intended: SublimeLinter now uses my local eslint. I recommend that others having this issue try to do the same.

I might of course have been using some ancient version of one of the packages involved. I slightly doubt it though, so I'll keep my eyes open in case it starts breaking for me again.

@karolyi
Copy link

karolyi commented Feb 24, 2016

@lime if you're using sublimelinter-contrib-eslint, that plugin has this functionality. sublimelinter in general, hasn't afaik

@groteworld
Copy link
Member

@karolyi That is because contrib-eslint inherits from NodeLinter

@mikecar
Copy link

mikecar commented Jun 15, 2016

using SL3 build 3114 on windows, I seem to have come accross the same issue. I want to use phpmd linter. I installed it in a SL3 package (my package) so that it is usable by SL only. However, setting the paths in a portable way (which is important to me, as I share configs with other developers) does not work as documented. I finally managed to get it to work by doing this in SL settings: (mk1 is my package, and this is a portable installation)

    "paths": {
        "linux": [],
        "osx": [],
        "windows": [
            "Data/Packages/mk1/support",
            "${sublime}/mk1/support"
        ]
    },

when linter starts, the first setting works, which is advertised as relative to the .exe of SL itself,
so the linter is activated.
however, when it later tries to actually lint a file, the current directory has CHANGED, so the first
path fails. however, it now correctly replaces the token '${sublime}', and it works again. for some strange reason, initial detection of the linter does not utilize token replacement!

all this smells of bug, but I do not know enough python to fix it...
overall, I believe that the code needs a lot of rework, to work as advertised in the documentation.

@braver
Copy link
Member

braver commented Jan 6, 2018

We have been making many changes to SublimeLinter, some of which also should have fixed this particular problem. It would be really nice if you could try the beta and let us know if that fixes the problem for you.

@kaste
Copy link
Contributor

kaste commented Jan 17, 2018

jshint has been upgraded since then. However, 'token expansions' in the paths settings were never implemented, and there are not planned for SL4 either.

@kaste
Copy link
Contributor

kaste commented Jan 17, 2018

It is doable though, so you could go for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

10 participants