Search code examples
vimsyntaxcoffeescriptdotfiles

Increase max line length for coffeelint in vim (mvim) when editing coffee files


When I edit any .coffee file in my mvim and try to save that file with any line longer than 80 symbols, I get such error.

file_name.coffee |18 error| Line exceeds maximum allowed length Length is 91, max is 80.

This is extremely annoying, especially taking into consideration that we have convention of max 100 symbols per line in our company and even code of other team members causes problems for me locally.

The only place where I can change this limit is in nodejs module in file .../node_modules/coffeelint/lib/coffeelint.js, which has such line:

max_line_length: {
   value: 80,
   -level: ERROR,
   +level: IGNORE,
   message: 'Line exceeds maximum allowed length'
 },

But, of course, editing sources of nodejs libraries is not a good option.

In my mvim I use these dotfiles - https://github.com/skwp/dotfiles

In my project directory I have .coffeelint.json, but it does not work, however, it seems to contain needed and valid code for that (it works perfectly on TravisCI and on machines of other team members).

Questions:

  1. Is there any place where I can turn off coffeelint call when saving file?
  2. Is there any place where I can configure my coffelint max allowed line length?

Update:

Putting properly named (.coffeelint.json) config file into home directory helps, but is not proper solution in my case.


Solution

  • In all project parts (5 different repos now) we currently have .coffeelint.json file, that is not the proper name for coffeelint, if you want it to pick config file automatically. Current .coffeelint.json is used on TravisCI when checking code and is invoked with -f option, as it turned out. So I my case I have two ways to fix weird behaviour (that is intended behaviour, actually):

    1. Copy one of the configs from 5 related repos to ~/coffeelint.json, so that coffeelint will use it automatically when vim will check file on save (but this will not do if some repos will have different configs, however, this solution does not require any changes to repos).

    2. Create copy of each config file in each repository (so I'll have both .coffeelint.json and coffeelint.json in each repo) and add the newly added one to .gitignore, so that team members will not see it in their editors. This option is also inappropriate and looks ugly, cause I have to add 5 changes and 5 commits.

    It seems that guys from the team decided to name coffeelint config file not properly in order to hide it visually in code editors. Solution cost me nerves, so, probably, I'll reconfigure everything properly and will rename configs to default names.

    It would be nice if coffeelint supported multiple config files with levels of priority, but this is not possible now.