trentrichardson / Clientside

Sublime Text plugin to minify, format, and lint CSS and Javascript
26 stars 4 forks source link

Jslint and CSSlint doesn't work #1

Closed bafxyz closed 12 years ago

bafxyz commented 12 years ago

Hello, Can you explain how to enable JSLINT and CSSlint? I have installed node.js at Windows x64. Settings: { // for each operation you can replace, new, console for where to output "css_minify_output": "replace", "js_minify_output": "replace", "css_format_output": "replace", "js_minify_output": "replace", "css_lint_output": "replace", "js_lint_output": "replace",

// CSS Formatting ==========================
// when formatting do you prefer brackets on a new line?
"cssformat": {
    "bracket_newline": false,
    "compact": false
},

// JS Formatting ==========================
// jsbeautify settings, see http://jsbeautifier.org/
"jsformat": {       
    // how to output braces: collapse, expand, end-expand
    "brace_style": "collapse"
},

// Lint options ===========================
// how do we call nodejs? node, nodejs, path/to/nodejs, etc..
// mac is likely "node" or "/usr/local/bin/node", linux is likely "nodejs"
// if you're not sure open a terminal and run "which node" or "which nodejs"
"nodejs": "nodejs",

// css lint settings, see https://github.com/stubbornella/csslint/wiki/Rules
"csslint": {

},

// js lint settings, see https://github.com/douglascrockford/JSLint
"jslint": {
    "browser": true,
    "forin": true
}

}

trentrichardson commented 12 years ago

When you open a command prompt and run nodejs, which command do you run? Be sure "nodejs" option resembles the command you run.

bafxyz commented 12 years ago

Thx for fast reply. If i use nodejs command in cmd windows can't find this command. If i use node command windows know this command, but then i change "nodejs": "node" in sublime text2 and restart it - nothing helps. The i run Jslint blank window replacing my script with message : "0 selection regions"

trentrichardson commented 12 years ago

If windows recognizes "node" then that should be your setting ( "nodejs": "node" ).

If you open the console in sublime text and try to run the command does it give any errors?

bafxyz commented 12 years ago

No, just blank window and clear console. Last command in console is: Package Control: Skipping automatic upgrade, last run at 2012-09-02 23:21:15, next run at 2012-09-03 00:21:15 or after

trentrichardson commented 12 years ago

Ok, It likely has something to do with file paths in windows. I primarily develop in linux. I will have to get to a windows machine, which I don't have access to at the moment, sorry.

If you're at all familiar with Python, the error likely rests in this method for jsLint: https://github.com/trentrichardson/Clientside/blob/master/Clientside.py#L167

or here for cssLint: https://github.com/trentrichardson/Clientside/blob/master/Clientside.py#L91

It is likely the exact same error in both, either the file path to the plugin (self.plugin_dir defined on line 17) or line self.settings.get('nodejs', 'nodejs') on line 129. That second nodejs represents the default value.

placeing a print self.plugin_dir print self.settings.get('nodejs', 'nodejs')

May help clarify which is the issue. Just open the console in st2 "Ctrl+`" and run jslint or csslint on a file. It should print those variables.

trentrichardson commented 12 years ago

It was indeed file path issue, the paths for windows include "\" which was escaping items in the string. Just needed to escape all "\" occurances