Closed michaelBenin closed 9 years ago
Not sure why the predefs aren't working. At the very least this should work if you put it at the top of any file that uses sinon:
/* global sinon */
For now yes we can solve this with a comment but I'd prefer if the jshint config persisted these changes.
Do you think I should look into escalating this to ember-cli?
I just tried this out myself and I wasn't able to reproduce the problem. I created a new app, added "sinon" to the predef
of /tests/.jshintrc
, then used sinon
in one of the tests, and jshint was happy. Are you sure you edited the right .jshintrc file?
Ah ok, wasn't aware there was a /tests/.jshintrc. I was under the impression the only .jshintrc was in the root of the directory.
Yeah, I always felt that was confusing for that reason. IMO the root-level .jshintrc should either not exist or at least be a node-style one (for the Brocfile). And /tests and /app should have their own browser versions.
Is it possible to update the tests/.jshintrc file on install?
Yeah it could be part of the ember-sinon
blueprint. I don't have the bandwidth for this right now, but PRs are welcome!
Of course the ideal situation is for ember CLI to enable importing anonymous AMD modules as ES6 ones, so you can avoid globals altogether.
@michaelBenin: predef should be an array not an object AFAIK:
"predef": [
"document",
"window",
"sinon"
],
@csantero:
Of course the ideal situation is for ember CLI to enable importing anonymous AMD modules as ES6 ones, so you can avoid globals altogether.
If only, I have my doubts it will ever happen. ES6 Modules can not come sooner enough!
Closed via https://github.com/csantero/ember-sinon/commit/e42b6b82e2f36435468a71631e3c4f60a4f15937. Decided to use a shim module to make sinon
available as an import, inspired by ember-cli-pretender.
I've updated my jshintrc and it still complained sinon was a global.
I don't know if this is an issue with this project or ember-cli.
Here's some background:
jshintrc:
package.json:
Line of code causing the issue:
I don't want to do: