From 371fc71a095e13e646d6b87ab2ac57657d46902e Mon Sep 17 00:00:00 2001 From: Christopher McCulloh Date: Wed, 30 Sep 2015 13:54:05 -0400 Subject: [PATCH 1/3] (sasquatch) moving towards sasquatch --- linters/.jsfmtrc | 67 ++++++++++++++++++++++++++++ linters/EsFormatter.sublime-settings | 57 ++++++++++++++--------- linters/INSTALL.md | 13 ++++++ 3 files changed, 115 insertions(+), 22 deletions(-) create mode 100644 linters/.jsfmtrc create mode 100644 linters/INSTALL.md diff --git a/linters/.jsfmtrc b/linters/.jsfmtrc new file mode 100644 index 0000000..cf692f3 --- /dev/null +++ b/linters/.jsfmtrc @@ -0,0 +1,67 @@ +{ + "autoformat": true, + "extensions": + [ + "js" + ], + "options": { + "indent": { + "value": "\t", + "BinaryExpression": 1, + "ConditionalExpression": 1 + }, + "quotes": { + "type": "single", + "avoidEscape": true + }, + "whiteSpace": { + "value": " ", + "removeTrailing": 1, + "before": { + "ArgumentListArrayExpression": 0, + "ArgumentListFunctionExpression": 0, + "ArgumentListObjectExpression": 0, + "BlockComment": 0, + "IfStatementClosingBrace": 1, + "IfStatementConditionalClosing": 0, + "IfStatementOpeningBrace": 1 + }, + "after": { + "ArgumentListArrayExpression": 0, + "ArgumentListFunctionExpression": 0, + "ArgumentListObjectExpression": 0, + "FunctionReservedWord": 1, + "FunctionName" : 1 + } + }, + "lineBreak": { + "value": "\n", + "before": { + "EndOfFile": 2, + "FunctionExpression": 0, + "FunctionExpressionClosingBrace": 1, + "ObjectExpressionClosingBrace": 1 + }, + "after": { + "FunctionExpressionOpeningBrace": 1, + "FunctionDeclarationOpeningBrace": 1, + "IfStatement": 1, + "IfStatementOpeningBrace": 1, + "IfStatementClosingBrace": 2, + "ElseIfStatementOpeningBrace": 1, + "ElseIfStatementClosingBrace": 2, + "ElseStatementOpeningBrace": 1, + "ElseStatementClosingBrace": 2 + } + }, + "plugins": [ + "esformatter-quotes", + "esformatter-semicolons", + "esformatter-braces", + "esformatter-dot-notation", + "esformatter-spaced-lined-comment", + "esformatter-var-each", + "esformatter-jsx-ignore" + ] + } +} \ No newline at end of file diff --git a/linters/EsFormatter.sublime-settings b/linters/EsFormatter.sublime-settings index abfbb2d..993fd4d 100644 --- a/linters/EsFormatter.sublime-settings +++ b/linters/EsFormatter.sublime-settings @@ -5,11 +5,34 @@ // EsFormatter specific options // default are specified here https://github.com/millermedeiros/esformatter/blob/master/lib/preset/default.json "format_options" : { - "indent": { - "value": " ", + "value": "\t", "BinaryExpression": 1, - "ConditionalExpression": 1, + "ConditionalExpression": 1 + }, + "quotes": { + "type": "single", + "avoidEscape": true + }, + "whiteSpace": { + "value": " ", + "removeTrailing": 1, + "before": { + "ArgumentListArrayExpression": 0, + "ArgumentListFunctionExpression": 0, + "ArgumentListObjectExpression": 0, + "BlockComment": 0, + "IfStatementClosingBrace": 1, + "IfStatementConditionalClosing": 0, + "IfStatementOpeningBrace": 1 + }, + "after": { + "ArgumentListArrayExpression": 0, + "ArgumentListFunctionExpression": 0, + "ArgumentListObjectExpression": 0, + "FunctionReservedWord": 1, + "FunctionName" : 1 + } }, "lineBreak": { "value": "\n", @@ -31,25 +54,15 @@ "ElseStatementClosingBrace": 2 } }, - "whiteSpace": { - "value": " ", - "removeTrailing": 1, - "before": { - "ArgumentListArrayExpression": 0, - "ArgumentListFunctionExpression": 0, - "ArgumentListObjectExpression": 0, - "BlockComment": 0, - "IfStatementClosingBrace": 0, - "LineComment": 0 - }, - "after": { - "ArgumentListArrayExpression": 0, - "ArgumentListFunctionExpression": 0, - "ArgumentListObjectExpression": 0, - "CallExpression": 0, - "FunctionReservedWord": 1, - } - } + "plugins": [ + "esformatter-quotes", + "esformatter-semicolons", + "esformatter-braces", + "esformatter-dot-notation", + "esformatter-spaced-lined-comment", + "esformatter-var-each", + "esformatter-jsx-ignore" + ] } } \ No newline at end of file diff --git a/linters/INSTALL.md b/linters/INSTALL.md new file mode 100644 index 0000000..4b6d74a --- /dev/null +++ b/linters/INSTALL.md @@ -0,0 +1,13 @@ +# Installing plugins for Sublime's jsfmt (esformatter) + +https://github.com/ionutvmi/sublime-jsfmt + +## spaced-comment +https://github.com/briandipalma/esformatter-spaced-lined-comment + +If you want to use a plugin that is not installed by default you will need to follow the next steps: + +1. Go to the packages folder in terminal (find by Preferences -> Browse Packages) +1. cd into the jsfmt folder. +1. Install the plugins you need. `npm i esformatter-quotes && npm i esformatter-semicolons && npm i esformatter-braces && npm i esformatter-dot-notation && npm i esformatter-spaced-lined-comment && npm i esformatter-jsx-ignore && npm i esformatter-var-each` +1. Go to your jsfmt settings file and add the name of the plugin in the plugins array. From c2d6111bdf599b7ad4aa755edad500c4e9ce5f49 Mon Sep 17 00:00:00 2001 From: Christopher McCulloh Date: Wed, 30 Sep 2015 14:02:31 -0400 Subject: [PATCH 2/3] (sasquatch) deals with checks failing --- linters/.jsfmtrc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/linters/.jsfmtrc b/linters/.jsfmtrc index cf692f3..b066c80 100644 --- a/linters/.jsfmtrc +++ b/linters/.jsfmtrc @@ -39,7 +39,7 @@ "before": { "EndOfFile": 2, "FunctionExpression": 0, - "FunctionExpressionClosingBrace": 1, + "FunctionExpressionClosingBrace": 0, "ObjectExpressionClosingBrace": 1 }, "after": { @@ -47,11 +47,11 @@ "FunctionDeclarationOpeningBrace": 1, "IfStatement": 1, "IfStatementOpeningBrace": 1, - "IfStatementClosingBrace": 2, + "IfStatementClosingBrace": -1,//Don't apply this rule, it puts a blank line padding between closing braces in nested ifs "ElseIfStatementOpeningBrace": 1, - "ElseIfStatementClosingBrace": 2, + "ElseIfStatementClosingBrace": -1, "ElseStatementOpeningBrace": 1, - "ElseStatementClosingBrace": 2 + "ElseStatementClosingBrace": -1 } }, "plugins": [ @@ -59,9 +59,7 @@ "esformatter-semicolons", "esformatter-braces", "esformatter-dot-notation", - "esformatter-spaced-lined-comment", - "esformatter-var-each", - "esformatter-jsx-ignore" + "esformatter-spaced-lined-comment" ] } } \ No newline at end of file From b9182e145b0b1b98bf01d9f9bc5d4b7898164f2f Mon Sep 17 00:00:00 2001 From: Christopher McCulloh Date: Wed, 30 Sep 2015 14:03:24 -0400 Subject: [PATCH 3/3] (sasquatch) oops --- linters/.jsfmtrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linters/.jsfmtrc b/linters/.jsfmtrc index b066c80..c524501 100644 --- a/linters/.jsfmtrc +++ b/linters/.jsfmtrc @@ -39,7 +39,7 @@ "before": { "EndOfFile": 2, "FunctionExpression": 0, - "FunctionExpressionClosingBrace": 0, + "FunctionExpressionClosingBrace": 1, "ObjectExpressionClosingBrace": 1 }, "after": { @@ -47,7 +47,7 @@ "FunctionDeclarationOpeningBrace": 1, "IfStatement": 1, "IfStatementOpeningBrace": 1, - "IfStatementClosingBrace": -1,//Don't apply this rule, it puts a blank line padding between closing braces in nested ifs + "IfStatementClosingBrace": -1,//Don't apply this rule "ElseIfStatementOpeningBrace": 1, "ElseIfStatementClosingBrace": -1, "ElseStatementOpeningBrace": 1,