As we all know, the linebreaks (new line) used in Windows are usually carriage returns (CR) followed by a line feed (LF) i.e. (CRLF) whereas, Linux and Unix use a simple line feed (LF)
Now, in my case, my build server uses supports Linux and Unix format so, below rule is working perfectly on build server:
linebreak-style: ["error", "unix"]
But I am doing development on Windows and I need to update rule on each git pull/git push as below,
linebreak-style: ["error", "windows"]
So, is there any way to write a generic linebreak-style rule to support both environments, Linux/Unix and Windows?
Note: I am using ECMAScript6[js], WebStorm[ide] for development
Any solutions/suggestions would be highly appreciated. Thanks!
ESLint comes with a large number of built-in rules and you can add more rules through plugins. You can modify which rules your project uses either using configuration comments or configuration files. To change a rule setting, you must set the rule ID equal to one of these values: "off" or 0 - turn the rule off.
What is Linebreak style? The linebreaks (new lines) used in windows operating system are usually carriage returns (CR) followed by a line feed (LF) making it a carriage return line feed (CRLF) whereas Linux and Unix use a simple line feed (LF).
Whereas Windows follows the original convention of a carriage return plus a line feed ( CRLF ) for line endings, operating systems like Linux and Mac use only the line feed ( LF ) character. The history of these two control characters dates back to the era of the typewriter.
I spent time trying to find how to shut off the linkbreak-style and lost it due to reverting some of my code I thought others my like to have this as well.
In the .eslintrc
file you can also set linebreak-style
to 0
which shuts off the linebreak feature:
module.exports = { extends: 'google', quotes: [2, 'single'], globals: { SwaggerEditor: false }, env: { browser: true }, rules:{ "linebreak-style": 0 // <---------- } };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With