The substitute character
(CTRL-Z
)
stops file streams
on some Windows commands when in text mode. This includes the
type
command in cmd.exe
.
As a consequence that character should be avoided in non-binary files.
As opposed to Windows, Unix requires text files to end with a newline character.
However please remember that Windows might print these as if two newlines were present instead.
The BOM is a special character at the beginning of a file indicating its endianness and character encoding.
Since it creates issues with shebangs and adds little value to UTF-8, it is better not to add it to new files. However if a BOM is present in input, it should be properly handled. Fortunately this is the default behavior of Node.js core methods, so this should usually not create any issues.
Character encoding, newlines and EOF behavior should be specified with editorconfig. They can also be enforced with tools like ESLint and Prettier.
Avoid the
substitute character
(CTRL-Z
) in non-binary files.
End files with a newline.
Use editorconfig.