Skip to content

Commit

Permalink
include jscs and jshint validation using gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecasar committed Sep 5, 2015
1 parent 4cbe402 commit d45ae65
Show file tree
Hide file tree
Showing 6 changed files with 173 additions and 22 deletions.
72 changes: 72 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"esnext": true,
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowEmptyBlocks": true,
"disallowSpacesInCallExpression": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeBinaryOperators": [
","
],
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowYodaConditions": true,
"disallowKeywords": [ "with" ],
"disallowKeywordsOnNewLine": ["else"],
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowMultipleVarDecl": true,
"disallowSpaceBeforeComma": true,
"disallowSpaceBeforeSemicolon": true,
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireBlocksOnNewline": 1,
"requireCommaBeforeLineBreak": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true,
"requireDotNotation": true,
"requireSpacesInForStatement": true,
"requireSpaceBetweenArguments": true,
"requireCurlyBraces": [
"do"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"case",
"return",
"try",
"catch",
"typeof"
],
"requirePaddingNewLinesBeforeLineComments": {
"allExcept": "firstAfterCurly"
},
"requirePaddingNewLinesAfterBlocks": true,
"requireSemicolons": true,
"safeContextKeyword": "_this",
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"validateIndentation": "\t"
}
54 changes: 54 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"asi": false,
"bitwise": true,
"boss": false,
"browser": true,
"curly": true,
"debug": false,
"eqeqeq": true,
"eqnull": true,
"es3": false,
"esnext": false,
"evil": false,
"expr": false,
"forin": true,
"freeze": true,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"latedef": "nofunc",
"loopfunc": true,
"maxcomplexity": 11,
"maxdepth": 5,
"maxerr": false,
"maxparams": 10,
"maxstatements": 40,
"moz": false,
"noarg": true,
"node": true,
"nonbsp": true,
"nonew": true,
"notypeof": false,
"noyield": false,
"plusplus": false,
"proto": false,
"scripturl": false,
"shadow": false,
"strict": false,
"supernew": false,
"undef": true,
"unused": false,
"validthis": false,

"globals": {
"assert": true,
"Platform": true,
"Polymer": true,
"Promise": true,
"suite": true,
"test": true,
"WCT": true,
"ga": true
}
}
15 changes: 15 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict';

// Include Gulp & Tools We'll Use
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();


// Load tasks for web-component-tester
// Adds tasks for `gulp test:local` and `gulp test:remote`
try { require('web-component-tester').gulp.init(gulp); } catch (err) {}

// Load custom tasks from the `tasks` directory
require('require-dir')('./tasks', {
recurse: true
});
18 changes: 2 additions & 16 deletions input-password.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
* {
box-sizing: border-box;
}
:host {
position: relative;
display: inline-block;
display: flex;
flex-direction: row;
text-align: inherit;
color: #ccc;
}

:host:hover {
cursor: text;
}
input, button {
input,
button {
margin:0;
border:1px solid #CCC;
outline: none;
Expand Down
12 changes: 6 additions & 6 deletions input-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

/**
* Fired when the value of is shown.
* @event showValue
* @event showValue
*/

/**
/**
* Fired when the value of is hidden.
* @event hideValue
* @event hideValue
*/

properties: {
Expand Down Expand Up @@ -144,21 +144,21 @@
/**
* Observer for visible property
*/
_visibleChanged: function(){
_visibleChanged: function() {
this[this.visible ? 'showValue' : 'hideValue']();
},

/**
* Get the text of the button for show action
*/
getShowText: function(){
getShowText: function() {
return this.toggleText.split('/')[0];
},

/**
* Get the text of the button for hide action
*/
getHideText: function(){
getHideText: function() {
return this.toggleText.split('/')[1] || this.showText;
},

Expand Down
24 changes: 24 additions & 0 deletions tasks/jshint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

// Lint JavaScript
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;

gulp.task('jshint', function() {
return gulp.src([
'**/*.html',
'**/*.js',
'!bower_components/**/*',
'!node_modules/**/*'
])
.pipe(reload({
stream: true,
once: true
}))
.pipe($.jshint.extract()) // Extract JS from .html files
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.if(!browserSync.active, $.jshint.reporter('fail')));
});

0 comments on commit d45ae65

Please sign in to comment.