SublimeJSCSFormatter icon indicating copy to clipboard operation
SublimeJSCSFormatter copied to clipboard

Error: No configuration found. Add a .jscsrc file to your project root or use the -c option.

Open moroshko opened this issue 9 years ago • 12 comments

I'd like to use JSCS Formatter in one project but not in another. I have "format_on_save": true in my user settings. The problem is that, in the other project, where I don't want to use JSCS Formatter, I get an error that it cannot find .jscsrc every time I save a file: http://dl.dropbox.com/u/1893981/Screenshots/cdgp.png

Is there a way to specify to JSCS Formatter which directories to operate in?

moroshko avatar Apr 18 '15 00:04 moroshko

Sounds like https://github.com/TheSavior/SublimeJSCSFormatter/pull/25 is what you want.

mrjoelkemp avatar Apr 18 '15 01:04 mrjoelkemp

@moroshko is it happening with other extensions like .php, .css, .scss?

luisfmsouza avatar Apr 18 '15 12:04 luisfmsouza

@mrjoelkemp Correct me if I'm wrong, but #25 allows to override global setting by project specific settings. In my case, there is no project, so Edit project is not available. Can't JSCS Formatter be activated only if it finds .jscsrc?

@luisfmsouza I'm not sure what you mean. I do have other extensions like .less and .html in my repo.

moroshko avatar Apr 19 '15 03:04 moroshko

@moroshko What happens if you hit save on a .less or .html in your 'non-project' that doesn't have a .jscsrc file? Do you also get that warning then?

I'd be happy to change the big popup to instead be a message in the toolbar at the bottom of the sublime window if others feel that would be a good thing to do as well.

elicwhite avatar Apr 19 '15 04:04 elicwhite

@TheSavior Yes. The popup appears regardless of the file type being saved.

A message in the toolbar would definitely be preferable because it would require no action. But, don't you think that there should be a way to say JSCS-Formatter: "Don't check this folder at all"? (i.e. no warnings, totally ignore this folder)

moroshko avatar Apr 19 '15 04:04 moroshko

I am having the same issue as @moroshko. Whenever I save a file that does not have a .js extension I am getting the popup. For some reason JSCS Formatter is running on all file extensions. NOTE: I do not have the luxury of modifying a .sublime-project file either.

// At the project root .jscs.json
{
  "fileExtensions: [ ".js" ]
  ...
}
// JCSC-Formatter.sublime-settings
{
  "format_on_save": true
}

n8io avatar Apr 23 '15 14:04 n8io

Has there been a solution to this problem already? I have a project with python files and this plugin keeps giving the error when I try to save those files. It's really annoying.

happylinks avatar Jun 03 '15 08:06 happylinks

The fix seems to be to add a guard here https://github.com/TheSavior/SublimeJSCSFormatter/blob/master/JSCS-Formatter.py#L22 that checks if the current view has a .js extension and that if a .jscsrc file does not exist and the config setting has not been supplied, then return.

You'll have to create a function to find a jscsrc file. Replicating jscs' lookup seems tedious, but i wonder if you could just shell out a unix command to search through all directories and subdirectories of the project for a .jscsrc filename.

mrjoelkemp avatar Jun 03 '15 10:06 mrjoelkemp

I'm happy to review a PR for this.

mrjoelkemp avatar Jun 03 '15 10:06 mrjoelkemp

I'd love to review a PR for this as well. :)

elicwhite avatar Jun 03 '15 16:06 elicwhite

Me too :)

canvaspixels avatar Sep 23 '15 10:09 canvaspixels

I have (I think) the same problem but with vim. If I'm in a project, or anywhere, that does not have a .jscsrc, I get an error each time I save.

syntastic: error: checker output:
No configuration found. Add a .jscsrc file to your project root or use the -c option
syntastic: error: checker javascript/jscs returned abnormal status 4

IMO, if there is no .jscsrc, then maybe jscs should either not run at all, or use some kind of system default.

ballPointPenguin avatar Feb 03 '16 06:02 ballPointPenguin