Skip to content

Commit

Permalink
.jscs'd and .jshint'd
Browse files Browse the repository at this point in the history
  • Loading branch information
leeliu committed Aug 25, 2016
1 parent b34f6c6 commit 256c8b8
Show file tree
Hide file tree
Showing 7 changed files with 346 additions and 170 deletions.
114 changes: 114 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"disallowKeywords": [
"with"
],
"disallowKeywordsOnNewLine": [
"else"
],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleVarDecl": {
"allExcept": [
"undefined",
"required"
]
},
"disallowNewlineBeforeBlockStatements": true,
"disallowPaddingNewlinesInBlocks": {
"close": false,
"open": true
},
"disallowQuotedKeysInObjects": {
"allExcept": [
"reserved"
]
},
"disallowSpaceAfterObjectKeys": {
"allExcept": [
"aligned"
]
},
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforeComma": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeSemicolon": true,
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideArrayBrackets": "nested",
"disallowSpacesInsideBrackets": {
"allExcept": [ "[", "]", "{", "}" ]
},
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"disallowYodaConditions": true,
"requireBlocksOnNewline": 1,
"requireCapitalizedConstructors": true,
"requireCurlyBraces": {
"keywords": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"allExcept": [
"return",
"continue",
"break"
]
},
"requireDotNotation": true,
"requireLineFeedAtFileEnd": true,
"requireOperatorBeforeLineBreak": true,
"requireParenthesesAroundIIFE": true,
"requireSemicolons": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceAfterComma": true,
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch",
"typeof"
],
"requireSpaceAfterLineComment": {
"allExcept": ["/"]
},
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpaceBeforeKeywords": [
"else",
"while",
"catch"
],
"requireSpaceBeforeObjectValues": true,
"requireSpaceBetweenArguments": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInForStatement": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInsideObjectBrackets": {
"allExcept": [ "}", ")" ]
},
"safeContextKeyword": [
"self"
],
"validateIndentation": 4,
"validateQuoteMarks": "'"
}
17 changes: 17 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"esnext": true,
"node": true,
"browser": true,
"bitwise": true,
"eqeqeq": true,
"forin": true,
"latedef": true,
"noarg": true,
"nonew": true,
"undef": true,
"unused": true,
"latedef": "nofunc",
"predef": {
}
}

31 changes: 26 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
var os = require('os');
var grunt = require('grunt');
var path = require('path');
var pkg = require('./package.json');

require('load-grunt-tasks')(grunt);

module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
var files = ['./index.js', './Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'];
var buildOutputFile = os.platform() !== 'win32' ? 'logdna' : 'logdna.exe';

grunt.initConfig({
lineremover: {
nukebrowser: {
files: {
'node_modules/ws/package.json': 'node_modules/ws/package.json'
'node_modules/ws/package.json': path.join('node_modules', 'ws', 'package.json')
},
options: {
exclusionPattern: /browser/
}
}
},
exec: {
nexe: 'nexe -i index.js -o ' + buildOutputFile + ' -f -t ~/tmp -r 5.9.0',
nexe: { cmd: 'nexe -i index.js -o ' + buildOutputFile + ' -f -t ~/tmp -r 5.9.0', maxBuffer: 20000 * 1024 },
save_version: 'echo ' + pkg.version + ' > version',
fpm_osxpkg: 'fpm -s dir -t osxpkg --osxpkg-identifier-prefix com.logdna -n logdna-cli -v ' + pkg.version + ' --post-install ./scripts/post-install -f ./logdna=/usr/local/logdna/bin/logdna',
sign_pkg: 'productsign --sign "Developer ID Installer: Answerbook, Inc. (TT7664HMU3)" logdna-cli-' + pkg.version + '.pkg logdna-cli.pkg',
Expand Down Expand Up @@ -51,10 +56,26 @@ module.exports = function(grunt) {
dest: './.builds/windows/tools/'
}]
}
},
jshint: {
files: files,
options: {
jshintrc: '.jshintrc'
}
},
jscs: {
files: {
src: files
},
options: {
config: '.jscsrc',
esnext: true,
verbose: true,
fix: true
}
}
});
grunt.loadNpmTasks('grunt-line-remover');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('test', ['jscs', 'jshint']);
grunt.registerTask('build', ['lineremover', 'exec:nexe', 'exec:save_version']);
grunt.registerTask('linux', ['build', 'exec:fpm_rpm', 'exec:fpm_deb', 'exec:cp_rpm', 'exec:cp_deb', 'exec:gzip_linuxbin', 'exec:upload_linuxbin', 'exec:upload_linuxver', 'exec:upload_rpm', 'exec:upload_deb']);
grunt.registerTask('mac', ['build', 'exec:fpm_osxpkg', 'exec:sign_pkg', 'exec:rm_unsignedpkg', 'exec:gzip_macbin', 'exec:upload_macbin', 'exec:upload_macver', 'exec:upload_pkg']); // 'exec:verify_pkg', 'exec:install_pkg'
Expand Down
Loading

0 comments on commit 256c8b8

Please sign in to comment.