Skip to content

Commit

Permalink
core: add eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mjeanroy committed Nov 16, 2016
1 parent 3da64ce commit e522c6e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "google",
"parserOptions": {
"ecmaVersion": 6,
},
"env": {
"node": true
},
"rules": {
"max-len": [2, 140, 2]
}
}
16 changes: 13 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
* SOFTWARE.
*/

const fs = require('fs');
const path = require('path');
const gulp = require('gulp');
const jasmine = require('gulp-jasmine');
const babel = require('gulp-babel');
const del = require('del');
const eslint = require('gulp-eslint');

gulp.task('test', ['build'], () => {
return gulp
Expand All @@ -37,13 +37,23 @@ gulp.task('test', ['build'], () => {

gulp.task('clean', () => {
return del([
path.join(__dirname, 'dist')
path.join(__dirname, 'dist'),
]);
});

gulp.task('build', ['clean'], () => {
gulp.task('build', ['clean', 'lint'], () => {
return gulp
.src(path.join(__dirname, 'src', 'index.js'))
.pipe(babel())
.pipe(gulp.dest(path.join(__dirname, 'dist')));
});

gulp.task('lint', () => {
const srcFiles = path.join(__dirname, 'src/**/*.js');
const testFiles = path.join(__dirname, 'test/**/*.js');
return gulp
.src([srcFiles, testFiles])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Rollup plugin to add license banner to the final bundle",
"main": "dist/index.js",
"scripts": {
"lint": "gulp lint",
"clean": "gulp clean",
"build": "gulp build",
"test": "gulp test"
Expand All @@ -24,8 +25,11 @@
"babel": "6.5.2",
"babel-preset-es2015": "6.18.0",
"del": "2.2.2",
"eslint": "^3.10.2",
"eslint-config-google": "^0.7.0",
"gulp": "3.9.1",
"gulp-babel": "6.1.2",
"gulp-eslint": "^3.0.1",
"gulp-jasmine": "2.4.2",
"jasmine-core": "2.5.2"
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MagicString = require('magic-string');

const EOL = '\n';

module.exports = function (options) {
module.exports = (options) => {
return {
transformBundle(code) {
const file = path.resolve(options.file);
Expand Down

0 comments on commit e522c6e

Please sign in to comment.