Enable ES6/ES2015 goodness

- Remove ES5 parser exception from .eslintrc
 - Configure Karma to use Babel to transpile ES6 sources to ES5,
   because PhantomJS does not support ES6
 - Upgrade es5-shim to es6-shim
This commit is contained in:
Miroslav Bajtoš 2017-01-27 11:29:39 +01:00
parent 450aa84ae8
commit be8dd0ded8
4 changed files with 11 additions and 10 deletions

View File

@ -1,8 +1,5 @@
{
"extends": "loopback",
"parserOptions": {
"ecmaVersion": 5
},
"rules": {
"max-len": ["error", 100, 4, {
"ignoreComments": true,

View File

@ -8,8 +8,8 @@
* loopback ~ public api
*/
var loopback = module.exports = require('./lib/loopback');
var datasourceJuggler = require('loopback-datasource-juggler');
const loopback = module.exports = require('./lib/loopback');
const datasourceJuggler = require('loopback-datasource-juggler');
/**
* Connectors

View File

@ -46,9 +46,9 @@
"ejs": "^2.3.1",
"express": "^4.14.0",
"inflection": "^1.6.0",
"isemail": "^1.2.0",
"loopback-connector-remote": "^3.0.0",
"loopback-datasource-juggler": "^3.0.0",
"isemail": "^1.2.0",
"loopback-phase": "^1.2.0",
"nodemailer": "^2.5.0",
"nodemailer-stub-transport": "^1.0.0",
@ -60,11 +60,12 @@
"underscore.string": "^3.0.3"
},
"devDependencies": {
"babel-preset-es2015": "^6.22.0",
"babelify": "^7.3.0",
"browserify": "^13.1.0",
"chai": "^3.5.0",
"cookie-parser": "^1.3.4",
"dirty-chai": "^1.2.2",
"es5-shim": "^4.1.0",
"eslint-config-loopback": "^7.0.1",
"express-session": "^1.14.0",
"grunt": "^1.0.1",
@ -78,6 +79,7 @@
"karma": "^1.1.2",
"karma-browserify": "^4.4.2",
"karma-chrome-launcher": "^1.0.1",
"karma-es6-shim": "^1.0.0",
"karma-firefox-launcher": "^1.0.0",
"karma-html2js-preprocessor": "^1.0.0",
"karma-junit-reporter": "~1.0.0",

View File

@ -16,11 +16,10 @@ module.exports = function(config) {
basePath: '../',
// testing framework to use (jasmine/mocha/qunit/...)
frameworks: ['mocha', 'browserify'],
frameworks: ['es6-shim', 'browserify', 'mocha'],
// list of files / patterns to load in the browser
files: [
'node_modules/es5-shim/es5-shim.js',
'test/loopback.test.js',
'test/model.test.js',
// [rfeng] Browserified common/models/application.js
@ -63,6 +62,7 @@ module.exports = function(config) {
// Which plugins to enable
plugins: [
'karma-browserify',
'karma-es6-shim',
'karma-mocha',
'karma-phantomjs-launcher',
'karma-chrome-launcher',
@ -104,7 +104,9 @@ module.exports = function(config) {
'superagent',
'supertest',
],
// transform: ['coffeeify'],
transform: [
['babelify', {presets: 'es2015'}],
],
debug: true,
// noParse: ['jquery'],
watch: true,