Merge branch 'main' into json-invalid-wrap-with-line-length-and-signed-number

This commit is contained in:
Liam Newman 2023-04-28 09:28:12 -07:00 committed by GitHub
commit 9b61173b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 270 additions and 2784 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -17,19 +17,14 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu, windows, macos ]
python-version: [3.7, 3.8, 3.9, '3.10']
python-version: [3.8, '3.10', 3.11]
include:
- python-version: 3.7
node-version: 12
- python-version: 3.8
node-version: 14
- python-version: 3.9
node-version: 16
- python-version: '3.10'
node-version: 16
exclude:
- os: windows
python-version: 2.7
node-version: 18
- python-version: 3.11
node-version: 20
steps:
- uses: actions/checkout@v2
- name: Set up Node ${{ matrix.node-version }}

View File

@ -141,7 +141,7 @@ To use `js-beautify` as a `node` library (after install locally), import and cal
The configuration option names are the same as the CLI names but with underscores instead of dashes. For example, `--indent-size 2 --space-in-empty-paren` would be `{ indent_size: 2, space_in_empty_paren: true }`.
```js
var beautify = require('js-beautify').js,
var beautify = require('js-beautify/js').js,
fs = require('fs');
fs.readFile('foo.js', 'utf8', function (err, data) {

3001
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -51,22 +51,22 @@
"dependencies": {
"config-chain": "^1.1.13",
"editorconfig": "^0.15.3",
"glob": "^8.0.3",
"glob": "^8.1.0",
"nopt": "^6.0.0"
},
"devDependencies": {
"ansi-regex": "^6.0.1",
"benchmark": "^2.1.4",
"codemirror": "^5.65.2",
"jquery": "^3.6.0",
"jshint": "^2.13.4",
"minimist": "^1.2.6",
"mocha": "^10.0.0",
"codemirror": "^5.65.13",
"jquery": "^3.6.4",
"jshint": "^2.13.6",
"minimist": "^1.2.8",
"mocha": "^10.2.0",
"mustache": "^4.2.0",
"requirejs": "^2.3.6",
"serve": "^14.0.1",
"serve": "^14.2.0",
"strip-ansi": "^7.0.1",
"webpack": "^5.74.0",
"webpack": "^5.81.0",
"webpack-cli": "^4.10.0"
}
}

View File

@ -38,7 +38,7 @@ def beautify(string, opts=None):
def beautify_file(file_name, opts=None):
_main = __import__("cssbeautifier", globals(), locals(), ["_main"])._main
return _main.beautify_file(file, opts)
return _main.beautify_file(file_name, opts)
def usage(stream=sys.stdout):

View File

@ -52,7 +52,6 @@ def beautify_file(file_name, opts=None):
def usage(stream=sys.stdout):
print(
"cssbeautifier.py@"
+ __version__
@ -102,7 +101,6 @@ Rarely needed options:
def main():
argv = sys.argv[1:]
try:

View File

@ -67,7 +67,6 @@ def beautify_file(file_name, opts=default_options()):
def usage(stream=sys.stdout):
print(
"cssbeautifier.py@"
+ __version__
@ -384,7 +383,6 @@ class Beautifier:
if self._options.brace_style == "expand":
self._output.add_new_line(True)
elif self._ch == ":":
for i in range(0, len(self.NON_SEMICOLON_NEWLINE_PROPERTY)):
if self._input.lookBack(self.NON_SEMICOLON_NEWLINE_PROPERTY[i]):
insideNonSemiColonValues = True

View File

@ -87,7 +87,6 @@ def beautify_file(file_name, opts=default_options()):
def usage(stream=sys.stdout):
print(
"jsbeautifier.py@"
+ __version__
@ -156,7 +155,6 @@ Rarely needed options:
def main():
argv = sys.argv[1:]
try:

View File

@ -27,7 +27,6 @@ import re
class Directives:
def __init__(self, start_block_pattern, end_block_pattern):
self.__directives_block_pattern = re.compile(
start_block_pattern + r" beautify( \w+[:]\w+)+ " + end_block_pattern
)

View File

@ -204,7 +204,6 @@ class IndentStringCache:
class Output:
def __init__(self, options, baseIndentString=""):
self.__indent_cache = IndentStringCache(options, baseIndentString)
self.raw = False
self._end_with_newline = options.end_with_newline

View File

@ -171,7 +171,6 @@ class TemplatablePattern(Pattern):
resulting_string or self.__patterns.django_value.read()
)
if not self._excluded.django:
resulting_string = (
resulting_string or self.__patterns.django_comment.read()
)

View File

@ -1213,7 +1213,7 @@ class Beautifier:
or current_token.previous.text == ")"
)
):
# This conditionial checks backtick strings and makes no changes
# This conditional checks backtick strings and makes no changes
pass
elif self.start_of_statement(current_token):
# The conditional starts the statement if appropriate.
@ -1379,7 +1379,6 @@ class Beautifier:
and self._options.preserve_newlines
and current_token.text in Tokenizer.positionable_operators
):
isColon = current_token.text == ":"
isTernaryColon = isColon and in_ternary
isOtherColon = isColon and not in_ternary

View File

@ -342,7 +342,6 @@ class Tokenizer(BaseTokenizer):
return None
def _read_regexp(self, c, previous_token):
if c == "/" and self.allowRegExOrXML(previous_token):
# handle regexp
resulting_string = self._input.next()
@ -425,7 +424,6 @@ class Tokenizer(BaseTokenizer):
resulting_string = ""
if c == "#":
# she-bang
if self._is_first_token():
resulting_string = self._patterns.shebang.read()
@ -471,7 +469,6 @@ class Tokenizer(BaseTokenizer):
self._input.back()
elif c == "<" and self._is_first_token():
if self._patterns.html_comment_start.read():
c = "<!--"
while self._input.hasNext() and not self._input.testChar(

View File

@ -59,7 +59,7 @@
} }
space_after_anon_function (default false) - should the space before an anonymous function's parens be added, "function()" vs "function ()",
NOTE: This option is overriden by jslint_happy (i.e. if jslint_happy is true, space_after_anon_function is true by design)
NOTE: This option is overridden by jslint_happy (i.e. if jslint_happy is true, space_after_anon_function is true by design)
brace_style (default "collapse") - "collapse" | "expand" | "end-expand" | "none" | any of the former + ",preserve-inline"
put braces on the same line as control statements (default), or put braces on own line (Allman / ANSI style), or just put end braces on own line, or attempt to keep them where they are.

View File

@ -16,7 +16,7 @@ $(function() {
the.editor = CodeMirror.fromTextArea(textArea, {
lineNumbers: true
});
setPreferredColorScheme();
set_editor_mode();
the.editor.focus();
@ -37,6 +37,7 @@ $(function() {
});
}
setPreferredColorScheme();
$(window).bind('keydown', function(e) {
if ((e.ctrlKey || e.metaKey) && e.keyCode === 13) {