Inline _ or $ in the root of a method chain (#4621)

This commit is contained in:
Lucas Duailibe authored and GitHub committed 2018-06-01 12:51:06 -03:00
1 parent 26b13b6274
commit a4da6e6c8e
3 files changed
+34 -3

No files matched your search

+4 -3
View File
@@ -4440,10 +4440,11 @@ function printMemberChain(path, options, print) {
// .map(x => x)
//
// In order to detect those cases, we use an heuristic: if the first
// node is an identifier with the name starting with a capital letter.
// The rationale is that they are likely to be factories.
// node is an identifier with the name starting with a capital
// letter or just a sequence of _$. The rationale is that they are
// likely to be factories.
function isFactory(name) {
return /^[A-Z]/.test(name);
return /^[A-Z]|^[_$]+$/.test(name);
}
// In case the Identifier is shorter than tab width, we can keep the
@@ -607,6 +607,16 @@ Object.keys(
.forEach(locale => {
// ...
});
this.layoutPartsToHide = this.utils.hashset(
_.flatMap(this.visibilityHandlers, fn => fn())
.concat(this.record.resolved_legacy_visrules)
.filter(Boolean)
);
var jqxhr = $.ajax("example.php")
.done(doneFn)
.fail(failFn);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Object.keys(
availableLocales({
@@ -616,6 +626,16 @@ Object.keys(
// ...
});
this.layoutPartsToHide = this.utils.hashset(
_.flatMap(this.visibilityHandlers, fn => fn())
.concat(this.record.resolved_legacy_visrules)
.filter(Boolean)
);
var jqxhr = $.ajax("example.php")
.done(doneFn)
.fail(failFn);
`;
exports[`logical.js 1`] = `
+10
View File
@@ -6,3 +6,13 @@ Object.keys(
.forEach(locale => {
// ...
});
this.layoutPartsToHide = this.utils.hashset(
_.flatMap(this.visibilityHandlers, fn => fn())
.concat(this.record.resolved_legacy_visrules)
.filter(Boolean)
);
var jqxhr = $.ajax("example.php")
.done(doneFn)
.fail(failFn);