Skip to content
Open
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ To publish a release:
This is script will:

* Update README.md with correct cdn links
* Update CHANGLOG.md with the milestone description and a list of closed issues
* Update CHANGELOG.md with the milestone description and a list of closed issues
* Commit the built files to the `release` branch
* Publish the python version to PyPI
* Publish the javascript version to npm
Expand Down
4 changes: 2 additions & 2 deletions js/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ nopt.typeDefs.brace_style = {
validate: function(data, key, val) {
data[key] = val;
// TODO: expand-strict is obsolete, now identical to expand. Remove in future version
// TODO: collapse-preserve-inline is obselete, now identical to collapse,preserve-inline = true. Remove in future version
// TODO: collapse-preserve-inline is obsolete, now identical to collapse,preserve-inline = true. Remove in future version
var validVals = ["collapse", "collapse-preserve-inline", "expand", "end-expand", "expand-strict", "none", "preserve-inline"];
var valSplit = val.split(/[^a-zA-Z0-9_\-]+/); //Split will always return at least one parameter
for (var i = 0; i < valSplit.length; i++) {
Expand Down Expand Up @@ -709,4 +709,4 @@ function logToStdout(str, config) {
if (typeof config.quiet === "undefined" || !config.quiet) {
console.log(str);
}
}
}
16 changes: 8 additions & 8 deletions js/src/html/beautifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ Beautifier.prototype._print_custom_beatifier_text = function(printer, raw_token,
if (text) {
if (_beautifier) {

// call the Beautifier if avaliable
// call the Beautifier if available
var Child_options = function() {
this.eol = '\n';
};
Expand Down Expand Up @@ -822,12 +822,12 @@ Beautifier.prototype._do_optional_end_element = function(parser_token) {

} else if (parser_token.tag_name === 'colgroup') {
// DONE: A colgroup element’s end tag may be omitted if the colgroup element is not immediately followed by a space character or a comment.
// A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be omitted if a colgroup, thead, tfoot, tbody, or tr element is started.
result = result || this._tag_stack.try_pop('caption', ['table']);

} else if (parser_token.tag_name === 'thead') {
// A colgroup element's end tag may be ommitted if a thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
// A colgroup element's end tag may be omitted if a thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be omitted if a colgroup, thead, tfoot, tbody, or tr element is started.
result = result || this._tag_stack.try_pop('caption', ['table']);
result = result || this._tag_stack.try_pop('colgroup', ['table']);

Expand All @@ -837,8 +837,8 @@ Beautifier.prototype._do_optional_end_element = function(parser_token) {
} else if (parser_token.tag_name === 'tbody' || parser_token.tag_name === 'tfoot') {
// A thead element’s end tag may be omitted if the thead element is immediately followed by a tbody or tfoot element.
// A tbody element’s end tag may be omitted if the tbody element is immediately followed by a tbody or tfoot element, or if there is no more content in the parent element.
// A colgroup element's end tag may be ommitted if a thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
// A colgroup element's end tag may be omitted if a thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be omitted if a colgroup, thead, tfoot, tbody, or tr element is started.
result = result || this._tag_stack.try_pop('caption', ['table']);
result = result || this._tag_stack.try_pop('colgroup', ['table']);
result = result || this._tag_stack.try_pop('thead', ['table']);
Expand All @@ -849,8 +849,8 @@ Beautifier.prototype._do_optional_end_element = function(parser_token) {

} else if (parser_token.tag_name === 'tr') {
// A tr element’s end tag may be omitted if the tr element is immediately followed by another tr element, or if there is no more content in the parent element.
// A colgroup element's end tag may be ommitted if a thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be ommitted if a colgroup, thead, tfoot, tbody, or tr element is started.
// A colgroup element's end tag may be omitted if a thead, tfoot, tbody, or tr element is started.
// A caption element's end tag may be omitted if a colgroup, thead, tfoot, tbody, or tr element is started.
result = result || this._tag_stack.try_pop('caption', ['table']);
result = result || this._tag_stack.try_pop('colgroup', ['table']);
result = result || this._tag_stack.try_pop('tr', ['table', 'thead', 'tbody', 'tfoot']);
Expand Down
6 changes: 3 additions & 3 deletions js/src/javascript/beautifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ Beautifier.prototype.handle_word = function(current_token) {
} else if (reserved_word(this._flags.last_token, 'default') && this._last_last_text === 'export') {
this._output.space_before_token = true;
} else if (this._flags.last_token.text === 'declare') {
// accomodates Typescript declare function formatting
// accommodates Typescript declare function formatting
this._output.space_before_token = true;
} else {
this.print_newline();
Expand Down Expand Up @@ -1006,7 +1006,7 @@ Beautifier.prototype.handle_word = function(current_token) {
// no newline between 'return nnn'
this._output.space_before_token = true;
} else if (this._flags.last_token.text === 'declare' && reserved_array(current_token, ['var', 'let', 'const'])) {
// accomodates Typescript declare formatting
// accommodates Typescript declare formatting
this._output.space_before_token = true;
} else if (this._flags.last_token.type !== TOKEN.END_EXPR) {
if ((this._flags.last_token.type !== TOKEN.START_EXPR || !reserved_array(current_token, ['var', 'let', 'const'])) && this._flags.last_token.text !== ':') {
Expand Down Expand Up @@ -1316,7 +1316,7 @@ Beautifier.prototype.handle_operator = function(current_token) {
// a++ + ++b;
// a - -b
space_before = in_array(current_token.text, ['--', '-', '++', '+']) && in_array(this._flags.last_token.text, ['--', '-', '++', '+']);
// + and - are not unary when preceeded by -- or ++ operator
// + and - are not unary when proceeded by -- or ++ operator
// a-- + b
// a * +b
// a - -b
Expand Down
2 changes: 1 addition & 1 deletion js/test/core/test_inputscanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ describe('IndexScanner', function() {
assert.deepStrictEqual(inputText.get_regexp(pattern, matchFrom).toString(), '/ow/y');
});

it('should return pattern with flags appeded when the input is not a string', function() {
it('should return pattern with flags appended when the input is not a string', function() {
var inputText = new InputScanner("howdy");
var matchFrom = true;
var pattern = /ow/;
Expand Down
22 changes: 11 additions & 11 deletions js/test/shell-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -235,31 +235,31 @@ test_cli_js_beautify()
cleanup 1
}

# TODO: EditorConfig setting should NOT overide cli setting, but that is
# TODO: EditorConfig setting should NOT override cli setting, but that is
# the current by-design behavior, due to code limitations.

# file input scenario
SCENARIO=a
cd $TEST_TEMP/editorconfig || exit 1
$CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/crlf || exit 1
$CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/cr || exit 1
$CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -270,7 +270,7 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -279,7 +279,7 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -288,7 +288,7 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -300,23 +300,23 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/crlf || exit 1
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/cr || exit 1
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand Down Expand Up @@ -362,7 +362,7 @@ test_cli_js_beautify()

cd $SCRIPT_DIR/resources/configerror
$CLI_SCRIPT $TEST_TEMP/example1-default.js 2>&1 | grep -q "Error while loading beautifier configuration\." || {
echo "js-beautify output for $TEST_TEMP/example1-default.js was expected to be configration load error message."
echo "js-beautify output for $TEST_TEMP/example1-default.js was expected to be configuration load error message."
cleanup 1
}

Expand Down
2 changes: 1 addition & 1 deletion python/cssbeautifier/css/beautifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def beautify(self):
elif self._ch == "@":
self.preserveSingleSpace(isAfterSpace)

# deal with less propery mixins @{...}
# deal with less property mixins @{...}
if self._input.peek() == "{":
self.print_string(self._ch + self.eatString("}"))
else:
Expand Down
6 changes: 3 additions & 3 deletions python/jsbeautifier/javascript/beautifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ def handle_word(self, current_token):
):
self._output.space_before_token = True
elif self._flags.last_token.text == "declare":
# accomodates Typescript declare function formatting
# accommodates Typescript declare function formatting
self._output.space_before_token = True
else:
self.print_newline()
Expand Down Expand Up @@ -1132,7 +1132,7 @@ def handle_word(self, current_token):
elif self._flags.last_token.text == "declare" and reserved_array(
current_token, ["var", "let", "const"]
):
# accomodates Typescript declare formatting
# accommodates Typescript declare formatting
self._output.space_before_token = True
elif self._flags.last_token.type != TOKEN.END_EXPR:
if (
Expand Down Expand Up @@ -1492,7 +1492,7 @@ def handle_operator(self, current_token):
"++",
"+",
] and self._flags.last_token.text in ["--", "-", "++", "+"]
# + and - are not unary when preceeded by -- or ++ operator
# + and - are not unary when proceeded by -- or ++ operator
# a-- + b
# a * +b
# a - -b
Expand Down
20 changes: 10 additions & 10 deletions python/jsbeautifier/tests/shell-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,31 +260,31 @@ test_cli_js_beautify()
cleanup 1
}

# TODO: EditorConfig setting should NOT overide cli setting, but that is
# TODO: EditorConfig setting should NOT override cli setting, but that is
# the current by-design behavior, due to code limitations.

# file input scenario
SCENARIO=a
cd $TEST_TEMP/editorconfig || exit 1
$CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/crlf || exit 1
$CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/cr || exit 1
$CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js example.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -295,7 +295,7 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -304,7 +304,7 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -313,7 +313,7 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig > example-${SCENARIO}.js \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand All @@ -325,23 +325,23 @@ test_cli_js_beautify()
echo "cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js"
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/crlf || exit 1
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}

cd $TEST_TEMP/editorconfig/cr || exit 1
cat example.js | $CLI_SCRIPT --end-with-newline --indent-size 6 --editorconfig -o example-${SCENARIO}.js - \
&& diff -q example-${SCENARIO}.js example-ec.js || {
echo "EditorConfig setting should overide cli setting."
echo "EditorConfig setting should override cli setting."
diff example-${SCENARIO}.js example-ec.js | cat -t -e
cleanup 1
}
Expand Down
2 changes: 1 addition & 1 deletion test/data/css/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ exports.test_data = {
}
]
}, {
name: "Regresssion Tests",
name: "Regression Tests",
description: "General Regression tests for known issues",
options: [{ name: "selector_separator_newline", value: "false" }],
tests: [{
Expand Down
2 changes: 1 addition & 1 deletion test/data/html/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ exports.test_data = {
}]
}, {
name: "Tests for script and style Commented and cdata wapping (#1641)",
description: "Repect comment and cdata wrapping regardless of beautifier",
description: "Respect comment and cdata wrapping regardless of beautifier",
options: [
{ name: "templating", value: "'php'" }
],
Expand Down
6 changes: 3 additions & 3 deletions test/data/javascript/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3851,15 +3851,15 @@ exports.test_data = {
unchanged: [
'a = {',
' get b() {',
' retun 0;',
' return 0;',
' },',
' c: 1,',
' d: function() {}',
'};'
]
},
{
comment: "Issue 298 - do not under indent if/while/for condtionals experesions",
comment: "Issue 298 - do not under indent if/while/for conditionals expressions",
unchanged: [
'\\\'use strict\\\';',
'if ([].some(function() {',
Expand All @@ -3870,7 +3870,7 @@ exports.test_data = {
]
},
{
comment: "Issue 298 - do not under indent if/while/for condtionals experesions",
comment: "Issue 298 - do not under indent if/while/for conditionals expressions",
unchanged: [
'\\\'use strict\\\';',
'if ([].some(function() {',
Expand Down
Loading