You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2014/09/05 20:14:12 UTC

[07/50] git commit: Add JSCS config file

Add JSCS config file

But not running it as part of `npm test` yet.

See discussion here:
http://markmail.org/thread/rzzvn2ax3tqzabfw

JSHint people want to focus on syntax linting and are dropping style oriented
options. They recommends using JSCS (in addition to JSHint) for style:
https://github.com/jshint/jshint/issues/1339

JSCS has recently added the options dropped from JSHint.
https://github.com/mdevils/node-jscs/issues/102

This commit contains a JSCS config file with some basic settings that generate
very few errors with the existing cordova-cli and lib code.

My goal is to eventually run JSCS together with JSHint as part of `npm test`.
The nice thing about JSCS is that style flame wars can be way more structured
with it as we can argue about very specific well named JSCS config options :)

I'm using it with SublimeLinter-jscs
https://sublime.wbond.net/packages/SublimeLinter-jscs


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/b4a485ec
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/b4a485ec
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/b4a485ec

Branch: refs/heads/master
Commit: b4a485ec2437127f93f493335c8996cf905abecb
Parents: 628d810
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Thu Jul 31 13:42:47 2014 -0400
Committer: Anis Kadri <an...@apache.org>
Committed: Fri Sep 5 11:12:17 2014 -0700

----------------------------------------------------------------------
 cordova-lib/.jscs.json | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/b4a485ec/cordova-lib/.jscs.json
----------------------------------------------------------------------
diff --git a/cordova-lib/.jscs.json b/cordova-lib/.jscs.json
new file mode 100644
index 0000000..5cc7e26
--- /dev/null
+++ b/cordova-lib/.jscs.json
@@ -0,0 +1,24 @@
+{
+    "disallowMixedSpacesAndTabs": true,
+    "disallowTrailingWhitespace": true,
+    "validateLineBreaks": "LF",
+    "validateIndentation": 4,
+    "requireLineFeedAtFileEnd": true,
+
+    "disallowSpaceAfterPrefixUnaryOperators": true,
+    "disallowSpaceBeforePostfixUnaryOperators": true,
+    "requireSpaceAfterLineComment": true,
+    "requireCapitalizedConstructors": true,
+
+    "disallowSpacesInNamedFunctionExpression": {
+        "beforeOpeningRoundBrace": true
+    },
+
+    "requireSpaceAfterKeywords": [
+      "if",
+      "else",
+      "for",
+      "while",
+      "do"
+    ]
+}