- use the latest git tag as the previous version
- restore/bump the version on master in `bump-prettier.js`
- use `stdio: "inherit"` for `npm publish` so that we could input the OTP
- do not use `--runInBand` for local `test:dist`
- remove `Updating integration snapshots`
- remove `Attach all files in dist/ folder`
* Add initial support for TOML in configuration files
* Missed brace
* Fix snapshots
* refactor: move loadToml to utils
* Use @iarna/toml
* Add tests for loadToml
* Fix test for CI
* Remove jest-extended
* Create snapshot for load-toml
* Add feat to docs
* lint docs
* Use @iarna/toml/parse-string
* Change path string
If you have
```js
a = b
```
we used to do
```js
group[a = b]
```
which works most of the time but has the unfortunate side effect that if the left part breaks, we're going to break the `=` as well. So you get
```js
{
a
} = \n
b
```
What this PR does it to add a group
```js
group[a group[= b]]
```
so that if the right hand side fits in one line, it should stay that way.
Note that there's a change with a comment being move but I think that it's fine. If I remember correctly, this test was to make sure that we didn't print invalid code, not that it had to be respected (that comment position is not something we really want to support in the first place).
Fixes#4645
Only apply to `alias` and `plain`/`quoteSingle`/`quoteDouble` with
- no backslash newline
- or no literal newline and `proseWrap: preserve`
- or no newline and `proseWrap: never`
- or no whitespace and `proseWrap: always`
in mapping items with implicit key, otherwise it's impossible to do prose wrapping.
* feat(markdown): only align lists if they're already aligned
* fix: handle single item with multiple leading spaces
* fix: empty items are considered not aligned
* Use destructuring for readability and optimzations at for loop length property
* Destructure variables for easy maintainability of code
* PR review fix
* refactor: fix linting
* Use destructures and refactor code for better readability
* Remove merge conflict line
* lint before commit
* Use destructuring for readability and optimzations at for loop length property
* Destructure variables for easy maintainability of code
* PR review fix
* refactor: fix linting
In addition to a tiny performance improvement outlined below,
the CPU profile of traverseDoc is now more readable.
Also anonymous arrow functions changed to named regular functions
so that they are properly displayed in the CPU profile,
and moved to outer scope where there's no closure
so that they aren't re-created (this change's performance is dependent
on JS engine implementation and optimization details).
Before (profile):
```
7129.9 ms 5.43 % 13349.9 ms 10.18 % traverseDocRec
7067.4 ms 5.39 % 11285.5 ms 8.60 % traverseDocRec
31.5 ms 0.02 % 1031.9 ms 0.79 % traverseDoc
23.6 ms 0.02 % 12313.4 ms 9.39 % traverseDoc
2.6 ms 0.00 % 0.3 ms 0.00 % (anonymous)
1.7 ms 0.00 % 1.7 ms 0.00 % call
1.6 ms 0.00 % 1.6 ms 0.00 % call
0.5 ms 0.00 % 0.5 ms 0.00 % conditionalGroup
0.4 ms 0.00 % 0.4 ms 0.00 % printDocToString$1
0.1 ms 0.00 % 0.1 ms 0.00 % printGenerically
0.1 ms 0.00 % 0.1 ms 0.00 % t
0.1 ms 0.00 % 0.1 ms 0.00 % ifBreak
0.1 ms 0.00 % 0.1 ms 0.00 % (anonymous)
0 ms 0 % 0.1 ms 0.00 % forEach
```
After (profile):
```
6937.9 ms 5.37 % 12872.5 ms 9.97 % traverseDoc
5944.0 ms 4.60 % 11047.3 ms 8.55 % propagateBreaks
735.7 ms 0.57 % 1358.3 ms 1.05 % findInDoc
257.9 ms 0.20 % 466.7 ms 0.36 % findInDoc
0.1 ms 0.00 % 0.1 ms 0.00 % has
0.1 ms 0.00 % 0.1 ms 0.00 % printArgumentsList
```
Before (performance):
```
cat ../LspLanguageService.js | NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --stdin-filepath LspLanguageService.js --loglevel debug --debug-repeat 1000 > /dev/null
Debugger listening on ws://127.0.0.1:9229/4b52c027-ef62-49d6-8770-179e805a0f43
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
[debug] normalized argv: {"color":true,"editorconfig":true,"stdin-filepath":"LspLanguageService.js","loglevel":"debug","debug-repeat":1000,"plugin-search-dir":[],"plugin":[],"ignore-path":".prettierignore","config-precedence":"cli-override","_":[]}
[debug] resolve config from '/Users/ivanbabak/_sompylasar/_github/prettier-2/LspLanguageService.js'
[debug] loaded options `null`
[debug] applied config-precedence (cli-override): {"filepath":"LspLanguageService.js"}
[debug] '--debug-repeat' option found, running formatWithCursor 1000 times.
[debug] '--debug-repeat' measurements for formatWithCursor: {
[debug] "repeat": 1000,
[debug] "hz": 7.774598830700336,
[debug] "ms": 128.624
[debug] }
```
After (performance):
```
cat ../LspLanguageService.js | NODE_ENV=production node --inspect-brk ./dist/bin-prettier.js --stdin-filepath LspLanguageService.js --loglevel debug --debug-repeat 1000 > /dev/null
Debugger listening on ws://127.0.0.1:9229/aa76e134-a68c-44ed-89a8-efb68bc46baa
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
[debug] normalized argv: {"color":true,"editorconfig":true,"stdin-filepath":"LspLanguageService.js","loglevel":"debug","debug-repeat":1000,"plugin-search-dir":[],"plugin":[],"ignore-path":".prettierignore","config-precedence":"cli-override","_":[]}
[debug] resolve config from '/Users/ivanbabak/_sompylasar/_github/prettier/LspLanguageService.js'
[debug] loaded options `null`
[debug] applied config-precedence (cli-override): {"filepath":"LspLanguageService.js"}
[debug] '--debug-repeat' option found, running formatWithCursor 1000 times.
[debug] '--debug-repeat' measurements for formatWithCursor: {
[debug] "repeat": 1000,
[debug] "hz": 7.888114977163907,
[debug] "ms": 126.773
[debug] }
```