I am using this config with jsbeautify 1.10.2 in Windows 10.
{
"indent_size": "2",
"indent_char": " ",
"max_preserve_newlines": "1",
"preserve_newlines": true,
"keep_array_indentation": false,
"break_chained_methods": false,
"indent_scripts": "normal",
"brace_style": "collapse-preserve-inline",
"space_before_conditional": true,
"unescape_strings": false,
"jslint_happy": false,
"end_with_newline": false,
"wrap_line_length": "160",
"indent_inner_html": false,
"comma_first": false,
"e4x": false,
"indent_empty_lines": false,
"wrap-attributes": "force-aligned",
"end-with-newline": "true",
"eol": "\crlf"
}`
And calling jsbeautity in this way:
js-beautify --config ./.jsbeautifyrc --replace ./apps/**/*.html
It throws this error:
SyntaxError: Unexpected token c in JSON at position 599
at JSON.parse (<anonymous>)
at exports.parse (c:\center\node_modules\config-chain\index.js:54:19)
at exports.json (c:\center\node_modules\config-chain\index.js:70:10)
at module.exports (c:\center\node_modules\config-chain\index.js:17:15)
at Object.exports.interpret (c:\center\node_modules\js-beautify\js\lib\cli.js:279:15)
at Object.<anonymous> (c:\center\node_modules\js-beautify\js\bin\js-beautify.js:4:5)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
Error while loading beautifier configuration.
Configuration file chain included:
c:\center\.jsbeautifyrc
c:\center\.jsbeautifyrc
c:\center\node_modules\js-beautify\js\lib/../config/defaults.json
if I remove the eol
key it works but of course it sets the end of line in a way I do not want to.
I have tried with \\crlf
/\crlf
and crlf
. But that just put that exact test in each new line.
Is this a know issue? I am declaring it wrongly?
The symbol for carriage return is \r (ASCII 13) and for linefeed is \n (ASCII 10). Try:
"eol": "\r\n"
CRLF is merely the abbreviation.