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

Latest 1.1.1release seems to no longer recognize .jshintrc in project #140

Closed
trevordmiller opened this issue Jul 18, 2015 · 21 comments
Closed
Labels

Comments

@trevordmiller
Copy link

The latest 1.1.1 release (I updated in Atom today) seems to no longer recognize the .jshintrc settings in my projects: I am gettting linter errors/warnings that don't line up with my .jshintrc settings (see screenshot below). It has been working for me for months (no code changes) until this last update.

jshint-issue

@steelbrain
Copy link
Contributor

Super-weird, the only update in this release was that it uses atom as the nodejs runtime instead of the system installed one, can you try to hard-code the jshint path in settings and see if it fixes it for you?

@trevordmiller
Copy link
Author

@steelbrain How can I hard code the Path of the jshint executable if it is different for every project? I almost always have a .jshintrc at the root of each project I work on...

jshintrc-path

@steelbrain
Copy link
Contributor

Dynamic for each project? I don't understand. It's actually the same IMO

@trevordmiller
Copy link
Author

@steelbrain So, instead of having one master .jshintrc in my user directory / atom package that every project points to, I usually have a .jshintrc at the root of each project which may or may not be the same...just as you can have other configuration files at the root of a project that may be different for each project on your machine (ie .editorconfig, .gitignore, .npmrc, package.json etc.). I believe this is a really common pattern that many GitHub projects use not only for JSHint but for ESLint (.eslintrc), JSCS (.jscsrc), JSLint (.jslintrc) etc. Here are a few examples from popular projects:

gulp

grunt

jquery

Make sense?

@steelbrain
Copy link
Contributor

I know what the problem is. Gonna fix it soon!

@steelbrain steelbrain self-assigned this Jul 18, 2015
@steelbrain steelbrain added the Bug label Jul 18, 2015
@Glavin001
Copy link

Also experiencing this. esnext option as well.

@ghost
Copy link

ghost commented Jul 18, 2015

For those having this problem, install version 1.1.0:

apm uninstall linter-jshint && apm install linter-jshint@1.1.0

And then if you have any problem with the jshint/node executable (when linting), add this to your atom init file:

process.env.PATH = ["/usr/local/bin", process.env.PATH].join(":")

Workaround for now or just revert back to 1.0.

@trevordmiller
Copy link
Author

@peduxe Thanks for the tip. Reverting back and adding the the environment path to my init file worked great for me.

@steelbrain
Copy link
Contributor

Thanks @peduxe 👏

@adamreisnz
Copy link

Just wanted to raise this issue as well, as suddenly my node files were throwing jshint errors on undefined require's. Good to see you're already on it, thanks!

@nathanbuchar
Copy link

Yep, same here! Looks like it's already being tackled—thanks! :-)

@giannisp
Copy link

Same issue here, until the update, apm uninstall linter-jshint && apm install linter-jshint@1.1.0 worked just fine for me.

@steelbrain
Copy link
Contributor

I have tracked it down to this line

return helpers.execNode(executablePath, parameters, {stdin: text}).then (output) ->

if you change it to

return helpers.exec(executablePath, parameters, {stdin: text}).then (output) ->

it works, which means that detection is working via global nodejs and not working via electron.

@steelbrain
Copy link
Contributor

The error seems to be in node_modules/jshint/src/cli.js line 615, the value of config is different if run via normal iojs or electron.

@joefitzgerald
Copy link

@steelbrain I'm not sure that modifying the environment in the atom init file is the right solution here. For one thing, it'll break the detection logic in https://atom.io/packages/environment should we decide to integrate it.

@steelbrain
Copy link
Contributor

@joefitzgerald but it should still work this way, for users who don't have nodejs installed at all.

@joefitzgerald
Copy link

I'm saying we shouldn't be instructing people to add /usr/local/bin to their path in atom's init file. I'm not commenting on other aspects of your solution.

@steelbrain
Copy link
Contributor

@joefitzgerald for linter-jshint, users don't have to install anything, it's bundled with this package, and uses electron as it's node runtime 😉

@joefitzgerald
Copy link

Consider consuming the service provided by environment, and using that for the environment that you pass to execNode. If you don't allow the caller of execNode to specify the environment then you need to make that configurable.

@joefitzgerald
Copy link

But yes, I understand that jshint is bundled and the embedded node that Atom uses should suffice. My comments simply apply to ensure use of global node (if required) will work.

@steelbrain
Copy link
Contributor

We don't really need node, anywhere in this project 😅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants