Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

JSCS checker: change to the directory of the file being linted #1282

Closed
wants to merge 1 commit into from
Closed

JSCS checker: change to the directory of the file being linted #1282

wants to merge 1 commit into from

Conversation

bregenspan
Copy link
Contributor

JSLint, JSCS, and ESLint all support detecting config files. JSLint and ESLint use an exact config if specified, otherwise they look for one in the folder of the file, traversing upwards if none is found.

But JSCS currently looks in the current working folder, meaning that if someone opens files in several projects with different JSCS settings, the correct JSCS config will only be honored if they manually change the current working directory first.

The JSCS maintainers are working on making the config detection closer to JSLint/ESLint's (jscs-dev/node-jscs#559), but in the meantime, this patch can normalize the behavior of the JSCS checker to better match the other common JS checkers.

@lcd047
Copy link
Collaborator

lcd047 commented Jan 4, 2015

I don't really like this, for two reasons.

First, I'm not a fan of adding workarounds in syntastic for deficiencies in third party software that would be much easier addressed at the source.

Second, changing the working directory is not as harmless as it looks. For one, you patch breaks when you're checking files with a relative path. Fixing this would require either passing full paths to JSCS, or changing the relative paths to unqualified names. Loclists involving full paths are ugly, as filenames take half of the screen width; and using unqualified names makes it tricky to handle errors in included files.

Either way, it isn't a nice solution.

@bregenspan bregenspan closed this Jan 4, 2015
@bregenspan
Copy link
Contributor Author

@lcd047 both of those points make sense, thank you for the reply! I'll wait for the real fix on the JSCS side.

@bregenspan bregenspan deleted the make-jscs-options-file-finding-behave-more-like-jshint branch August 29, 2017 18:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants