Skip to content

Commit

Permalink
Adding JS and JSON checking, fixed syntax error.
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxsauce committed Feb 1, 2015
1 parent 1821502 commit 0b35173
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
13 changes: 11 additions & 2 deletions README.md
Expand Up @@ -38,8 +38,17 @@ meteor-boilerplate adds these meteor core packages by default:
##Deployment with Docker
This package includes a basic dockerfile for deploying built versions of your application. More instructions and development on this feature to come.

##Coding Standards
This boilerplate includes a `gulpfile.js` that includes a `cs` task that runs jscs and jshint on your codebase. All you have to do is run `gulp cs` in the project root, and you'll get a full report on all the coding standards issues in your project.
## Coding Standards
This project contains multiple tools for enforcing coding standards and checking for errors within the codebase. The standards are defined in the `.jscsrc` and `.jshintrc` files in the project root.

### Installation

* Change directory to the crowd.work directory, like: `cd /path/to/project`
* Run `npm install` to retrieve dependencies.

### Checking

To check your local codebase, run `gulp cs` from a console in the project root. An error report, if any, will be generated in the console.

##Folder Structure
The <code>/client</code>, <code>/server</code>, and <code>/lib</code> folders provide some basic app structure that I've found to be useful:
Expand Down
33 changes: 28 additions & 5 deletions gulpfile.js
Expand Up @@ -6,19 +6,42 @@

var gulp = require('gulp'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs');
jscs = require('gulp-jscs'),
jsonlint = require("gulp-jsonlint"),
runSequence = require('run-sequence');

/**
* @task lint
* @task JavaScript and JSON coding standards.
* Executes lint and style checkers on project JavaScript and JSON.
*/
gulp.task('cs', function (callback) {
runSequence('lintjson', 'lintjs', callback);
});

/**
* @task JSON lint.
* Checks JSON configuration files for errors.
*/
gulp.task('lintjson', function () {
return gulp.src([
'.jscsrc',
'.jshintrc'
])
.pipe(jsonlint())
.pipe(jsonlint.reporter());
});

/**
* @task JavaScript lint.
* Runs JSCS and JSLint on module, theme, and gulp files. Excludes all
* minified JavaScript files.
*/
gulp.task('cs', function () {
gulp.task('lintjs', function () {
return gulp.src([
'gulpfile.js',
'src/**/*.js',
'gulpfile.js'
'!src/.meteor/**/*.js',
'!src/packages/**/*.js',
'!src/packages/**/*.js'
])
.pipe(jshint())
.pipe(jshint.reporter('default'))
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -13,6 +13,8 @@
"devDependencies": {
"gulp": "~3.8.10",
"gulp-jscs": "^1.3.1",
"gulp-jshint": "^1.6.2"
"gulp-jshint": "^1.6.2",
"gulp-jsonlint": "^1.0.2",
"run-sequence": "^1.0.2"
}
}

0 comments on commit 0b35173

Please sign in to comment.