rwjblue / ember-cli-esnext

35 stars 7 forks source link

jshint not respecting template strings #4

Closed jakecraige closed 7 years ago

jakecraige commented 10 years ago

It seems jshint isn't respecting the template strings syntax

error:

models/group.js: line 17, col 9, 'activities' is defined but never used.
models/group.js: line 18, col 9, 'guests' is defined but never used.
models/group.js: line 20, col 9, 'activitiesText' is defined but never used.
models/group.js: line 21, col 9, 'guestsText' is defined but never used.
models/group.js: line 29, col 9, 'id' is defined but never used.

offending code:

  summary: Ember.computed('activities.[]', 'guests.[]', function() {
    var activities = this.get('activities.length');
    var guests     = this.get('guests.length');

    var activitiesText = `${activities} ${activities === 1 ? 'Activity' : 'Activities'}`;
    var guestsText     = `${guests} ${guests === 1 ? 'Guest' : 'Guests'}`;

    return `${activitiesText} ${guestsText}`;
  }),

I'm not sure if this is just a jshint setting i need to set or if this addon can somehow fix this but I wanted to bring it up.

rwjblue commented 10 years ago

Basically, the issue is that JSHint isn't updated to handle all of the various ES6 options.

In ember-cli we are hinting against the actual source in app (which is not processed through esnext filter yet).

rwjblue commented 10 years ago

I'm thinking we need to allow some plugins to be pre-JSHint (sweet.js and esnext) and others to be post-JSHint (like coffeescript).

Alternatively, we could look into options other than JSHint that may be more aware of ES6 semantics.