You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Config now includes force-crlf boolean option that makes sure, while enabled, json output prints with \r\n as new line characters. Default remains \n.
Example usage:
{
"patterns": ["**/*.json", "!**/node_modules/**/*", "!**/dist/**"],
....
"force-crlf": true
}
Usage with CLI matches other boolean arguments.
* [Feature] Ability to force crlf
* [Fix] stricter comparison when deciding to use crlf
* [Chore] Update remaining docs
--enforce-double-quotes surrounds all strings with double quotes
164
164
--enforce-single-quotes surrounds all strings with single quotes
165
165
--trim-trailing-commas omit trailing commas from objects and arrays
166
+
--force-crlf makes sure all line breaks are CRLF
166
167
--succeed-with-no-files succeed (exit code 0) if no files were found
167
168
--[no-]color force or disable colourful output of the diff
168
169
-v, --version output the version number
@@ -237,6 +238,7 @@ The configuration is an object with the following properties, described above, w
237
238
| enforce-double-quotes | enforceDoubleQuotes |
238
239
| enforce-single-quotes | enforceSingleQuotes |
239
240
| trim-trailing-commas | trimTrailingCommas |
241
+
| force-crlf | forceCrlf |
240
242
241
243
The parameter `config` will be ignored in configuration files. The extra parameter `patterns` can be set to an array of strings with paths or patterns instead of putting them to the command line.
242
244
@@ -347,6 +349,7 @@ The [`print`](#pretty-printing) method accepts an object `options` as the second
347
349
|`enforceDoubleQuotes`| will surround all strings with double quotes |
348
350
|`enforceSingleQuotes`| will surround all strings with single quotes |
349
351
|`trimTrailingCommas`| will omit all trailing commas after the last object entry or array item |
352
+
|`forceCrlf`| makes sure all line breaks are CRLF |
350
353
351
354
```js
352
355
// Just concatenate the tokens to produce the same output as was the input.
@@ -371,6 +374,8 @@ print(tokens, {
371
374
enforceDoubleQuotes:true,
372
375
trimTrailingCommas:true
373
376
})
377
+
// Same as `print(tokens, {})`, but uses \r\n for line breaks.
378
+
print(tokens, { forceCrlf:true })
374
379
```
375
380
376
381
Pretty-printing can be also used to preserve the contents of string literal in the output. For example, the following input:
0 commit comments