lundi 4 mai 2015

How can I declare globals for jshint to ignore in ember-cli?

I'm using sinon in my specs and including it in the Brocfile as describe in the ember-cli docs. This works and I can use sinon in my specs. But, jshint is complaining that sinon is not defined:

1 error: expected false to be truthy
    AssertionError: unit/views/edit-todo-test.js should pass jshint.
    unit/views/edit-todo-test.js: line 11, col 18, 'sinon' is not defined.

I can fix this by declaring sinon a global in the spec:

/* global sinon */

But, I'll have to add that to every spec (along with beforeEach, afterEach, etc....). I'd much rather just configure this once globally but when I add these globals to the predef array in .jshintrc, they aren't ignored and I still get the errors. For example:

.jshintrc:

{
  "predef": [
    "document",
    "window",
    "-Promise",
    "sinon"
  ],
<-- snip -->

still fails with the error 'sinon' is not defined.

Any help would be greatly appreciated. Thanks!




Aucun commentaire:

Enregistrer un commentaire