SublimeJSCSFormatter
SublimeJSCSFormatter copied to clipboard
Error: No configuration found. Add a .jscsrc file to your project root or use the -c option.
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?
Sounds like https://github.com/TheSavior/SublimeJSCSFormatter/pull/25 is what you want.
@moroshko is it happening with other extensions like .php, .css, .scss?
@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 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.
@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)
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
}
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.
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.
I'm happy to review a PR for this.
I'd love to review a PR for this as well. :)
Me too :)
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.