Hi,
The js-beautify will remove the last new line before inside the HTML script tag. For example the new line in the following HTML script,
<head>
<script>
mocha.setup('bdd');
</script>
</head>
will be removed after js-beautify reformatted the file,
<head>
<script>
mocha.setup('bdd');
</script>
</head>
However, the problem is ESLint will complaint that a newline required at end of file but not found (eol-last).
May I know if we can configure js-beautify not to remove the last newline?
+1
+2
It does the same thing with javascript files. I would like an option to preserve the trailing new line at the end of the file that would also add a new line at the end of the file if it doesn't already have one.
Thanks!
it helps if remove the extension Beautify
that's confused and bothering when using ESLint
For those wondering how to enable this on the command line, it is provided by the -n
flag.
I may be missing something obvious here, but is there a way to have -n
add a newline at the end of the file, but at the same time __not__ add newline at the end of script
or style
elements, like so:
<script>
console.log()
</script>
<style>
body {}
</style>
I would like the resulting markup to be...
<script>
console.log()
</script>
<style>
body {}
</style>
... with a newline after `.
Thanks!
@jonkri
Settings overrides should work for this. Set the html (or root) setting to true
and set the value for js
and css
children to false
. It would look something like this.
```json
{
"end_with_newline": true,
"html": {
"js": {
"end_with_newline": false
},
"css": {
"end_with_newline": false
}
}
}
@bitwiseman: Brilliant! Thanks a lot! :slightly_smiling_face:
@jonkri
Settings overrides should work for this. Set the html (or root) setting totrue
and set the value forjs
andcss
children tofalse
. It would look something like this.{ "end_with_newline": true, "html": { "js": { "end_with_newline": false }, "css": { "end_with_newline": false } } }
It triggers this "autofix".
"atom-beautify":
d:
with_newline: true
But my scss file still not ending with new line.
I had to disable "Beautify on save" 馃槥
@nelson6e65
This is not atom-beautify, sorry. You'll need to address the issue in that project.