1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Add minimal code style to node-red-node (jscs)

Optional grunt task - grunt style
This commit is contained in:
dceejay 2015-05-11 16:17:47 +01:00
parent 36ac3817a7
commit 84f61a0466
3 changed files with 24 additions and 3 deletions

11
.jscsrc Normal file
View File

@ -0,0 +1,11 @@
{
"fileExtensions": [ ".js", "jscs" ],
"excludeFiles": [ "node_modules/**" ],
"validateIndentation": 4,
"requireCurlyBraces": true,
"disallowMixedSpacesAndTabs": true,
"disallowMultipleSpaces": {"allowEOLComments": true},
//"requireSemicolons": true,
//"validateParameterSeparator": ", ",
"requireSpaceAfterKeywords": ["do","for","if","else","switch","case","try","while"]
}

View File

@ -59,8 +59,15 @@ module.exports = function(grunt) {
inlinelint: { inlinelint: {
html: ['*/*/*.html'], html: ['*/*/*.html'],
options: { options: {
jshintrc:".jshintrc", jshintrc: ".jshintrc",
"reporter": require('jshint-stylish') reporter: require('jshint-stylish')
}
},
jscs: {
src: "*/*/*.js",
options: {
config: ".jscsrc",
reporter: "inline"
} }
} }
}); });
@ -68,6 +75,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-simple-mocha'); grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-lint-inline'); grunt.loadNpmTasks('grunt-lint-inline');
grunt.loadNpmTasks('grunt-jscs');
grunt.registerTask('default', ['jshint:all', 'inlinelint', 'simplemocha:all'] ); grunt.registerTask('default', ['jshint:all', 'inlinelint', 'simplemocha:all']);
grunt.registerTask('style', ['jscs']);
}; };

View File

@ -21,6 +21,7 @@
"grunt-simple-mocha": "0.4.0", "grunt-simple-mocha": "0.4.0",
"grunt-contrib-jshint": "0.11.0", "grunt-contrib-jshint": "0.11.0",
"grunt-lint-inline": "0.4.3", "grunt-lint-inline": "0.4.3",
"grunt-jscs": "0.8.*",
"jshint-stylish": "1.0.1", "jshint-stylish": "1.0.1",
"mocha": "2.1.0", "mocha": "2.1.0",
"should": "4.6.5", "should": "4.6.5",