madskristensen / WebEssentials2013

Visual Studio extension
http://vswebessentials.com
Other
944 stars 251 forks source link

CoffeeLint problems #768

Closed TommiGustafsson closed 10 years ago

TommiGustafsson commented 10 years ago

CoffeeLint. I tried to change the default indentation to 4 (from 2) in global settings (coffeelint.json in the menu), but it had no effect.

"indentation": {
    "name": "indentation",
    "value": 4,
    "level": "error"
},

I get the following error:

CoffeeLint: Show.coffee compilation failed: CoffeeLint: Line contains inconsistent indentation; context: Expected 2 got 4

Also, there is no indication what line caused the problem.

Furthermore, it would be nice feature to have that there would be an alert box or something similar to pop up, when I save a coffeescript file (or any other preprocessed file) and it fails to compile. Now I need to check for errors in the Build window, and sometimes I may miss them. A clearer error alert box would catch my attention easier.

am11 commented 10 years ago

The build menu is just logging all activities. You can right click it and clear the window.

Thus build window is the wrong place to look for the linter warnings. Use Error window.

As soon as you change the indention count in settings file, those warnings disappear from Error window.

Now I need to check for errors in the Build window, and sometimes I may miss them.

You don't need to check in build window. You can just check the error window with segregated Warnings, Errors and (other) Messages.

TommiGustafsson commented 10 years ago

Thanks! This helped to find the correct line of the error messages. But STILL setting indentation to 4 has no effect for me. :-\

am11 commented 10 years ago

The order by which it applies coffeelint.json settings is; first look in current directory, its parent ... upto the drive's root, if none is found, it applies the one in user's home directory "C:\Users\coffeelint.json". Same goes for tslint.json, .jshintrc, .jscsrc et el.

TommiGustafsson commented 10 years ago

What I did was to click Web Essentials in the menu bar, and then Edit Global CoffeeLint Settings. It opened a JSON file, and I edited it. I thought it would affect all my projects immediately.

TommiGustafsson commented 10 years ago

When I added coffeelint.json to the project root, everything started to work. It seems that C:\Users\coffeelint.json is completely ignored.

Additionally, I suggest that you add coffeelint.json file to SideWaffle files.

am11 commented 10 years ago

I tested with the following steps:

And got 89 warnings:

CoffeeLint: Line contains inconsistent indentation; context: Expected 3 got 4

Do you have another coffee.json in the directory tree; between drive's root and your project root?

TommiGustafsson commented 10 years ago

I checked that I have no coffee.json nor coffeelint.json files anywhere between the project folder and the system root. When I change the global CoffeeLint settings they seem not to work in any of my projects. It keeps on saying:

CoffeeLint: CoffeeScript1.coffee compilation failed: CoffeeLint: Line contains inconsistent indentation; context: Expected 2 got 4

Maybe it does not find the global file. My user name is Tommi Gustafsson on the computer I'm using. So the file is C:\Users\Tommi Gustafsson\coffeelint.json.

am11 commented 10 years ago

@TommiGustafsson, do you get C:\Users\Tommi Gustafsson\ when you do:

Run (Windows Key + R) > type %homepath% > press Enter

Not sure but it could be that nodejs is not resolving home.

Also, is your project on same drive as your WE and Windows installations?

TommiGustafsson commented 10 years ago
  1. Nope. I get C:\
  2. Nope. My Program Files are on F: drive. (Windows is on the C: drive. My project is on the C: drive as well.)
am11 commented 10 years ago

%HOMEDRIVE%%HOMEPATH% or %HOMEPATH% should point to your home directory, for instance C:\Users\Adeel.

You need to fix it first.

Perhaps this can fix your issue, using gpedit.msc.

am11 commented 10 years ago

@madskristensen, it seems like the issue here is with altered configuration (environment variable).

This can be closed now.

DinisCruz commented 10 years ago

For reference I got this working, but only after restarting Brackets after creating the coffeelint.json file for the first time (i.e. it seems that the settings are not picked up if the coffeelint.json doesn't exist when Brackets starts)).

After the first restart, I have

image

which works ok

image

and If I change the value to 3, I get the expected error:

image

What is nice is that once I change it back to 4, the settings take effect immediately

image