bwrrp / slimdom.js Goto Github PK
View Code? Open in Web Editor NEWFast, tiny, standards-compliant XML DOM implementation for node and the browser
License: MIT License
Fast, tiny, standards-compliant XML DOM implementation for node and the browser
License: MIT License
Main problem here is that W3C/web-platform-tests is a >500M repo, cloning it on every test run seems wasteful, especially given that we only need the 2.2M dom tests.
7.4.5
to 7.4.6
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@microsoft/api-extractor is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
It would be nice if we could bundle a .d.ts with the slimdom typings. The typescript compiler generates .d.ts files for each source file, but I'd prefer to bundle a single file and omit typings for private implementation details.
https://github.com/timocov/dts-bundle-generator may be an option, but currently seems to be incompatible with the default exports used in the codebase. Maybe if changing these to named will be enough?
7.4.7
to 7.4.8
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@microsoft/api-documenter is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | prettier |
Current Version | 1.13.7 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Some XML document may include extremely large textnodes.
The following code causes a crash:
const document = new slimdom.Document();
var element = document.createElement("element");
element.appendChild(document.createTextNode(Array.from({length: 6 * 10**6}).fill('X').join(''));
new XMLSerializer().serializeToString(element); // This line throws
I've experimented with typedoc earlier to generate docs, but there are still a few issues:
1.9.2
to 1.9.3
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
2019-04-10
The new version differs by 3 commits.
516a06d
1.9.3
a5526ea
Update changelog
c3d73ff
Handle out-of-order binding of identifiers to improve tree-shaking (#2803)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
See README.md#64
The new DOM standard adds prepend, append (https://dom.spec.whatwg.org/#interface-parentnode), before, after and replaceWith (https://dom.spec.whatwg.org/#interface-childnode) methods. These are a lot more convenient than the existing insertBefore, appendChild and replaceChild in various cases, as they accept multiple nodes and do not require a related node as argument.
Implementing this would be easier after #15, as multiple nodes need to be inserted as a document fragment.
7.3.14
to 7.3.15
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@microsoft/api-documenter is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
1.18.0
to 1.19.0
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 6 commits.
9af119d
1.19.0
b3f361c
Update changelog
456f4d2
Avoid variable from empty module name be empty (#3026)
17eaa43
Use id of last module in chunk as name base for auto-generated chunks (#3025)
871bfa0
Switch to a code-splitting build and update dependencies (#3020)
2443783
Unified file emission api (#2999)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Requires an implementation of DOMImplementation for spec compatibility.
0.66.2
to 0.66.3
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 9 commits.
d9696cc
Fix type issue
c5dadca
0.66.3
7af33e9
Update changelog
177b95e
Detect side-effects in method arguments of unknown strings (#2476)
7f4b543
Update changelog
ad21dd8
Assign chunk IDs before creating outputBundle chunks (#2483)
8a8721e
Update TypeScript and fix type errors (#2488)
b9e786d
Update changelog
2d2ae21
fix: plugin name in template string (#2470)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | lolex |
Current Version | 2.1.3 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
lolex is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 6 commits.
6c5b814
2.2.0
7e3031f
Prepare for new release
c6f920d
Merge pull request #137 from mAAdhaTTah/feature/requestAnimationFrame
7f47d15
Add support for requestAnimationFrame
68b51c2
determine timer type on construction
c08ff36
fix negative timeout bug
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Why is there a timeout in NotifyList.schedule() ?
So setting end before the previous end will collapse the range.
Some interfaces such as Element do not have a constructor according to the DOM standard. We could use an internal token argument to check if calls are coming from inside the library and throw a TypeError otherwise to match the correct behavior.
Branch | Build failing π¨ |
---|---|
Dependency | rollup |
Current Version | 0.54.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 4 commits.
4bd7a0a
0.54.1
77e3b44
Update changelog
74de841
Merge pull request #1871 from KingHenne/more-ts-fixes
b413df4
Fix two more ts compiler errors based on emitted d.ts files
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | typescript |
Current Version | 2.6.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
typescript is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
This release includes:
Download:
The new version differs by 30 commits.
54426a1
Update LKG
6513bed
Bundle fileName with CodeActionCommand (#19881) (#20118)
19b0a43
Merge pull request #20114 from Microsoft/dev/billti/port20109to2.6
ab1671a
Moved minified file exclusion
49b3dbd
Fixed internal safelist
c2a3837
Merge pull request #20079 from RyanCavanaugh/port20048
b9a548c
Squash port of PR #19542
f2931a1
Port PR #20048
df57cdc
Have CompletionEntryDetails source use a relative path (#19917) (#20022)
adfd5d3
Porting #19249 and #19968 to release-2.6 (#20002)
82f7bcb
Merge pull request #19931 from Microsoft/constEnumWithWatch
a2c1385
Ensure that enum member value is computed before using it
92ade59
For import completion of default import, convert module name to identifier (#19875) (#19883)
c56a822
Allow applyCodeActionCommand to take an array (#19870) (#19884)
047854d
Merge pull request #19817 from Microsoft/directoryRename
There are 30 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
The rollup config contains a list of types that should not be mangled when the library is minified. This is used to ensure that public types (i.e., those from the standard) still show recognizable names in JS debuggers. It seems this has broken recently, as we now get nodes and documents with constructor name "o" etc.
Branch | Build failing π¨ |
---|---|
Dependency | @types/chai |
Current Version | 4.0.4 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/chai is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
The following code causes the typescript compiler to error:
import { Node } from 'slimdom';
function test (node: Node) {
return node.ELEMENT_NODE;
}
TSError: β¨― Unable to compile TypeScript:
XXX: error TS2576: Property 'ELEMENT_NODE' is a static member of type 'Node'
The NODE_TYPE properties should be static as well as on the instance level
The current code uses amdefine to allow the library to load in node, but the experience could be better. Investigate what could be done to support browsers (with AMD) and node in parallel.
Branch | Build failing π¨ |
---|---|
Dependency | nyc |
Current Version | 11.4.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
nyc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 3 commits.
b473820
chore(release): 11.4.1
4e4f428
fix: explicitly update spawn-wrap (#748)
456fa20
docs: hide the header in the issue template on render [skip ci] (#731)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
23.1.4
to 23.10.0
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
ts-jest
, reloaded!ts-jest
Slack community where you can find some instant helpjest
, typescript
and babel
versionsThe new version differs by 293 commits.
0e5ffed
chore(release): 23.10.0
3665609
Merge pull request #734 from huafu/appveyor-optimizations
45d44d1
Merge branch 'master' into appveyor-optimizations
76e2fe5
ci(appveyor): cache npm versions as well
191c464
ci(appveyor): try to improve appveyor's config
0f31b42
Merge pull request #733 from huafu/fix-test-snap
661853a
Merge branch 'master' into fix-test-snap
aa7458a
Merge pull request #731 from kulshekhar/dependabot/npm_and_yarn/tslint-plugin-prettier-2.0.0
70775f1
ci(lint): run lint scripts in series instead of parallel
a18e919
style(fix): exclude package.json from tslint rules
011b580
test(config): stop using snapshots for pkg versions
7e5a3a1
build(deps-dev): bump tslint-plugin-prettier from 1.3.0 to 2.0.0
fbe90a9
Merge pull request #730 from kulshekhar/dependabot/npm_and_yarn/@types/node-10.10.1
a88456e
build(deps-dev): bump @types/node from 10.9.4 to 10.10.1
54fd239
Merge pull request #729 from kulshekhar/dependabot/npm_and_yarn/prettier-1.14.3
There are 250 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
They seem to be failing now, but nothing really changed on our side
The error InvalidStateError: InvalidStateError: Namespace prefix declarations cannot be used to undeclare a namespace (use a default namespace declaration instead)
is thrown when I use the property outerHTML
of an XML element in which the default namespace is set to an empty string.
I do believe this should be possible as it would make sense when we have to reset the default namespace to an empty string for a lot of child elements.
Repro case:
const {sync} = require('slimdom-sax-parser'); // "slimdom-sax-parser": "^1.1.3"
const xml =
`<a xmlns="http://www.example.com">
<pre:b xmlns:pre="http://www.example.com/test" xmlns="">
<c/>
</pre:b>
</a>`;
const documentNode = sync(xml);
console.log(documentNode.documentElement.outerHTML);
This new test fails:
it('does not introduce duplicate namespaces', () => {
const el = document.createElement('test');
document.appendChild(el);
document.appendChild(document.createComment('sibling'));
el.setAttributeNS('http://example.com/prrt','prrt:attr1', 'value');
el.setAttributeNS('http://example.com/prrt','prrt:attr2', 'value');
expect(el.outerHTML).toBe('<test xmlns:prrt="http://example.com/prrt" prrt:attr1="value" prrt:attr2="value"></test>');
});
Expected value to be:
"<test xmlns:prrt=\"http://example.com/prrt\" prrt:attr1=\"value\" prrt:attr2=\"value\"></test>"
Received:
"<test xmlns:prrt=\"http://example.com/prrt\" prrt:attr=\"value\" xmlns:prrt=\"http://example.com/prrt\" prrt:attr2=\"value\"/>"
I really do not know why this was only found today... This seems like such a common operation.
PR incoming!
In some cases it could be helpful to be able to create separate instances of the entire library, including its global document. We should add a way to create a new Context which exposes constructors that can subclass the normal types, but use the corresponding instance's global document.
Branch | Build failing π¨ |
---|---|
Dependency | prettier |
Current Version | 1.7.4 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
This release adds Markdown support, a new --insert-pragma
flag, fixes a number of formatting issues, adds support for some new experimental operators, and improves our editor integration support.
You can now run Prettier on Markdown files! π
The implementation is highly compliant with the CommonMark spec, and backed by the excellent remark-parse
package.
Word Wrap
One of Prettier's core features is its ability to wrap code at a specified line length. This applies to Markdown too, which means you can maintain nice and clean 80-character-wide Markdown files without having to re-adjust line breaks manually when you add or delete words.
Input:
VoilΓ ! In view, a humble vaudevillian veteran cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valourous visitation of a bygone vexation stands vivified and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition! The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honour to meet you and you may call me V.
Output:
VoilΓ ! In view, a humble vaudevillian veteran cast vicariously as both victim
and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity,
is a vestige of the vox populi, now vacant, vanished. However, this valourous
visitation of a bygone vexation stands vivified and has vowed to vanquish these
venal and virulent vermin vanguarding vice and vouchsafing the violently vicious
and voracious violation of volition! The only verdict is vengeance; a vendetta
held as a votive, not in vain, for the value and veracity of such shall one day
vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage
veers most verbose, so let me simply add that it's my very good honour to meet
you and you may call me V.
Note for CJK users: If your markdown renderer does not support CJK line ending, you'll have to use plugin like markdown-it-perfect-newline-for-cjk, hexo-filter-fix-cjk-spacing, etc. to remove additional spaces.
// Source δΈδΊδΈ εδΊε δΈε «δΉ
// Rendered content with unsupported renderer
δΈδΊδΈ εδΊε δΈε «δΉ
// Rendered content with supported renderer or via plugin
δΈδΊδΈεδΊε δΈε «δΉ
Code Formatting
Powered by Prettier's generic "multiparser", Prettier will format code blocks in Markdown! We use the language code provided with the code block to determine which language it is, and thus we can format any language that Prettier supports (including Markdown itself, if you're into that).
Input:
```js reallyUgly ( javascript ) ```.h1 { color : red } ```</pre></div> <p>Output:</p> <div class="highlight highlight-source-lisp"><pre>```js reallyUgly(javascript)<span class="pl-c"><span class="pl-c">;</span></span>.h1 { color: red<span class="pl-c"><span class="pl-c">;</span></span> } ```</pre></div> <blockquote> <p>Note: In some cases you may not want to format your code in Markdown, and just like in other languages, in Markdown you can use <code><!-- prettier-ignore --></code> before the code block to ignore it from formatting.</p> </blockquote> <p><strong>Lists</strong></p> <p>When rearranging list items, after running Prettier all the numbers will be fixed!</p> <p><a href="https://camo.githubusercontent.com/50f76500c503763c50019ad61ff531716ff7f3c9/687474703a2f2f672e7265636f726469742e636f2f4d4174616e5a4d5a526f2e676966" target="_blank"><img src="https://camo.githubusercontent.com/50f76500c503763c50019ad61ff531716ff7f3c9/687474703a2f2f672e7265636f726469742e636f2f4d4174616e5a4d5a526f2e676966" alt="Markdown Lists" style="max-width:100%;"></a></p> <blockquote> <p>Note: you can actually opt out of this by using <code>1.</code> for all list items if you want to optimize for cleaner diffs.</p> </blockquote> <p><strong>Tables</strong></p> <p>Tables will also automatically be adjusted to fit their contents. This could be completely unmaintainable without an automated tool.</p> <p><a href="https://camo.githubusercontent.com/7f33126347f155262873500e5068016d2e71a773/687474703a2f2f672e7265636f726469742e636f2f33356a61383836636b542e676966" target="_blank"><img src="https://camo.githubusercontent.com/7f33126347f155262873500e5068016d2e71a773/687474703a2f2f672e7265636f726469742e636f2f33356a61383836636b542e676966" alt="Markdown Tables" style="max-width:100%;"></a></p> <p><strong>Markdown-in-JS</strong></p> <p>By using either <code>md</code> or <code>markdown</code> tagged template literals, you can format markdown code inside JavaScript.</p> <div class="highlight highlight-source-js"><pre><span class="pl-k">const</span> <span class="pl-c1">markdown</span> <span class="pl-k">=</span> md<span class="pl-s"><span class="pl-pds">`</span></span> <span class="pl-s"> # heading</span> <span class="pl-s"></span> <span class="pl-s"> 1. list item</span> <span class="pl-s"><span class="pl-pds">`</span></span>;</pre></div> <h2>CLI</h2> <h3>Add option to insert <code>@format</code> to first docblock if absent (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2865" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="258974830" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2865">#2865</a>) by <a href="https://urls.greenkeeper.io/samouri" class="user-mention">@samouri</a></h3> <p>In 1.7, we added an option called <code>--require-pragma</code> to require files contain an <code>/** @format */</code> pragma to be formatted. In order to add this pragma to a large set of files you can now use <a href="https://prettier.io/docs/en/cli.html#insert-pragma"><code>--insert-pragma</code></a> flag.</p> <pre><code>prettier --write "folder/**/*.js" --insert-pragma </code></pre> <h3>Add <code>--loglevel</code> option (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2992" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="263707174" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2992">#2992</a>) by <a href="https://urls.greenkeeper.io/ikatyang" class="user-mention">@ikatyang</a></h3> <p>This <a href="https://prettier.io/docs/en/cli.html#loglevel">nifty feature</a> allows you to opt in (or out) of Prettier's logging. We've also cleaned up the logging substantially since 1.7.</p> <div class="highlight highlight-source-shell"><pre>$ prettier --loglevel=debug blarg $ ./bin/prettier.js --loglevel=debug blarg [debug] normalized argv: {<span class="pl-s"><span class="pl-pds">"</span>_<span class="pl-pds">"</span></span>:[<span class="pl-s"><span class="pl-pds">"</span>blarg<span class="pl-pds">"</span></span>],<span class="pl-s"><span class="pl-pds">"</span>bracket-spacing<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>color<span class="pl-pds">"</span></span>:true,<span class="pl-s"><span class="pl-pds">"</span>debug-check<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>debug-print-doc<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>flow-parser<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>insert-pragma<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>jsx-bracket-same-line<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>list-different<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>require-pragma<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>semi<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>single-quote<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>stdin<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>use-tabs<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>version<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>with-node-modules<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>write<span class="pl-pds">"</span></span>:false,<span class="pl-s"><span class="pl-pds">"</span>loglevel<span class="pl-pds">"</span></span>:<span class="pl-s"><span class="pl-pds">"</span>debug<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>ignore-path<span class="pl-pds">"</span></span>:<span class="pl-s"><span class="pl-pds">"</span>.prettierignore<span class="pl-pds">"</span></span>,<span class="pl-s"><span class="pl-pds">"</span>config-precedence<span class="pl-pds">"</span></span>:<span class="pl-s"><span class="pl-pds">"</span>cli-override<span class="pl-pds">"</span></span>} [error] No matching files. Patterns tried: blarg <span class="pl-k">!</span><span class="pl-k">**</span>/node_modules/<span class="pl-k">**</span> <span class="pl-k">!</span>./node_modules/<span class="pl-k">**</span> </pre></div> <h2>JavaScript</h2> <h3>Fix indentation for JSDoc comments (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2470" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="242554023" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2470">#2470</a>) by <a href="https://urls.greenkeeper.io/maxdeviant" class="user-mention">@maxdeviant</a></h3> <p>This has been a long-time known issue with Prettier. When formatting code that results in a change of indentation level, the JSDoc comments would end up being out of alignment. We're happy to report this is now fixed!</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-k">function</span> <span class="pl-en">theFunction2</span>(<span class="pl-smi">action$</span>, <span class="pl-smi">store</span>) { <span class="pl-c"><span class="pl-c">/*</span></span> <span class="pl-c"> * comments</span> <span class="pl-c"> <span class="pl-c">*/</span></span> <span class="pl-k">return</span> <span class="pl-c1">true</span>; } <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-k">function</span> <span class="pl-en">theFunction2</span>(<span class="pl-smi">action$</span>, <span class="pl-smi">store</span>) { <span class="pl-c"><span class="pl-c">/*</span></span> <span class="pl-c"> * comments</span> <span class="pl-c"> <span class="pl-c">*/</span></span> <span class="pl-k">return</span> <span class="pl-c1">true</span>; }</pre></div> <h3>Print pipeline and nullish-coalescing operators (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3036" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265544605" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3036">#3036</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3> <p>We've added support for two new proposed operators to Prettier: the <em>pipeline operator</em> and the <em>nullish coalescing operator</em>.</p> <p>The <a href="https://urls.greenkeeper.io/tc39/proposal-pipeline-operator/">pipeline operator</a> is currently a stage one proposal.</p> <blockquote> <p>This proposal introduces a new operator |> similar to F#, OCaml, Elixir, Elm, Julia, Hack, and LiveScript, as well as UNIX pipes. It's a backwards-compatible way of streamlining chained function calls in a readable, functional manner, and provides a practical alternative to extending built-in prototypes.</p> </blockquote> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-k">let</span> result <span class="pl-k">=</span> <span class="pl-en">exclaim</span>(<span class="pl-en">capitalize</span>(<span class="pl-en">doubleSay</span>(<span class="pl-s"><span class="pl-pds">"</span>hello<span class="pl-pds">"</span></span>))); <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-k">let</span> result <span class="pl-k">=</span> <span class="pl-s"><span class="pl-pds">"</span>hello<span class="pl-pds">"</span></span> <span class="pl-k">|</span><span class="pl-k">></span> doubleSay <span class="pl-k">|</span><span class="pl-k">></span> capitalize <span class="pl-k">|</span><span class="pl-k">></span> exclaim;</pre></div> <p>The <a href="https://urls.greenkeeper.io/tc39-transfer/proposal-nullish-coalescing">nullish coalescing operator</a> is another stage one proposal.</p> <blockquote> <p>When performing optional property access in a nested structure in conjunction with the optional chaining operator, it is often desired to provide a default value if the result of that property access is null or undefined.</p> </blockquote> <p>This operator is similar to <code>||</code> except it only evaluates the right-hand-side if the left is <code>undefined</code> or <code>null</code>, not <code>""</code>, <code>0</code>, <code>NaN</code>, etc.</p> <div class="highlight highlight-source-js"><pre><span class="pl-k">const</span> <span class="pl-c1">foo</span> <span class="pl-k">=</span> <span class="pl-smi">object</span>.<span class="pl-smi">foo</span> <span class="pl-k">??</span> <span class="pl-s"><span class="pl-pds">"</span>default<span class="pl-pds">"</span></span>;</pre></div> <h3>Improved template literal expresions line breaks (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3124" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="269808048" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3124">#3124</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>This was another known issue with Prettier, when printing a template literal string with expressions inside that went over the print width, it would wrap the code in weird places inside the expressions. Now, if Prettier needs to insert a line break, it should happen right between <code>${</code> and <code>}</code>.</p> <div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-k">const</span> <span class="pl-smi">description</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">The value of the <span class="pl-e">${<span class="pl-smi">cssName</span>}</span> css of the <span class="pl-e">${<span class="pl-c1">this</span></span></span></span> <span class="pl-s"><span class="pl-s"><span class="pl-e"> <span class="pl-k">.</span><span class="pl-smi">_name</span>}</span> element</span><span class="pl-s">`</span></span>; <span class="pl-k">const</span> <span class="pl-smi">foo</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">mdl-textfield mdl-js-textfield <span class="pl-e">${<span class="pl-smi">className</span>}</span> <span class="pl-e">${<span class="pl-smi">content</span><span class="pl-k">.</span><span class="pl-smi">length</span><span class="pl-k"> ></span> <span class="pl-c1">0</span></span></span></span> <span class="pl-s"><span class="pl-s"><span class="pl-e"> <span class="pl-k">?</span> <span class="pl-s"><span class="pl-pds">"</span>is-dirty<span class="pl-pds">"</span></span></span></span></span> <span class="pl-s"><span class="pl-s"><span class="pl-e"> <span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>}</span> combo-box__input</span><span class="pl-s">`</span></span>; <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-k">const</span> <span class="pl-smi">description</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">The value of the \${cssName} css of the \${</span></span> <span class="pl-s"><span class="pl-s"> this._name</span></span> <span class="pl-s"><span class="pl-s">} element</span><span class="pl-s">`</span></span>; <span class="pl-k">const</span> <span class="pl-smi">foo</span><span class="pl-k"> =</span><span class="pl-s"> <span class="pl-s">`</span><span class="pl-s">mdl-textfield mdl-js-textfield <span class="pl-e">${<span class="pl-smi">className</span>}</span> <span class="pl-e">${</span></span></span> <span class="pl-s"><span class="pl-s"><span class="pl-e"><span class="pl-smi"> content</span><span class="pl-k">.</span><span class="pl-smi">length</span><span class="pl-k"> ></span> <span class="pl-c1">0</span> <span class="pl-k">?</span> <span class="pl-s"><span class="pl-pds">'</span>is-dirty<span class="pl-pds">'</span></span> <span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">'</span><span class="pl-pds">'</span></span></span></span></span> <span class="pl-s"><span class="pl-s"><span class="pl-e">}</span> combo-box__input</span><span class="pl-s">`</span></span></pre></div> <h2>JSX</h2> <h3>Don't inline trailing <code>}</code> for arrow functions attributes (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3110" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="268739661" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3110">#3110</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>In order to align closer to the <a href="https://urls.greenkeeper.io/airbnb/javascript/">Airbnb style guide</a>, and since it was never intentionally printed this way, we've moved the <code>}</code> from to the next line in JSX. This is more diff friendly, and makes it easier to move code around by shifting lines in your editor.</p> <div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <<span class="pl-ent"><span class="pl-c1">BookingIntroPanel</span></span> <span class="pl-e">logClick</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">data</span> <span class="pl-k">=></span></span> <span class="pl-s1"> <span class="pl-en">doLogClick</span>(<span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>,<span class="pl-smi"> data</span>)</span><span class="pl-pse">}</span> />; <span class="pl-c"><span class="pl-c">//</span> After</span> <<span class="pl-ent"><span class="pl-c1">BookingIntroPanel</span></span> <span class="pl-e">logClick</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">data</span> <span class="pl-k">=></span></span> <span class="pl-s1"> <span class="pl-en">doLogClick</span>(<span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>long_name_long_name_long_name<span class="pl-pds">"</span></span>,<span class="pl-smi"> data</span>)</span> <span class="pl-s1"> </span><span class="pl-pse">}</span> />;</pre></div> <h1>Other Changes</h1> <h2>JavaScript</h2> <h3>Make the factory detection handle multiple elements (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3112" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="268967545" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3112">#3112</a>) by <a href="https://urls.greenkeeper.io/vjeux" class="user-mention">@vjeux</a></h3> <p>There was a bug in the heuristic that Prettier uses to determine whether an expression is a factory or not. It now works correctly with longer member expressions.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-c1">window</span>.<span class="pl-smi">FooClient</span> .<span class="pl-en">setVars</span>({ locale<span class="pl-k">:</span> <span class="pl-en">getFooLocale</span>({ page }), authorizationToken<span class="pl-k">:</span> <span class="pl-smi">data</span>.<span class="pl-smi">token</span> }) .<span class="pl-en">initVerify</span>(<span class="pl-s"><span class="pl-pds">"</span>foo_container<span class="pl-pds">"</span></span>); <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-c1">window</span>.<span class="pl-smi">FooClient</span>.<span class="pl-en">setVars</span>({ locale<span class="pl-k">:</span> <span class="pl-en">getFooLocale</span>({ page }), authorizationToken<span class="pl-k">:</span> <span class="pl-smi">data</span>.<span class="pl-smi">token</span> }).<span class="pl-en">initVerify</span>(<span class="pl-s"><span class="pl-pds">"</span>foo_container<span class="pl-pds">"</span></span>);</pre></div> <h3>Handle comments between function name and open paren (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2979" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="263070152" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2979">#2979</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3> <p>Printing comments in the right place is an endless challenge <g-emoji alias="wink" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/1f609.png" ios-version="6.0">π</g-emoji>. This fix ensures that comments next to function names are re-printed correctly.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-k">function</span> <span class="pl-en">f</span>(<span class="pl-c"><span class="pl-c">/*</span> comment<span class="pl-c">*/</span></span> <span class="pl-smi">promise</span>) {} <span class="pl-c"><span class="pl-c">//</span> After </span> <span class="pl-k">function</span> f <span class="pl-c"><span class="pl-c">/*</span> comment<span class="pl-c">*/</span></span>(<span class="pl-smi">promise</span>) {}</pre></div> <h3>Support sequential CallExpressions in member chains (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2990" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="263677479" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2990">#2990</a>) by <a href="https://urls.greenkeeper.io/chrisvoll" class="user-mention">@chrisvoll</a></h3> <p>Member chains are one of the most complex parts of Prettier. This PR fixes an issue where repeated calls lead to the next method not being pushed to the next line.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> wrapper .<span class="pl-c1">find</span>(<span class="pl-s"><span class="pl-pds">"</span>SomewhatLongNodeName<span class="pl-pds">"</span></span>) .<span class="pl-en">prop</span>(<span class="pl-s"><span class="pl-pds">"</span>longPropFunctionName<span class="pl-pds">"</span></span>)().<span class="pl-en">then</span>(<span class="pl-k">function</span>() { <span class="pl-en">doSomething</span>(); }); <span class="pl-c"><span class="pl-c">//</span> After</span> wrapper .<span class="pl-c1">find</span>(<span class="pl-s"><span class="pl-pds">"</span>SomewhatLongNodeName<span class="pl-pds">"</span></span>) .<span class="pl-en">prop</span>(<span class="pl-s"><span class="pl-pds">"</span>longPropFunctionName<span class="pl-pds">"</span></span>)() .<span class="pl-en">then</span>(<span class="pl-k">function</span>() { <span class="pl-en">doSomething</span>(); });</pre></div> <h3>Account for empty lines in long member call chain (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3035" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265515302" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3035">#3035</a>) by <a href="https://urls.greenkeeper.io/jackyho112" class="user-mention">@jackyho112</a></h3> <p>Previously, Prettier would delete all newlines within a member chain. Now we keep up to one if it's in the source. This is nice for fluent APIs that you want to break up over multiple lines.</p> <div class="highlight highlight-source-js"><pre>angular .<span class="pl-en">module</span>(<span class="pl-s"><span class="pl-pds">"</span>AngularAppModule<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> Constants.</span> .<span class="pl-en">constant</span>(<span class="pl-s"><span class="pl-pds">"</span>API_URL<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>http://localhost:8080/api<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">//</span> App configuration.</span> .<span class="pl-en">config</span>(appConfig) .<span class="pl-en">run</span>(appRun);</pre></div> <h3>Fix issue where first argument is left behind when line breaks (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3079" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267371127" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3079">#3079</a>) by <a href="https://urls.greenkeeper.io/mutdmour" class="user-mention">@mutdmour</a></h3> <p>This addresses an issue where due to our special object inline behaviour, the indentation missing from the function call.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-smi">db</span>.<span class="pl-en">collection</span>(<span class="pl-s"><span class="pl-pds">"</span>indexOptionDefault<span class="pl-pds">"</span></span>).<span class="pl-en">createIndex</span>({ a<span class="pl-k">:</span> <span class="pl-c1">1</span> }, { indexOptionDefaults<span class="pl-k">:</span> <span class="pl-c1">true</span> }, <span class="pl-k">function</span>(<span class="pl-smi">err</span>) { <span class="pl-c"><span class="pl-c">//</span> code</span> }); <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-smi">db</span>.<span class="pl-en">collection</span>(<span class="pl-s"><span class="pl-pds">"</span>indexOptionDefault<span class="pl-pds">"</span></span>).<span class="pl-en">createIndex</span>( { a<span class="pl-k">:</span> <span class="pl-c1">1</span> }, { indexOptionDefaults<span class="pl-k">:</span> <span class="pl-c1">true</span> }, <span class="pl-k">function</span>(<span class="pl-smi">err</span>) { <span class="pl-c"><span class="pl-c">//</span> code</span> } );</pre></div> <h3>Break parens for binaries in member expression (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2958" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262164203" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2958">#2958</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>Similarly, there was another edge case where indentation was missing from logical expressions. This is fixed, too.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-k">const</span> <span class="pl-c1">someLongVariable</span> <span class="pl-k">=</span> (<span class="pl-en">idx</span>( <span class="pl-c1">this</span>.<span class="pl-smi">props</span>, <span class="pl-smi">props</span> <span class="pl-k">=></span> <span class="pl-smi">props</span>.<span class="pl-smi">someLongPropertyName</span> ) <span class="pl-k">||</span> [] ).<span class="pl-en">map</span>(<span class="pl-smi">edge</span> <span class="pl-k">=></span> <span class="pl-smi">edge</span>.<span class="pl-smi">node</span>); <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-k">const</span> <span class="pl-c1">someLongVariable</span> <span class="pl-k">=</span> ( <span class="pl-en">idx</span>(<span class="pl-c1">this</span>.<span class="pl-smi">props</span>, <span class="pl-smi">props</span> <span class="pl-k">=></span> <span class="pl-smi">props</span>.<span class="pl-smi">someLongPropertyName</span>) <span class="pl-k">||</span> [] ).<span class="pl-en">map</span>(<span class="pl-smi">edge</span> <span class="pl-k">=></span> <span class="pl-smi">edge</span>.<span class="pl-smi">node</span>);</pre></div> <h3>Prevent breaking MemberExpression inside NewExpression (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3075" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267232001" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3075">#3075</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>There are so many ways to break a line. Some of them look much worse than others. Breaking between in this case looked really weird, so it has been fixed!</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-k">function</span> <span class="pl-en">functionName</span>() { <span class="pl-k">if</span> (<span class="pl-c1">true</span>) { <span class="pl-c1">this</span>.<span class="pl-smi">_aVeryLongVariableNameToForceLineBreak</span> <span class="pl-k">=</span> <span class="pl-k">new</span> <span class="pl-en">this</span> .<span class="pl-en">Promise</span>((<span class="pl-smi">resolve</span>, <span class="pl-smi">reject</span>) <span class="pl-k">=></span> { <span class="pl-c"><span class="pl-c">//</span> do something</span> }); } } <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-k">function</span> <span class="pl-en">functionName</span>() { <span class="pl-k">if</span> (<span class="pl-c1">true</span>) { <span class="pl-c1">this</span>.<span class="pl-smi">_aVeryLongVariableNameToForceLineBreak</span> <span class="pl-k">=</span> <span class="pl-k">new</span> <span class="pl-en">this.Promise</span>( (<span class="pl-smi">resolve</span>, <span class="pl-smi">reject</span>) <span class="pl-k">=></span> { <span class="pl-c"><span class="pl-c">//</span> do something</span> } ); } }</pre></div> <h3>Fix array acessors in method chains (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3137" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="270637812" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3137">#3137</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>In a method chain we split lines by grouping elements together and accessing an array should be printed in the end of a group instead of the beginning.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-en">find</span>(<span class="pl-s"><span class="pl-pds">'</span>.org-lclp-edit-copy-url-banner__link<span class="pl-pds">'</span></span>) [<span class="pl-c1">0</span>].<span class="pl-c1">getAttribute</span>(<span class="pl-s"><span class="pl-pds">'</span>href<span class="pl-pds">'</span></span>) .<span class="pl-c1">indexOf</span>(<span class="pl-c1">this</span>.<span class="pl-smi">landingPageLink</span>) <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-en">find</span>(<span class="pl-s"><span class="pl-pds">'</span>.org-lclp-edit-copy-url-banner__link<span class="pl-pds">'</span></span>)[<span class="pl-c1">0</span>] .<span class="pl-c1">getAttribute</span>(<span class="pl-s"><span class="pl-pds">'</span>href<span class="pl-pds">'</span></span>) .<span class="pl-c1">indexOf</span>(<span class="pl-c1">this</span>.<span class="pl-smi">landingPageLink</span>)</pre></div> <h2>Flow and TypeScript</h2> <h3>Fix indentation of intersection object types (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3074" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267225804" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3074">#3074</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>This was a minor alignment bug in intersection types, and has now been fixed.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> type intersectionTest <span class="pl-k">=</span> { propA<span class="pl-k">:</span> <span class="pl-c1">X</span> } <span class="pl-k">&</span> { propB<span class="pl-k">:</span> <span class="pl-c1">X</span> } <span class="pl-k">&</span> { propC<span class="pl-k">:</span> <span class="pl-c1">X</span> } <span class="pl-k">&</span> { propD<span class="pl-k">:</span> <span class="pl-c1">X</span> }; <span class="pl-c"><span class="pl-c">//</span> After</span> type Props <span class="pl-k">=</span> { propA<span class="pl-k">:</span> <span class="pl-c1">X</span> } <span class="pl-k">&</span> { propB<span class="pl-k">:</span> <span class="pl-c1">X</span> } <span class="pl-k">&</span> { propC<span class="pl-k">:</span> <span class="pl-c1">X</span> } <span class="pl-k">&</span> { propD<span class="pl-k">:</span> <span class="pl-c1">X</span> };</pre></div> <h3>Keep parens around TSAsExpression in ConditionalExpression (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3053" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="266402555" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3053">#3053</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3> <p>We missed a case where we need to keep the parenthesis with TypeScript's <code>as</code> assertions. This is now fixed.</p> <div class="highlight highlight-source-ts"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <span class="pl-c"></span><span class="pl-smi">aValue</span> <span class="pl-k">as</span> <span class="pl-c1">boolean</span> ? <span class="pl-c1">0</span> : <span class="pl-k">-</span><span class="pl-c1">1</span>; <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-c"></span>(<span class="pl-smi">aValue</span> <span class="pl-k">as</span> <span class="pl-c1">boolean</span>) <span class="pl-k">?</span> <span class="pl-c1">0</span> <span class="pl-k">:</span> <span class="pl-k">-</span><span class="pl-c1">1</span>;</pre></div> <h2>JSX</h2> <h3>Collapse multiple JSX whitespaces (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2973" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262564212" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2973">#2973</a>) by <a href="https://urls.greenkeeper.io/karl" class="user-mention">@karl</a></h3> <p>This fixes up the issue where JSX formatting occasionally needed to be run twice to become stable. This occurred when you had multiple JSX whitespace elements or JSX whitespace followed by a space.</p> <div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> <<span class="pl-ent">div</span>> <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span></span><span class="pl-pse">}</span> <<span class="pl-ent"><span class="pl-c1">Badge</span></span> <span class="pl-e">src</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">notificationIconPng</span></span><span class="pl-pse">}</span> /> </<span class="pl-ent">div</span>>; <span class="pl-c"><span class="pl-c">//</span> After</span> <<span class="pl-ent">div</span>> <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-s"><span class="pl-pds">"</span> <span class="pl-pds">"</span></span></span><span class="pl-pse">}</span> <<span class="pl-ent"><span class="pl-c1">Badge</span></span> <span class="pl-e">src</span><span class="pl-k">=</span><span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">notificationIconPng</span></span><span class="pl-pse">}</span> /> </<span class="pl-ent">div</span>></pre></div> <h3>Don't print JSX bracket on same line when it has trailing comments (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3088" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267549517" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3088">#3088</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3> <p>This was an issue with the <code>--jsx-bracket-same-line</code> option. Turns out you can't <em>always</em> put the bracket on the same line...</p> <div class="highlight highlight-source-js-jsx"><pre><span class="pl-c"><span class="pl-c">//</span> Input</span> <<span class="pl-ent">div</span> <span class="pl-c"> <span class="pl-c">//</span> comment</span> > <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">foo</span></span><span class="pl-pse">}</span> </<span class="pl-ent">div</span>> <span class="pl-c"><span class="pl-c">//</span> Before</span> <<span class="pl-ent">div</span>> // comment <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">foo</span></span><span class="pl-pse">}</span> </<span class="pl-ent">div</span>>; <span class="pl-c"><span class="pl-c">//</span> After</span> <<span class="pl-ent">div</span> <span class="pl-c"><span class="pl-c">//</span> comment</span> > <span class="pl-pse">{</span><span class="pl-s1"><span class="pl-smi">foo</span></span><span class="pl-pse">}</span> </<span class="pl-ent">div</span>>;</pre></div> <h2>CSS</h2> <h3>Preserve line breaks in grid declarations (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3133" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="270384528" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3133">#3133</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>Prettier will now preserve line breaks included in the source code when formatting the <code>grid</code> and <code>grid-template-*</code> rules, since those are important to keep in separate lines, but still applies the formatting like other rules (e.g., numbers and quotes).</p> <div class="highlight highlight-source-css"><pre><span class="pl-c"><span class="pl-c">/*</span> Original Input <span class="pl-c">*/</span></span> <span class="pl-ent">div</span> { <span class="pl-c1"><span class="pl-c1">grid</span></span>: [wide-start] <span class="pl-s"><span class="pl-pds">'</span>header header header<span class="pl-pds">'</span></span> <span class="pl-c1">200.000<span class="pl-k">px</span></span> [wide-end] <span class="pl-s"><span class="pl-pds">"</span>footer footer footer<span class="pl-pds">"</span></span> <span class="pl-c1">.50<span class="pl-k">fr</span></span> / <span class="pl-c1">auto</span> <span class="pl-c1">50.000<span class="pl-k">px</span></span> <span class="pl-c1">auto</span>; } <span class="pl-c"><span class="pl-c">/*</span> Before <span class="pl-c">*/</span></span> <span class="pl-ent">div</span> { <span class="pl-c1"><span class="pl-c1">grid</span></span>: [wide-start] <span class="pl-s"><span class="pl-pds">"</span>header header header<span class="pl-pds">"</span></span> <span class="pl-c1">200<span class="pl-k">px</span></span> [wide-end] <span class="pl-s"><span class="pl-pds">"</span>footer footer footer<span class="pl-pds">"</span></span> <span class="pl-c1">0.5<span class="pl-k">fr</span></span> / <span class="pl-c1">auto</span> <span class="pl-c1">50<span class="pl-k">px</span></span> <span class="pl-c1">auto</span>; } <span class="pl-c"><span class="pl-c">/*</span> After <span class="pl-c">*/</span></span> <span class="pl-ent">div</span> { <span class="pl-c1"><span class="pl-c1">grid</span></span>: [wide-start] <span class="pl-s"><span class="pl-pds">"</span>header header header<span class="pl-pds">"</span></span> <span class="pl-c1">200<span class="pl-k">px</span></span> [wide-end] <span class="pl-s"><span class="pl-pds">"</span>footer footer footer<span class="pl-pds">"</span></span> <span class="pl-c1">0.5<span class="pl-k">fr</span></span> / <span class="pl-c1">auto</span> <span class="pl-c1">50<span class="pl-k">px</span></span> <span class="pl-c1">auto</span>; }</pre></div> <h2>SCSS</h2> <h3>Format SCSS maps like CSS rules (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3070" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267054763" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3070">#3070</a>) by <a href="https://urls.greenkeeper.io/asmockler" class="user-mention">@asmockler</a></h3> <p>Turns out SCSS maps are much prettier when printed over multiple lines.</p> <div class="highlight highlight-source-scss"><pre><span class="pl-c">// Before</span> <span class="pl-smi">$map</span>: (color: <span class="pl-c1">#111111</span>, <span class="pl-c1">text</span><span class="pl-c1">-</span>shadow:<span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 0</span> <span class="pl-bu">salmon</span>) // After <span class="pl-smi">$map</span>: ( color: <span class="pl-c1">#111111</span>, <span class="pl-c1">text</span><span class="pl-c1">-</span>shadow:<span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 1</span><span class="pl-k">px</span><span class="pl-c1"> 0</span> <span class="pl-bu">salmon</span> );</pre></div> <h2>CSS-in-JS</h2> <h3>Fix formatting styled(Foo).attrs(...)`` (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3073" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="267192603" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3073">#3073</a>) by <a href="https://urls.greenkeeper.io/existentialism" class="user-mention">@existentialism</a></h3> <p>Prettier will now format the CSS in styled-components code that looks like this:</p> <div class="highlight highlight-source-js"><pre><span class="pl-en">styled</span>(Component).<span class="pl-en">attrs</span>({})<span class="pl-s"><span class="pl-pds">`</span></span> <span class="pl-s"> color: red;</span> <span class="pl-s"><span class="pl-pds">`</span></span>;</pre></div> <h2>GraphQL</h2> <h3>Prevent formatting GraphQL template literals with expressions (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2975" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262809788" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2975">#2975</a>) by <a href="https://urls.greenkeeper.io/duailibe" class="user-mention">@duailibe</a></h3> <p>Prettier doesn't support formatting JavaScript expressions in GraphQL. See <a href="https://urls.greenkeeper.io/prettier/prettier/issues/2640" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="251412470" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2640">#2640</a> for tracking. There was a bug where formatting an expression lead to invalid code, so we've completely disabled formatting GraphQL when it contains JavaScript expressions until we fully support it.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before</span> (invalid code) <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-en">graphql</span>(schema, <span class="pl-s"><span class="pl-pds">`</span>{ query test { id }} <span class="pl-s1"><span class="pl-pse">${</span>fragment<span class="pl-pse">}</span></span><span class="pl-pds">`</span></span>)</pre></div> <h2>CLI</h2> <h3>Don't use ANSI codes if stdout isn't a TTY (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2903" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="260810621" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2903">#2903</a>) by <a href="https://urls.greenkeeper.io/narigo" class="user-mention">@Narigo</a></h3> <p>Previously, piping the output of <code>--list-different</code> to other tools was troublesome due to the ANSI color codes we use to show whether a file was modified or not. This PR disables the use of color when Prettier is piped to a different process.</p> <h2>Configuration</h2> <h3>Use relative paths with CLI (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/2969" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="262449905" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/2969">#2969</a>) by <a href="https://urls.greenkeeper.io/ahmedelgabri" class="user-mention">@ahmedelgabri</a></h3> <p>This fixes a bug where passing a path starting with <code>./</code> to the CLI wouldn't match patterns used in <code>.prettierignore</code>.</p> <pre><code># .prettierignore path/to/*.js </code></pre> <p>After this fix, no files will be written to when executing:</p> <div class="highlight highlight-source-shell"><pre>$ prettier --write ./path/to/<span class="pl-k">*</span>.js</pre></div> <h3>Resolve file paths relative to config file (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3037" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265550594" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3037">#3037</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3> <p>This fixes an issue where <code>.prettierrc</code> overrides, under certain conditions, were not being respected for absolute paths with the <code>resolveConfig</code> API.</p> <h2>Core</h2> <h3>Respect CJK width and Combined Characters (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3003" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="264227112" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3003">#3003</a>, <a href="https://urls.greenkeeper.io/prettier/prettier/pull/3015" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="264803229" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3015">#3015</a>) by <a href="https://urls.greenkeeper.io/ikatyang" class="user-mention">@ikatyang</a></h3> <p>Chinese, Japanese and Korean characters are now considered two characters wide.</p> <div class="highlight highlight-source-js"><pre><span class="pl-c"><span class="pl-c">//</span> Before (exceeds print width when CJK characters are 2x monospace chars)</span> <span class="pl-k">const</span> <span class="pl-c1">x</span> <span class="pl-k">=</span> [<span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>]; <span class="pl-c"><span class="pl-c">//</span> After</span> <span class="pl-k">const</span> <span class="pl-c1">x</span> <span class="pl-k">=</span> [ <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span>, <span class="pl-c"><span class="pl-c">//</span> ...</span> <span class="pl-s"><span class="pl-pds">"</span>δΈζ<span class="pl-pds">"</span></span> ];</pre></div> <p><a href="https://urls.greenkeeper.io/prettier/prettier/pull/3015" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="264803229" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3015">#3015</a> also ensures that combining characters (e.g. <code>Γ</code>) are counted as one character.</p> <h2>Editor Support</h2> <h3>Implement getSupportInfo() and use it for inference (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3033" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="265494522" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3033">#3033</a>) by <a href="https://urls.greenkeeper.io/azz" class="user-mention">@azz</a></h3> <p>We've added a new function to the API (<code>prettier.getSupportInfo([version])</code>), and the CLI <code>--support-info</code>. This can be used to interrogate Prettier to find out which languages the current version, or an older version, supports. It also provides useful information such as CodeMirror IDs, tmScopes, etc, which can be used to automate some of the work done with lookup tables in text editor integrations.</p> <p>Internally, we use this information to drive which extensions trigger which parsers, and support some common files that don't have extensions, like <code>.prettierrc</code>, <code>Jakefile</code>, etc.</p> <div class="highlight highlight-source-shell"><pre><span class="pl-c"><span class="pl-c">#</span> prettier knows that this file is JSON now.</span> $ prettier --write .prettierrc</pre></div> <h3>Split source elements relative to their language. (<a href="https://urls.greenkeeper.io/prettier/prettier/pull/3069" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="266872265" data-permission-text="Issue title is private" data-url="https://github.com/prettier/prettier/issues/3069">#3069</a>) by <a href="https://urls.greenkeeper.io/cigit" class="user-mention">@CiGit</a></h3> <p>This fixes an issue in editors that support range formatting, where formatting an object would cause Prettier to crash.</p> <hr> <h1>Thanks! <g-emoji alias="heart" fallback-src="https://assets-cdn.github.com/images/icons/emoji/unicode/2764.png" ios-version="6.0">β€οΈ</g-emoji></h1> <p>Thanks to everyone who contributed to this release, as well as those who raised issues! Prettier has become a highly stable piece of software that a large amount of people trust with their code. We take that trust seriously, and fix rare issues that break code with the highest priority. We can't fix these issues if we don't know about them, so never be afraid to <a href="https://urls.greenkeeper.io/prettier/prettier/issues/new">create an issue</a>!</p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those donβt help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) Bot :palm_tree:
The experimental SlimdomTreeAdapter for the web platform tests currently uses a few non-public functions, as HTML parsing requires some validation rules to be skipped for element and attribute names. We should export the following functions in some form as public API:
7.2.0
to 7.2.1
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@microsoft/api-documenter is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
7.1.5
to 7.1.6
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@microsoft/api-extractor is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
7.3.7
to 7.3.8
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@microsoft/api-extractor is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
23.3.5
to 23.3.6
.π¨ View failing branch.
This version is covered by your current version range and after updating it in your project the build failed.
@types/jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | parse5 |
Current Version | 3.0.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
parse5 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
Changelog: http://inikulin.github.io/parse5/#3-0-3
The new version differs by 14 commits.
723d782
v3.0.3
8d38fda
Merge pull request #212 from gfx/patch-1
89e6b04
loosen the dependency version of @types/node
fee4018
Merge pull request #207 from inikulin/escape-zero-char
67f0099
Escape NUL character in feedback tests
2aff591
Merge pull request #198 from stevenvachon/master
02d9fee
Improve location info documentation
ae7b8a0
Merge pull request #196 from stevenvachon/master
d0769db
Fix empty stream parsing with ParserStream (closes #195)
fabc6d8
Bring no-trailing-spaces eslint rule back
d9c0881
Merge pull request #186 from HTMLParseErrorWG/master
ed932c8
Calculate offset in position tracker
c7f1193
Refactor location info parser mixin
549218b
Refactor location info tokenizer mixin
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
It looks like babili has been renamed, and related packages along with it:
npm WARN deprecated [email protected]: Due to Babili's name change, new versions of this package are available as rol
lup-plugin-babel-minify
npm WARN deprecated [email protected]: babili has been renamed to babel-minify. Please update to babel-preset-minify
We should update the slimdom dependencies accordingly.
We should really start throwing proper errors as defined by the spec rather than returning null or even creating invalid DOM states.
This will be breaking compatibility, so either do it before 1.0.0 or as a new major version.
It should only accept strings
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.