Add JS style checker
This commit is contained in:
Родитель
4f43f962ae
Коммит
25d7610c69
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"disallowSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"return",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"requireSpacesInFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
}
|
||||
}
|
|
@ -20,6 +20,7 @@
|
|||
"jQuery": true,
|
||||
"Ember": true,
|
||||
"Handlebars": true,
|
||||
"DS": true
|
||||
"DS": true,
|
||||
"Promise": true
|
||||
}
|
||||
}
|
||||
|
|
36
Gruntfile.js
36
Gruntfile.js
|
@ -2,7 +2,7 @@
|
|||
'use strict';
|
||||
var LIVERELOAD_PORT = 35729;
|
||||
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
|
||||
var mountFolder = function (connect, dir) {
|
||||
var mountFolder = function(connect, dir) {
|
||||
return connect.static(require('path').resolve(dir));
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ var mountFolder = function (connect, dir) {
|
|||
// use this if you want to match all subfolders:
|
||||
// 'test/spec/**/*.js'
|
||||
|
||||
module.exports = function (grunt) {
|
||||
module.exports = function(grunt) {
|
||||
// show elapsed time at the end
|
||||
require('time-grunt')(grunt);
|
||||
// load all grunt tasks
|
||||
|
@ -24,6 +24,13 @@ module.exports = function (grunt) {
|
|||
dist: 'dist'
|
||||
};
|
||||
|
||||
var sourceFiles = [
|
||||
'Gruntfile.js',
|
||||
'<%= yeoman.app %>/scripts/{,*/}*.js',
|
||||
'!<%= yeoman.app %>/scripts/vendor/*',
|
||||
'test/spec/{,*/}*.js'
|
||||
];
|
||||
|
||||
grunt.initConfig({
|
||||
yeoman: yeomanConfig,
|
||||
watch: {
|
||||
|
@ -60,7 +67,7 @@ module.exports = function (grunt) {
|
|||
},
|
||||
livereload: {
|
||||
options: {
|
||||
middleware: function (connect) {
|
||||
middleware: function(connect) {
|
||||
return [
|
||||
lrSnippet,
|
||||
mountFolder(connect, '.tmp'),
|
||||
|
@ -71,7 +78,7 @@ module.exports = function (grunt) {
|
|||
},
|
||||
test: {
|
||||
options: {
|
||||
middleware: function (connect) {
|
||||
middleware: function(connect) {
|
||||
return [
|
||||
mountFolder(connect, 'test'),
|
||||
mountFolder(connect, '.tmp')
|
||||
|
@ -81,7 +88,7 @@ module.exports = function (grunt) {
|
|||
},
|
||||
dist: {
|
||||
options: {
|
||||
middleware: function (connect) {
|
||||
middleware: function(connect) {
|
||||
return [
|
||||
mountFolder(connect, yeomanConfig.dist)
|
||||
];
|
||||
|
@ -107,17 +114,15 @@ module.exports = function (grunt) {
|
|||
},
|
||||
server: '.tmp'
|
||||
},
|
||||
jscs: {
|
||||
source: sourceFiles
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
jshintrc: '.jshintrc',
|
||||
reporter: require('jshint-stylish')
|
||||
},
|
||||
all: [
|
||||
'Gruntfile.js',
|
||||
'<%= yeoman.app %>/scripts/{,*/}*.js',
|
||||
'!<%= yeoman.app %>/scripts/vendor/*',
|
||||
'test/spec/{,*/}*.js'
|
||||
]
|
||||
source: sourceFiles
|
||||
},
|
||||
mocha: {
|
||||
all: {
|
||||
|
@ -314,7 +319,7 @@ module.exports = function (grunt) {
|
|||
neuter: {
|
||||
app: {
|
||||
options: {
|
||||
filepathTransform: function (filepath) {
|
||||
filepathTransform: function(filepath) {
|
||||
return yeomanConfig.app + '/' + filepath;
|
||||
}
|
||||
},
|
||||
|
@ -324,12 +329,12 @@ module.exports = function (grunt) {
|
|||
}
|
||||
});
|
||||
|
||||
grunt.registerTask('server', function (target) {
|
||||
grunt.registerTask('server', function(target) {
|
||||
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
|
||||
grunt.task.run(['serve:' + target]);
|
||||
});
|
||||
|
||||
grunt.registerTask('serve', function (target) {
|
||||
grunt.registerTask('serve', function(target) {
|
||||
if (target === 'dist') {
|
||||
return grunt.task.run(['build', 'open', 'connect:dist:keepalive']);
|
||||
}
|
||||
|
@ -347,6 +352,8 @@ module.exports = function (grunt) {
|
|||
});
|
||||
|
||||
grunt.registerTask('test', [
|
||||
'jshint',
|
||||
'jscs',
|
||||
'clean:server',
|
||||
'replace:app',
|
||||
'concurrent:test',
|
||||
|
@ -379,6 +386,7 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.registerTask('default', [
|
||||
'jshint',
|
||||
'jscs',
|
||||
'test',
|
||||
'build'
|
||||
]);
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
HighFidelity.EpisodeEditController = Ember.ObjectController.extend({
|
||||
needs: 'episode',
|
||||
actions: {
|
||||
save: function(){
|
||||
var _this = this;
|
||||
|
||||
this.get('buffer').forEach(function(attr) {
|
||||
_this.get('controllers.episode.model')
|
||||
.set(attr.key, attr.value);
|
||||
});
|
||||
|
||||
this.transitionToRoute('episode',this.get('model'));
|
||||
}
|
||||
}
|
||||
});
|
|
@ -19,6 +19,7 @@
|
|||
"grunt-contrib-watch": "~0.5.2",
|
||||
"grunt-ember-templates": "0.4.14",
|
||||
"grunt-gh-pages": "^0.9.1",
|
||||
"grunt-jscs-checker": "^0.4.4",
|
||||
"grunt-mocha": "~0.4.1",
|
||||
"grunt-neuter": "~0.5.0",
|
||||
"grunt-open": "~0.2.0",
|
||||
|
|
Загрузка…
Ссылка в новой задаче