Skip to content

Commit

Permalink
Merge pull request #271 from matthewmorgan/upgrade-tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
rchavarria committed Apr 10, 2017
2 parents 5595e2d + 35394bb commit 8764748
Show file tree
Hide file tree
Showing 140 changed files with 3,345 additions and 2,687 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: node_js
node_js:
- '5.7'
- '7.8'
sudo: false
script:
- bin/fetch-configlet
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

Exercism exercises in ECMAScript 6

## Running Unit Test Suite
## Running the Unit Test Suite

[Node.js](https://nodejs.org) must be installed. Tests are run with
a [Gulp](http://gulpjs.com) task so `gulp-cli` tool must be installed
via `npm`
[Node.js](https://nodejs.org) must be installed. We recommend using the latest stable version. Tests are run with
a [Gulp](http://gulpjs.com) task so the `gulp-cli` tool must be installed via `npm`

% npm install -g gulp-cli

Then, `make` commands will install other dependencies as needed.

### Linting Your Code
This project uses [eslint](https://github.com/eslint/eslint) to help you write quality JavaScript code by checking for common formatting errors, enforcing style rules, and suggesting changes that conform to best practices.

% npm run lint-test


### All Assignments

% make
Expand Down
79 changes: 41 additions & 38 deletions exercises/accumulate/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,68 @@ const gulp = require('gulp'),
eslint = require('gulp-eslint'),
jasmine = require('gulp-jasmine'),
babel = require('gulp-babel'),
polyfill = require('babel/polyfill'),
polyfill = require('babel-polyfill'),
del = require('del'),
argv = require('yargs').argv,
argv = require('yargs').argv,
inputDir = getInputDirectory(argv),
outputDir = getOutputDirectory(argv);

// Gulp tasks definition

gulp.task('default', [ 'test' ]);
gulp.task('default', ['test']);

gulp.task('test', [ 'babel' ], function () {
return gulp.src([ outputDir + '/*.spec.js' ])
gulp.task('test', ['babel'], function () {
return gulp.src([outputDir + '/*.spec.js'])
.pipe(jasmine());
});

gulp.task('babel', function () {
return gulp.src([ inputDir + '/*.js', inputDir + '/lib/*.js' ])
.pipe(babel())
return gulp.src([inputDir + '/*.js', inputDir + '/lib/*.js'])
.pipe(babel({
plugins: ["babel-plugin-transform-object-rest-spread"].map(require.resolve),
presets: ['babel-preset-env'].map(require.resolve)
}))
.pipe(gulp.dest(outputDir));
});

gulp.task('lint', function () {
return gulp.src([ inputDir + '/*.js' ])
return gulp.src([inputDir + '/*.js'])
.pipe(eslint({
envs: [
envs: [
'es6' //turns on all es6 features except modules
],
rules: {
rules: {
// full documentation here : http://eslint.org/docs/rules

// Possible errors
'comma-dangle': [2, 'never'], // don't let a comma at the end of object properties or array element
'no-cond-assign': [2, 'always'], // no assignments in conditional statements
'no-console': 2, // no console.log() statements in production code
'no-constant-condition': 2, // no constants in conditional statements
'no-control-regex': 2, // no control characters in regex's
'no-debugger': 2, // no debugger in productin code
'no-dupe-args': 2, // no duplicated arguments in functions
'no-dupe-keys': 2, // no duplicated keys when creating object literals
'no-duplicate-case': 2, // no duplicated `case` in `switch` statements
'comma-dangle': [2, 'never'], // don't let a comma at the end of object properties or array element
'no-cond-assign': [2, 'always'], // no assignments in conditional statements
'no-console': 2, // no console.log() statements in production code
'no-constant-condition': 2, // no constants in conditional statements
'no-control-regex': 2, // no control characters in regex's
'no-debugger': 2, // no debugger in productin code
'no-dupe-args': 2, // no duplicated arguments in functions
'no-dupe-keys': 2, // no duplicated keys when creating object literals
'no-duplicate-case': 2, // no duplicated `case` in `switch` statements
'no-empty-character-class': 2, // disallow the use of empty character classes in regular expressions
'no-empty': 2, // no empty blocks
'no-ex-assign': 2, // do not assign any value to an Exception raised
'no-extra-boolean-cast': 2, // do not use !!falseExpression to cast to boolean
'no-extra-parens': 2, // do not use extra parenthesis
'no-extra-semi': 2, // do not use extra semicolons
'no-func-assign': 2, // do not overwrite variables declared as functions
'no-inner-declarations': [2, 'both'], // only declare var's and funct's on function scope
'no-invalid-regexp': 2, // validates string arguments passed to RegExp constructor
'no-irregular-whitespace': 2, // detects special characters used as spaces
'no-negated-in-lhs': 2, // do not use negation in the left operand in an `in` expression
'no-obj-calls': 2, // prevent calling global objects as if they were functions
'no-regex-spaces': 2, // do not use multiple spaces in regex's
'no-sparse-arrays': 2, // do not use sparse arrays (empty elements)
'no-unexpected-multiline': 2, // Avoid code that looks like two expressions but is actually one
'no-unreachable': 2, // detects unreachable statements (after return, throw,...)
'use-isnan': 2, // do not compare with `NaN` value, use isNan() instead
'valid-jsdoc': 2, // ensure JSDoc comments are valid
'valid-typeof': 2 // ensure that the results of typeof are compared against a valid string
'no-empty': 2, // no empty blocks
'no-ex-assign': 2, // do not assign any value to an Exception raised
'no-extra-boolean-cast': 2, // do not use !!falseExpression to cast to boolean
'no-extra-parens': 2, // do not use extra parenthesis
'no-extra-semi': 2, // do not use extra semicolons
'no-func-assign': 2, // do not overwrite variables declared as functions
'no-inner-declarations': [2, 'both'], // only declare var's and funct's on function scope
'no-invalid-regexp': 2, // validates string arguments passed to RegExp constructor
'no-irregular-whitespace': 2, // detects special characters used as spaces
'no-negated-in-lhs': 2, // do not use negation in the left operand in an `in` expression
'no-obj-calls': 2, // prevent calling global objects as if they were functions
'no-regex-spaces': 2, // do not use multiple spaces in regex's
'no-sparse-arrays': 2, // do not use sparse arrays (empty elements)
'no-unexpected-multiline': 2, // Avoid code that looks like two expressions but is actually one
'no-unreachable': 2, // detects unreachable statements (after return, throw,...)
'use-isnan': 2, // do not compare with `NaN` value, use isNan() instead
'valid-jsdoc': 2, // ensure JSDoc comments are valid
'valid-typeof': 2 // ensure that the results of typeof are compared against a valid string
},
ecmaFeatures: {
'modules': true //this gives us modules :)
Expand All @@ -85,5 +88,5 @@ gulp.task('lint', function () {
});

gulp.task('clean', function (cb) {
del([ outputDir ], cb);
del([outputDir], cb);
});
9 changes: 7 additions & 2 deletions exercises/accumulate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
"url": "https://github.com/exercism/xecmascript"
},
"devDependencies": {
"babel": "~5.8.29",
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.3.3",
"babel-preset-es2015": "^6.24.1",
"del": "~2.0.2",
"gulp": "~3.9.0",
"gulp-babel": "~5.3.0",
"gulp-babel": "^6.1.2",
"gulp-eslint": "^1.1.0",
"gulp-jasmine": "~2.4.2",
"yargs": "~3.27.0"
Expand Down
79 changes: 41 additions & 38 deletions exercises/acronym/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,68 @@ const gulp = require('gulp'),
eslint = require('gulp-eslint'),
jasmine = require('gulp-jasmine'),
babel = require('gulp-babel'),
polyfill = require('babel/polyfill'),
polyfill = require('babel-polyfill'),
del = require('del'),
argv = require('yargs').argv,
argv = require('yargs').argv,
inputDir = getInputDirectory(argv),
outputDir = getOutputDirectory(argv);

// Gulp tasks definition

gulp.task('default', [ 'test' ]);
gulp.task('default', ['test']);

gulp.task('test', [ 'babel' ], function () {
return gulp.src([ outputDir + '/*.spec.js' ])
gulp.task('test', ['babel'], function () {
return gulp.src([outputDir + '/*.spec.js'])
.pipe(jasmine());
});

gulp.task('babel', function () {
return gulp.src([ inputDir + '/*.js', inputDir + '/lib/*.js' ])
.pipe(babel())
return gulp.src([inputDir + '/*.js', inputDir + '/lib/*.js'])
.pipe(babel({
plugins: ["babel-plugin-transform-object-rest-spread"].map(require.resolve),
presets: ['babel-preset-env'].map(require.resolve)
}))
.pipe(gulp.dest(outputDir));
});

gulp.task('lint', function () {
return gulp.src([ inputDir + '/*.js' ])
return gulp.src([inputDir + '/*.js'])
.pipe(eslint({
envs: [
envs: [
'es6' //turns on all es6 features except modules
],
rules: {
rules: {
// full documentation here : http://eslint.org/docs/rules

// Possible errors
'comma-dangle': [2, 'never'], // don't let a comma at the end of object properties or array element
'no-cond-assign': [2, 'always'], // no assignments in conditional statements
'no-console': 2, // no console.log() statements in production code
'no-constant-condition': 2, // no constants in conditional statements
'no-control-regex': 2, // no control characters in regex's
'no-debugger': 2, // no debugger in productin code
'no-dupe-args': 2, // no duplicated arguments in functions
'no-dupe-keys': 2, // no duplicated keys when creating object literals
'no-duplicate-case': 2, // no duplicated `case` in `switch` statements
'comma-dangle': [2, 'never'], // don't let a comma at the end of object properties or array element
'no-cond-assign': [2, 'always'], // no assignments in conditional statements
'no-console': 2, // no console.log() statements in production code
'no-constant-condition': 2, // no constants in conditional statements
'no-control-regex': 2, // no control characters in regex's
'no-debugger': 2, // no debugger in productin code
'no-dupe-args': 2, // no duplicated arguments in functions
'no-dupe-keys': 2, // no duplicated keys when creating object literals
'no-duplicate-case': 2, // no duplicated `case` in `switch` statements
'no-empty-character-class': 2, // disallow the use of empty character classes in regular expressions
'no-empty': 2, // no empty blocks
'no-ex-assign': 2, // do not assign any value to an Exception raised
'no-extra-boolean-cast': 2, // do not use !!falseExpression to cast to boolean
'no-extra-parens': 2, // do not use extra parenthesis
'no-extra-semi': 2, // do not use extra semicolons
'no-func-assign': 2, // do not overwrite variables declared as functions
'no-inner-declarations': [2, 'both'], // only declare var's and funct's on function scope
'no-invalid-regexp': 2, // validates string arguments passed to RegExp constructor
'no-irregular-whitespace': 2, // detects special characters used as spaces
'no-negated-in-lhs': 2, // do not use negation in the left operand in an `in` expression
'no-obj-calls': 2, // prevent calling global objects as if they were functions
'no-regex-spaces': 2, // do not use multiple spaces in regex's
'no-sparse-arrays': 2, // do not use sparse arrays (empty elements)
'no-unexpected-multiline': 2, // Avoid code that looks like two expressions but is actually one
'no-unreachable': 2, // detects unreachable statements (after return, throw,...)
'use-isnan': 2, // do not compare with `NaN` value, use isNan() instead
'valid-jsdoc': 2, // ensure JSDoc comments are valid
'valid-typeof': 2 // ensure that the results of typeof are compared against a valid string
'no-empty': 2, // no empty blocks
'no-ex-assign': 2, // do not assign any value to an Exception raised
'no-extra-boolean-cast': 2, // do not use !!falseExpression to cast to boolean
'no-extra-parens': 2, // do not use extra parenthesis
'no-extra-semi': 2, // do not use extra semicolons
'no-func-assign': 2, // do not overwrite variables declared as functions
'no-inner-declarations': [2, 'both'], // only declare var's and funct's on function scope
'no-invalid-regexp': 2, // validates string arguments passed to RegExp constructor
'no-irregular-whitespace': 2, // detects special characters used as spaces
'no-negated-in-lhs': 2, // do not use negation in the left operand in an `in` expression
'no-obj-calls': 2, // prevent calling global objects as if they were functions
'no-regex-spaces': 2, // do not use multiple spaces in regex's
'no-sparse-arrays': 2, // do not use sparse arrays (empty elements)
'no-unexpected-multiline': 2, // Avoid code that looks like two expressions but is actually one
'no-unreachable': 2, // detects unreachable statements (after return, throw,...)
'use-isnan': 2, // do not compare with `NaN` value, use isNan() instead
'valid-jsdoc': 2, // ensure JSDoc comments are valid
'valid-typeof': 2 // ensure that the results of typeof are compared against a valid string
},
ecmaFeatures: {
'modules': true //this gives us modules :)
Expand All @@ -85,5 +88,5 @@ gulp.task('lint', function () {
});

gulp.task('clean', function (cb) {
del([ outputDir ], cb);
del([outputDir], cb);
});
9 changes: 7 additions & 2 deletions exercises/acronym/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
"url": "https://github.com/exercism/xecmascript"
},
"devDependencies": {
"babel": "~5.8.29",
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.3.3",
"babel-preset-es2015": "^6.24.1",
"del": "~2.0.2",
"gulp": "~3.9.0",
"gulp-babel": "~5.3.0",
"gulp-babel": "^6.1.2",
"gulp-eslint": "^1.1.0",
"gulp-jasmine": "~2.4.2",
"yargs": "~3.27.0"
Expand Down
Loading

0 comments on commit 8764748

Please sign in to comment.