Skip to content

Commit

Permalink
chore(package): update eslint-config-dustinspecker to version 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
greenkeeperio-bot authored and dustinspecker committed Jan 14, 2016
1 parent 6f315e1 commit 5d2ebdd
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 184 deletions.
101 changes: 0 additions & 101 deletions .jscsrc

This file was deleted.

22 changes: 0 additions & 22 deletions .jshintrc

This file was deleted.

55 changes: 24 additions & 31 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,54 @@
'use strict';
import alex from 'gulp-alex';
import babel from 'gulp-babel';
import babelCompiler from 'babel-core';
import del from 'del';
import gulp from 'gulp';
import gulpIf from 'gulp-if';
import eslint from 'gulp-eslint';
import istanbul from 'gulp-istanbul';
import jscs from 'gulp-jscs';
import jshint from 'gulp-jshint';
import mocha from 'gulp-mocha';
import plumber from 'gulp-plumber';
'use strict'
import alex from 'gulp-alex'
import babel from 'gulp-babel'
import babelCompiler from 'babel-core'
import del from 'del'
import gulp from 'gulp'
import gulpIf from 'gulp-if'
import eslint from 'gulp-eslint'
import istanbul from 'gulp-istanbul'
import mocha from 'gulp-mocha'
import plumber from 'gulp-plumber'

const cwd = process.cwd()

, configFiles = './gulpfile.babel.js'
, srcFiles = 'src/*.js'
, testFiles = 'test/*.js'

, destDir = './lib/';
, destDir = './lib/'

let watching = false;
let watching = false

gulp.task('clean', () => del(destDir));
gulp.task('clean', () => del(destDir))

gulp.task('alex', () =>
gulp.src('./README.md')
.pipe(alex())
.pipe(alex.reporter())
.pipe(alex.reporter('fail'))
);
)

gulp.task('lint', ['alex'], () =>
gulp.src([configFiles, srcFiles, testFiles])
.pipe(eslint())
.pipe(eslint.formatEach('./node_modules/eslint-path-formatter'))
.pipe(gulpIf(!watching, eslint.failOnError()))
.pipe(jscs())
.pipe(jscs.reporter())
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(gulpIf(!watching, jshint.reporter('fail')))
);
)

gulp.task('compile', ['clean', 'lint'], () =>
gulp.src(srcFiles)
.pipe(babel())
.pipe(gulp.dest(destDir))
);
)

gulp.task('build', ['compile']);
gulp.task('build', ['compile'])

gulp.task('pre:test', ['build'], () =>
gulp.src([`${destDir}**/*.js`])
.pipe(istanbul())
.pipe(istanbul.hookRequire())
);
)

gulp.task('test', ['pre:test'], () =>
gulp.src([testFiles])
Expand All @@ -69,11 +62,11 @@ gulp.task('test', ['pre:test'], () =>
.on('end', () => {
// Something in this task changes the process CWD and causes chaos.
// This line changes back to the original CWD.
process.chdir(cwd);
process.chdir(cwd)
})
);
)

gulp.task('watch', () => {
watching = true;
gulp.watch([srcFiles, testFiles], ['test']);
});
watching = true
gulp.watch([srcFiles, testFiles], ['test'])
})
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"chai": "^3.0.0",
"coveralls": "^2.11.2",
"del": "^2.0.0",
"eslint-config-dustinspecker": "^0.2.5",
"eslint-config-dustinspecker": "^0.3.1",
"eslint-path-formatter": "^0.1.1",
"eslint-plugin-new-with-error": "^1.1.0",
"eslint-plugin-no-use-extend-native": "^0.3.1",
Expand All @@ -45,10 +45,7 @@
"gulp-eslint": "^1.0.0",
"gulp-if": "^2.0.0",
"gulp-istanbul": "^0.10.0",
"gulp-jscs": "^3.0.0",
"gulp-jshint": "^2.0.0",
"gulp-mocha": "^2.1.0",
"gulp-plumber": "^1.0.1",
"jshint": "^2.8.0"
"gulp-plumber": "^1.0.1"
}
}
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
import jsTypes from 'js-types';
'use strict'
import jsTypes from 'js-types'

const lowerCaseTypes = jsTypes.map(type => type.toLowerCase());
const lowerCaseTypes = jsTypes.map(type => type.toLowerCase())

/**
* Determine if a type is JS type
Expand All @@ -10,8 +10,8 @@ const lowerCaseTypes = jsTypes.map(type => type.toLowerCase());
*/
module.exports = function isJsType(type) {
if (typeof type !== 'string') {
throw new TypeError('Expected type to be a string');
throw new TypeError('Expected type to be a string')
}

return lowerCaseTypes.indexOf(type.toLowerCase()) > -1;
};
return lowerCaseTypes.indexOf(type.toLowerCase()) > -1
}
35 changes: 16 additions & 19 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
/* global describe, it */
'use strict';
import {expect} from 'chai';
import isJsType from '../lib/';
'use strict'
import {expect} from 'chai'
import isJsType from '../lib/'

describe('is-js-type', () => {
it('should throw TypeError if type is not a string', () => {
function test() {
isJsType();
}

expect(test).to.throw(TypeError, /Expected type to be a string/);
});
const test = () => isJsType()
expect(test).to.throw(TypeError, /Expected type to be a string/)
})

it('should return false for non js types', () => {
expect(isJsType('gulp')).to.eql(false);
expect(isJsType('cat')).to.eql(false);
});
expect(isJsType('gulp')).to.eql(false)
expect(isJsType('cat')).to.eql(false)
})

it('should return true for js types', () => {
expect(isJsType('Array')).to.eql(true);
expect(isJsType('Error')).to.eql(true);
});
expect(isJsType('Array')).to.eql(true)
expect(isJsType('Error')).to.eql(true)
})

it('should be case insensitive', () => {
expect(isJsType('array')).to.eql(true);
expect(isJsType('ARRAY')).to.eql(true);
});
});
expect(isJsType('array')).to.eql(true)
expect(isJsType('ARRAY')).to.eql(true)
})
})

0 comments on commit 5d2ebdd

Please sign in to comment.