Skip to content

Commit

Permalink
Switch to eslint (#155)
Browse files Browse the repository at this point in the history
eslint is the future of JS linting. This also adds support for the
`prefer-let`.
  • Loading branch information
cowboyd authored and Robdel12 committed Oct 7, 2016
1 parent 93a5c99 commit c493c76
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 130 deletions.
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 6,
sourceType: 'module'
},
extends: 'eslint:recommended',
env: {
'browser': true
},
plugins: [
"prefer-let"
],
rules: {
"prefer-let/prefer-let": 2
}
};
32 changes: 0 additions & 32 deletions .jshintrc

This file was deleted.

2 changes: 1 addition & 1 deletion addon/components/x-option.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';

var isArray = Ember.isArray;
const { isArray } = Ember;

/**
* Used to wrap a native `<option>` tag and associate an object with
Expand Down
4 changes: 2 additions & 2 deletions addon/components/x-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default Ember.Component.extend({
* @return {Object} the value of the first select `x-option`, or null
*/
_findSingleValue() {
const selectedValue = this.get('options').find(isSelectedOption);
let selectedValue = this.get('options').find(isSelectedOption);
return selectedValue ? selectedValue.get('value') : null;
},

Expand All @@ -153,7 +153,7 @@ export default Ember.Component.extend({
},

__setDefaultValues: function() {
const canSet = !this.isDestroying && !this.isDestroyed;
let canSet = !this.isDestroying && !this.isDestroyed;
if (canSet && this.get('value') == null) {
this.sendAction('action', this._getValue());
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"ember-cli-app-version": "^1.0.0",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-deploy": "0.5.1",
"ember-cli-eslint": "3.0.0",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-mocha": "0.10.4",
"ember-cli-release": "^0.2.9",
"ember-cli-test-loader": "^1.1.0",
Expand All @@ -38,6 +38,7 @@
"ember-pagefront": "0.11.2",
"ember-resolver": "^2.0.3",
"ember-sinon": "0.5.1",
"eslint-plugin-prefer-let": "^0.1.0",
"loader.js": "^4.0.1"
},
"keywords": [
Expand Down
5 changes: 5 additions & 0 deletions tests/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
env: {
'embertest': true
}
};
53 changes: 0 additions & 53 deletions tests/.jshintrc

This file was deleted.

2 changes: 2 additions & 0 deletions tests/acceptance/default-values-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import startApp from '../helpers/start-app';
import Ember from 'ember';
import { select } from 'dummy/tests/helpers/x-select';

const { $ } = Ember;

describe('XSelect: Default Values', function() {
let application;

Expand Down
7 changes: 3 additions & 4 deletions tests/acceptance/x-select-multiple-test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/*global expect */
/*global expect, getComponentById */
/* jshint expr:true */

import Ember from 'ember';
import startApp from '../helpers/start-app';
import { it } from 'ember-mocha';
import { beforeEach, afterEach, describe } from 'mocha';
import { select } from 'dummy/tests/helpers/x-select';
import { shouldBindAttrs } from './shared/attr-test';

var App;
let App;

describe('XSelect: Multiple Selection', function() {
beforeEach(function() {
App = startApp();
visit("/multiple");
});
beforeEach(function() {
var el = Ember.$('select');
let el = Ember.$('select');
this.component = getComponentById(el.attr('id'));
this.$ = function() {
return this.component.$.apply(this.component, arguments);
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/x-select-single-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global expect */
/*global expect, getComponentById */
/* jshint expr:true */

import Ember from 'ember';
Expand All @@ -9,15 +9,15 @@ import { select } from 'dummy/tests/helpers/x-select';
import { stanley } from 'dummy/mixins/folks';
import { shouldBindAttrs } from './shared/attr-test';

var App;
let App;

describe('XSelect: Single Selection', function() {
beforeEach(function() {
App = startApp();
visit("/single");
});
beforeEach(function() {
var el = Ember.$('select');
let el = Ember.$('select');
this.component = getComponentById(el.attr('id'));
this.$ = function() {
return this.component.$.apply(this.component, arguments);
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/x-select-zany-embedded-html-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global expect */
/*global expect, getComponentById */
/* jshint expr:true */

import Ember from 'ember';
Expand All @@ -7,15 +7,15 @@ import { it } from 'ember-mocha';
import { beforeEach, afterEach, describe } from 'mocha';


var App;
let App;

describe('XSelect: Embedded HTML', function() {
beforeEach(function() {
App = startApp();
visit("/zany-embedded-html");
});
beforeEach(function() {
var el = Ember.$('select');
let el = Ember.$('select');
this.component = getComponentById(el.attr('id'));
this.$ = function() {
return this.component.$.apply(this.component, arguments);
Expand Down
12 changes: 2 additions & 10 deletions tests/dummy/app/controllers/default-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,7 @@ export default Ember.Controller.extend(Cars, {
this.set('trim', object);
}
},
updateField: function(object) {
if (object) {
console.log('You selected Make:', object.name);
}
},
updateSelectedQuantity: function(object) {
if (object != null) {
console.log('You selected Quantity:', object);
}
}
updateField: function() {},
updateSelectedQuantity: function() {}
}
});
36 changes: 18 additions & 18 deletions tests/dummy/app/mixins/cars.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import Ember from 'ember';

export var sport = {name: 'Sport'};
export const sport = {name: 'Sport'};

export var sedan = {name: 'Sedan'};
export const sedan = {name: 'Sedan'};

export var hatchback = {name: 'Hatchback'};
export const hatchback = {name: 'Hatchback'};

export var camry = {name: 'Camry', trimOptions: [sport, sedan, hatchback]};
export const camry = {name: 'Camry', trimOptions: [sport, sedan, hatchback]};

export var corolla = {name: 'Corolla', trimOptions: [sedan]};
export const corolla = {name: 'Corolla', trimOptions: [sedan]};

export var tacoma = {name: 'Tacoma', trimOptions: []};
export const tacoma = {name: 'Tacoma', trimOptions: []};

export var fit = {name: 'Fit', trimOptions: [sport, hatchback]};
export const fit = {name: 'Fit', trimOptions: [sport, hatchback]};

export var civic = {name: 'Civic', trimOptions: [sedan, sport]};
export const civic = {name: 'Civic', trimOptions: [sedan, sport]};

export var accord = {name: 'Accord', trimOptions: []};
export const accord = {name: 'Accord', trimOptions: []};

export var focus = {name: 'Focus', trimOptions: [sport, hatchback]};
export const focus = {name: 'Focus', trimOptions: [sport, hatchback]};

export var fiesta = {name: 'Fiesta', trimOptions: [hatchback, sedan]};
export const fiesta = {name: 'Fiesta', trimOptions: [hatchback, sedan]};

export var mustang = {name: 'Mustang', trimOptions: [sport]};
export const mustang = {name: 'Mustang', trimOptions: [sport]};

export var toyotaModels = [camry, corolla, tacoma];
export const toyotaModels = [camry, corolla, tacoma];

export var hondaModels = [fit, civic, accord];
export const hondaModels = [fit, civic, accord];

export var fordModels = [focus, fiesta, mustang];
export const fordModels = [focus, fiesta, mustang];

export var toyota = {name: 'Toyota', models: toyotaModels};
export const toyota = {name: 'Toyota', models: toyotaModels};

export var honda = {name: 'Honda', models: hondaModels};
export const honda = {name: 'Honda', models: hondaModels};

export var ford = {name: 'Ford', models: fordModels};
export const ford = {name: 'Ford', models: fordModels};

export default Ember.Mixin.create({
makes: [toyota, honda, ford],
Expand Down
6 changes: 3 additions & 3 deletions tests/dummy/app/mixins/folks.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Ember from 'ember';

export var bastion = {name: 'Bastion', cowboy: 'nope'};
export const bastion = {name: 'Bastion', cowboy: 'nope'};

export var charles = {name: 'Charles', cowboy: 'yep'};
export const charles = {name: 'Charles', cowboy: 'yep'};

export var stanley = {name: 'Stanley', cowboy: 'maybe'};
export const stanley = {name: 'Stanley', cowboy: 'maybe'};

export default Ember.Mixin.create({
bastion: bastion,
Expand Down

0 comments on commit c493c76

Please sign in to comment.