Skip to content

Commit

Permalink
Added jscs, jshint, travis configs. Configured lint, test and cover s…
Browse files Browse the repository at this point in the history
…cripts. Configured tests
  • Loading branch information
SwinX committed Dec 12, 2015
1 parent 8be85e6 commit d0a92fe
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
node_modules
coverage
97 changes: 97 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"excludeFiles": [
".git",
"node_modules",
"/coverage"
],
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": {
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"disallowSpacesInConditionalExpression": {
"afterTest": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"requireBlocksOnNewline": true,
"disallowPaddingNewlinesInBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"requireSpaceBeforeBinaryOperators": [
"=",
"+",
"-",
"/",
"*",
"==",
"===",
"!=",
"!=="
],

"requireSpaceAfterBinaryOperators": [
"=",
",",
"+",
"-",
"/",
"*",
"==",
"===",
"!=",
"!=="
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowKeywords": ["with"],
"disallowMultipleLineStrings": true,
"disallowMultipleLineBreaks": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"validateIndentation": 4,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowKeywordsOnNewLine": ["else", "catch"],
"requireLineFeedAtFileEnd": true,
"requireCapitalizedConstructors": true,
"safeContextKeyword": ["_this"],
"disallowYodaConditions": true
}
2 changes: 2 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
/coverage
26 changes: 26 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"freeze": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"nonew": true,
"quotmark": "single",
"undef": true,
"unused": "vars",
"strict": true,
"trailing": true,
"maxparams": 3,
"node": true,
"laxbreak": true,
"overrides": {
"test/**": {
"mocha": true
}
}
}
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
node_js:
- '4.0.0'
- '0.12'
- '0.10'
script:
- npm test --coverage
3 changes: 2 additions & 1 deletion bin/find
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env node

'use strict';
// Do not limit stack trace
Error.stackTraceLimit = Infinity;

require('../lib/cli.js').run()
require('../lib/cli.js').run();
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ module.exports = require('coa').Cmd()
.long('tree')
.flag()
.end()
.act(function (opts) {
.act(function(opts) {
console.log(opts);
});
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
},
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"pretest": "npm run lint",
"lint": "jshint . && jscs .",
"test": "istanbul test _mocha -- --recursive test/",
"cover": "npm run test --cover"
},
"repository": {
"type": "git",
Expand All @@ -29,5 +32,12 @@
"dependencies": {
"bem-walk": "0.0.4",
"coa": "^1.0.1"
},
"devDependencies": {
"chai": "^3.4.1",
"istanbul": "^0.4.1",
"jscs": "^2.7.0",
"jshint": "^2.9.1-rc1",
"mocha": "^2.3.4"
}
}
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require ./test/setup
4 changes: 4 additions & 0 deletions test/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';

var chai = require('chai');
global.assert = chai.assert;

0 comments on commit d0a92fe

Please sign in to comment.