Skip to content

Commit

Permalink
Setup beautify and jshint to run on project files
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Feb 4, 2016
1 parent 45bfe4d commit 9680b5f
Show file tree
Hide file tree
Showing 11 changed files with 553 additions and 528 deletions.
9 changes: 9 additions & 0 deletions .jshintignore
@@ -0,0 +1,9 @@
js/bin/**
js/test/resources/**
node_modules/**
python/**
target/**
tools/**
test/underscore-min.js
test/underscore.js
web/third-party/**
5 changes: 5 additions & 0 deletions .jshintrc
@@ -0,0 +1,5 @@
{
"curly": true,
"eqeqeq": true,
"nocomma": true
}
10 changes: 6 additions & 4 deletions js/lib/beautify.js
Expand Up @@ -879,13 +879,15 @@ if (!Object.values) {
if (is_array(previous_flags.mode) && (last_type === 'TK_START_EXPR' || last_type === 'TK_COMMA')) {
// if we're preserving inline,
// allow newline between comma and next brace.
if (flags.inline_frame) {
if (last_type === 'TK_COMMA' || opt.space_in_paren ) {
output.space_before_token = true;
}

if (opt.brace_style === 'collapse-preserve-inline' &&
(last_type === 'TK_COMMA' || (last_type === 'TK_START_EXPR' && flags.inline_frame ))) {
allow_wrap_or_preserved_newline();
flags.inline_frame = true;
previous_flags.multiline_frame = previous_flags.multiline_frame || flags.multiline_frame;
flags.multiline_frame = false;
} else if (last_type === 'TK_COMMA') {
output.space_before_token = true;
}
} else if (last_type !== 'TK_OPERATOR' && last_type !== 'TK_START_EXPR') {
if (last_type === 'TK_START_BLOCK') {
Expand Down
1 change: 1 addition & 0 deletions js/test/shell-smoke-test.sh
Expand Up @@ -194,6 +194,7 @@ test_cli_js_beautify()

unset HOME
export USERPROFILE=$SCRIPT_DIR/resources/indent11chars
# node -p 'process.env["USERPROFILE"] || process.env["HOME"] || "unset"'
$CLI_SCRIPT $TEST_TEMP/example1-default.js | diff -q $TEST_TEMP/example1-indent11chars.js - || {
echo "js-beautify output for $TEST_TEMP/example1-default.js was expected to be identical for same HOME and USERPROFILE settings."
cleanup 1
Expand Down
18 changes: 18 additions & 0 deletions jsbeautifyrc
@@ -0,0 +1,18 @@
{
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse-preserve-inline",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0
}
204 changes: 102 additions & 102 deletions test/data/css/tests.js

Large diffs are not rendered by default.

0 comments on commit 9680b5f

Please sign in to comment.