-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#11103 Break multiline parenthesized logical expressions #444
Comments
Run #11103 |
prettier/prettier#11103 VS prettier/prettier@main :: babel/babel@71c247a Diff (1425 lines)diff --git ORI/babel/packages/babel-core/src/config/config-chain.ts ALT/babel/packages/babel-core/src/config/config-chain.ts
index 23ce8677..37cbabb7 100644
--- ORI/babel/packages/babel-core/src/config/config-chain.ts
+++ ALT/babel/packages/babel-core/src/config/config-chain.ts
@@ -808,12 +808,18 @@ function configIsApplicable(
configName: string,
): boolean {
return (
- (options.test === undefined ||
- configFieldIsApplicable(context, options.test, dirname, configName)) &&
- (options.include === undefined ||
- configFieldIsApplicable(context, options.include, dirname, configName)) &&
- (options.exclude === undefined ||
- !configFieldIsApplicable(context, options.exclude, dirname, configName))
+ (
+ options.test === undefined ||
+ configFieldIsApplicable(context, options.test, dirname, configName)
+ ) &&
+ (
+ options.include === undefined ||
+ configFieldIsApplicable(context, options.include, dirname, configName)
+ ) &&
+ (
+ options.exclude === undefined ||
+ !configFieldIsApplicable(context, options.exclude, dirname, configName)
+ )
);
}
diff --git ORI/babel/packages/babel-generator/src/generators/flow.ts ALT/babel/packages/babel-generator/src/generators/flow.ts
index 73d0b7a8..5e9c85f7 100644
--- ORI/babel/packages/babel-generator/src/generators/flow.ts
+++ ALT/babel/packages/babel-generator/src/generators/flow.ts
@@ -333,10 +333,12 @@ export function FunctionTypeAnnotation(
const type = parent?.type;
if (
type != null &&
- (type === "ObjectTypeCallProperty" ||
+ (
+ type === "ObjectTypeCallProperty" ||
type === "ObjectTypeInternalSlot" ||
type === "DeclareFunction" ||
- (type === "ObjectTypeProperty" && parent.method))
+ (type === "ObjectTypeProperty" && parent.method)
+ )
) {
this.token(":");
} else {
diff --git ORI/babel/packages/babel-generator/src/node/parentheses.ts ALT/babel/packages/babel-generator/src/node/parentheses.ts
index d42a2140..47031844 100644
--- ORI/babel/packages/babel-generator/src/node/parentheses.ts
+++ ALT/babel/packages/babel-generator/src/node/parentheses.ts
@@ -72,13 +72,21 @@ const isClassExtendsClause = (
const hasPostfixPart = (node: t.Node, parent: t.Node) => {
const parentType = parent.type;
return (
- ((parentType === "MemberExpression" ||
- parentType === "OptionalMemberExpression") &&
- parent.object === node) ||
- ((parentType === "CallExpression" ||
- parentType === "OptionalCallExpression" ||
- parentType === "NewExpression") &&
- parent.callee === node) ||
+ (
+ (
+ parentType === "MemberExpression" ||
+ parentType === "OptionalMemberExpression"
+ ) &&
+ parent.object === node
+ ) ||
+ (
+ (
+ parentType === "CallExpression" ||
+ parentType === "OptionalCallExpression" ||
+ parentType === "NewExpression"
+ ) &&
+ parent.callee === node
+ ) ||
(parentType === "TaggedTemplateExpression" && parent.tag === node) ||
parentType === "TSNonNullExpression"
);
@@ -107,9 +115,11 @@ export function FunctionTypeAnnotation(
// (() => A)[]
parentType === "ArrayTypeAnnotation" ||
// <T>(A: T): (T => T[]) => B => [A, B]
- (parentType === "TypeAnnotation" &&
+ (
+ parentType === "TypeAnnotation" &&
// Check grandparent
- isArrowFunctionExpression(printStack[printStack.length - 3]))
+ isArrowFunctionExpression(printStack[printStack.length - 3])
+ )
);
}
@@ -174,9 +184,11 @@ export function Binary(
if (
// Logical expressions with the same precedence don't need parens.
- (parentPos === nodePos &&
+ (
+ parentPos === nodePos &&
parent.right === node &&
- parentType !== "LogicalExpression") ||
+ parentType !== "LogicalExpression"
+ ) ||
parentPos > nodePos
) {
return true;
@@ -241,10 +253,12 @@ export function TSInstantiationExpression(
) {
const parentType = parent.type;
return (
- (parentType === "CallExpression" ||
+ (
+ parentType === "CallExpression" ||
parentType === "OptionalCallExpression" ||
parentType === "NewExpression" ||
- parentType === "TSInstantiationExpression") &&
+ parentType === "TSInstantiationExpression"
+ ) &&
!!parent.typeParameters
);
}
@@ -334,9 +348,11 @@ export function UnaryLike(
): boolean {
return (
hasPostfixPart(node, parent) ||
- (isBinaryExpression(parent) &&
+ (
+ isBinaryExpression(parent) &&
parent.operator === "**" &&
- parent.left === node) ||
+ parent.left === node
+ ) ||
isClassExtendsClause(node, parent)
);
}
@@ -503,15 +519,21 @@ function isFirstInContext(
while (i >= 0) {
const parentType = parent.type;
if (
- (expressionStatement &&
+ (
+ expressionStatement &&
parentType === "ExpressionStatement" &&
- parent.expression === node) ||
- (exportDefault &&
+ parent.expression === node
+ ) ||
+ (
+ exportDefault &&
parentType === "ExportDefaultDeclaration" &&
- node === parent.declaration) ||
- (arrowBody &&
+ node === parent.declaration
+ ) ||
+ (
+ arrowBody &&
parentType === "ArrowFunctionExpression" &&
- parent.body === node) ||
+ parent.body === node
+ ) ||
(forHead && parentType === "ForStatement" && parent.init === node) ||
(forInHead && parentType === "ForInStatement" && parent.left === node) ||
(forOfHead && parentType === "ForOfStatement" && parent.left === node)
@@ -521,15 +543,23 @@ function isFirstInContext(
if (
i > 0 &&
- ((hasPostfixPart(node, parent) && parentType !== "NewExpression") ||
- (parentType === "SequenceExpression" &&
- parent.expressions[0] === node) ||
+ (
+ (hasPostfixPart(node, parent) && parentType !== "NewExpression") ||
+ (
+ parentType === "SequenceExpression" &&
+ parent.expressions[0] === node
+ ) ||
(parentType === "UpdateExpression" && !parent.prefix) ||
(parentType === "ConditionalExpression" && parent.test === node) ||
- ((parentType === "BinaryExpression" ||
- parentType === "LogicalExpression") &&
- parent.left === node) ||
- (parentType === "AssignmentExpression" && parent.left === node))
+ (
+ (
+ parentType === "BinaryExpression" ||
+ parentType === "LogicalExpression"
+ ) &&
+ parent.left === node
+ ) ||
+ (parentType === "AssignmentExpression" && parent.left === node)
+ )
) {
node = parent;
i--;
diff --git ORI/babel/packages/babel-generator/src/printer.ts ALT/babel/packages/babel-generator/src/printer.ts
index e2d21741..e2f27ec0 100644
--- ORI/babel/packages/babel-generator/src/printer.ts
+++ ALT/babel/packages/babel-generator/src/printer.ts
@@ -268,12 +268,16 @@ class Printer {
const lastChar = this.getLastChar();
const strFirst = str.charCodeAt(0);
if (
- (lastChar === charCodes.exclamationMark &&
+ (
+ lastChar === charCodes.exclamationMark &&
// space is mandatory to avoid outputting <!--
// http://javascript.spec.whatwg.org/#comment-syntax
- (str === "--" ||
+ (
+ str === "--" ||
// Needs spaces to avoid changing a! == 0 to a!== 0
- strFirst === charCodes.equalsTo)) ||
+ strFirst === charCodes.equalsTo
+ )
+ ) ||
// Need spaces for operators of the same kind to avoid: `a+++b`
(strFirst === charCodes.plusSign && lastChar === charCodes.plusSign) ||
(strFirst === charCodes.dash && lastChar === charCodes.dash) ||
@@ -667,9 +671,11 @@ class Printer {
const parenthesized = node.extra?.parenthesized as boolean | undefined;
let shouldPrintParens =
forceParens ||
- (parenthesized &&
+ (
+ parenthesized &&
format.retainFunctionParens &&
- nodeType === "FunctionExpression") ||
+ nodeType === "FunctionExpression"
+ ) ||
needsParens(node, parent, this._printStack);
if (
@@ -1127,8 +1133,10 @@ class Printer {
// we always wrap before and after multi-line comments.
if (
this._buf.hasContent() &&
- (comment.type === "CommentLine" ||
- commentStartLine !== commentEndLine)
+ (
+ comment.type === "CommentLine" ||
+ commentStartLine !== commentEndLine
+ )
) {
offset = leadingCommentNewline = 1;
}
diff --git ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts
index 31413354..450736ba 100644
--- ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts
+++ ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts
@@ -27,8 +27,10 @@ export function getInclusionReasons(
if (
!targetIsUnreleased &&
- (minIsUnreleased ||
- semver.lt(targetVersion.toString(), semverify(minVersion)))
+ (
+ minIsUnreleased ||
+ semver.lt(targetVersion.toString(), semverify(minVersion))
+ )
) {
result[env] = prettifyVersion(targetVersion);
}
diff --git ORI/babel/packages/babel-helper-create-class-features-plugin/src/decorators.ts ALT/babel/packages/babel-helper-create-class-features-plugin/src/decorators.ts
index 72620bbf..9e5d5bec 100644
--- ORI/babel/packages/babel-helper-create-class-features-plugin/src/decorators.ts
+++ ALT/babel/packages/babel-helper-create-class-features-plugin/src/decorators.ts
@@ -195,8 +195,10 @@ function addProxyAccessorsFor(
version: DecoratorVersionKind,
): void {
const thisArg =
- (version === "2023-11" ||
- (!process.env.BABEL_8_BREAKING && version === "2023-05")) &&
+ (
+ version === "2023-11" ||
+ (!process.env.BABEL_8_BREAKING && version === "2023-05")
+ ) &&
isStatic
? className
: t.thisExpression();
@@ -679,8 +681,10 @@ function generateDecorationList(
const decs: t.Expression[] = [];
for (let i = 0; i < decsCount; i++) {
if (
- (version === "2023-11" ||
- (!process.env.BABEL_8_BREAKING && version === "2023-05")) &&
+ (
+ version === "2023-11" ||
+ (!process.env.BABEL_8_BREAKING && version === "2023-05")
+ ) &&
haveOneThis
) {
decs.push(
@@ -967,8 +971,10 @@ function checkPrivateMethodUpdateError(
if (
// this.bar().#x = 123;
- (parentParentPath.node.type === "AssignmentExpression" &&
- parentParentPath.node.left === parentPath.node) ||
+ (
+ parentParentPath.node.type === "AssignmentExpression" &&
+ parentParentPath.node.left === parentPath.node
+ ) ||
// this.#x++;
parentParentPath.node.type === "UpdateExpression" ||
// ([...this.#x] = foo);
@@ -976,12 +982,16 @@ function checkPrivateMethodUpdateError(
// ([this.#x] = foo);
parentParentPath.node.type === "ArrayPattern" ||
// ({ a: this.#x } = bar);
- (parentParentPath.node.type === "ObjectProperty" &&
+ (
+ parentParentPath.node.type === "ObjectProperty" &&
parentParentPath.node.value === parentPath.node &&
- parentParentPath.parentPath.type === "ObjectPattern") ||
+ parentParentPath.parentPath.type === "ObjectPattern"
+ ) ||
// for (this.#x of []);
- (parentParentPath.node.type === "ForOfStatement" &&
- parentParentPath.node.left === parentPath.node)
+ (
+ parentParentPath.node.type === "ForOfStatement" &&
+ parentParentPath.node.left === parentPath.node
+ )
) {
throw path.buildCodeFrameError(
`Decorated private methods are read-only, but "#${path.node.id.name}" is updated via this expression.`,
@@ -1188,8 +1198,10 @@ function transformClass(
for (const expression of expressions) {
let object;
if (
- (version === "2023-11" ||
- (!process.env.BABEL_8_BREAKING && version === "2023-05")) &&
+ (
+ version === "2023-11" ||
+ (!process.env.BABEL_8_BREAKING && version === "2023-05")
+ ) &&
t.isMemberExpression(expression)
) {
if (t.isSuper(expression.object)) {
@@ -1889,9 +1901,11 @@ function transformClass(
let { superClass } = originalClass;
if (
superClass &&
- (process.env.BABEL_8_BREAKING ||
+ (
+ process.env.BABEL_8_BREAKING ||
version === "2023-11" ||
- version === "2023-05")
+ version === "2023-05"
+ )
) {
const id = path.scope.maybeGenerateMemoised(superClass);
if (id) {
diff --git ORI/babel/packages/babel-helper-create-class-features-plugin/src/fields.ts ALT/babel/packages/babel-helper-create-class-features-plugin/src/fields.ts
index 217df868..406b7eb2 100644
--- ORI/babel/packages/babel-helper-create-class-features-plugin/src/fields.ts
+++ ALT/babel/packages/babel-helper-create-class-features-plugin/src/fields.ts
@@ -172,9 +172,11 @@ export function buildPrivateNamesNodes(
init = t.newExpression(
t.identifier(
isMethod &&
- (process.env.BABEL_8_BREAKING ||
+ (
+ process.env.BABEL_8_BREAKING ||
!isGetterOrSetter ||
- newHelpers(state))
+ newHelpers(state)
+ )
? "WeakSet"
: "WeakMap",
),
diff --git ORI/babel/packages/babel-helper-create-class-features-plugin/src/index.ts ALT/babel/packages/babel-helper-create-class-features-plugin/src/index.ts
index 95e2e37c..99c0d564 100644
--- ORI/babel/packages/babel-helper-create-class-features-plugin/src/index.ts
+++ ALT/babel/packages/babel-helper-create-class-features-plugin/src/index.ts
@@ -197,11 +197,15 @@ export function createClassFeaturePlugin({
}
} else {
if (
- (privateNames.has(name) &&
+ (
+ privateNames.has(name) &&
!privateNames.has(getName) &&
- !privateNames.has(setName)) ||
- (privateNames.has(name) &&
- (privateNames.has(getName) || privateNames.has(setName)))
+ !privateNames.has(setName)
+ ) ||
+ (
+ privateNames.has(name) &&
+ (privateNames.has(getName) || privateNames.has(setName))
+ )
) {
throw path.buildCodeFrameError("Duplicate private field");
}
diff --git ORI/babel/packages/babel-helper-create-regexp-features-plugin/src/index.ts ALT/babel/packages/babel-helper-create-regexp-features-plugin/src/index.ts
index aed56e14..be4cbcf8 100644
--- ORI/babel/packages/babel-helper-create-regexp-features-plugin/src/index.ts
+++ ALT/babel/packages/babel-helper-create-regexp-features-plugin/src/index.ts
@@ -58,11 +58,13 @@ export function createRegExpFeaturePlugin({
if (
file.has(runtimeKey) &&
file.get(runtimeKey) !== runtime &&
- (process.env.BABEL_8_BREAKING ||
+ (
+ process.env.BABEL_8_BREAKING ||
// This check. Is necessary because in Babel 7 we allow multiple
// copies of transform-named-capturing-groups-regex with
// conflicting 'runtime' options.
- hasFeature(newFeatures, FEATURES.duplicateNamedCaptureGroups))
+ hasFeature(newFeatures, FEATURES.duplicateNamedCaptureGroups)
+ )
) {
throw new Error(
`The 'runtime' option must be the same for ` +
diff --git ORI/babel/packages/babel-helper-fixtures/src/index.ts ALT/babel/packages/babel-helper-fixtures/src/index.ts
index b225718a..3343a5cc 100644
--- ORI/babel/packages/babel-helper-fixtures/src/index.ts
+++ ALT/babel/packages/babel-helper-fixtures/src/index.ts
@@ -228,8 +228,10 @@ function pushTask(
disabled:
taskName[0] === "."
? true
- : (process.env.TEST_babel7plugins_babel8core &&
- taskOpts.SKIP_babel7plugins_babel8core) ||
+ : (
+ process.env.TEST_babel7plugins_babel8core &&
+ taskOpts.SKIP_babel7plugins_babel8core
+ ) ||
false,
options: taskOpts,
doNotSetSourceType: taskOpts.DO_NOT_SET_SOURCE_TYPE,
diff --git ORI/babel/packages/babel-helper-member-expression-to-functions/src/index.ts ALT/babel/packages/babel-helper-member-expression-to-functions/src/index.ts
index 4d248093..2af9a69a 100644
--- ORI/babel/packages/babel-helper-member-expression-to-functions/src/index.ts
+++ ALT/babel/packages/babel-helper-member-expression-to-functions/src/index.ts
@@ -483,17 +483,23 @@ const handle = {
// for (MEMBER in ARR)
parentPath.isForXStatement({ left: node }) ||
// { KEY: MEMBER } = OBJ
- (parentPath.isObjectProperty({ value: node }) &&
- parentPath.parentPath.isObjectPattern()) ||
+ (
+ parentPath.isObjectProperty({ value: node }) &&
+ parentPath.parentPath.isObjectPattern()
+ ) ||
// { KEY: MEMBER = _VALUE } = OBJ
- (parentPath.isAssignmentPattern({ left: node }) &&
+ (
+ parentPath.isAssignmentPattern({ left: node }) &&
parentPath.parentPath.isObjectProperty({ value: parent }) &&
- parentPath.parentPath.parentPath.isObjectPattern()) ||
+ parentPath.parentPath.parentPath.isObjectPattern()
+ ) ||
// [MEMBER] = ARR
parentPath.isArrayPattern() ||
// [MEMBER = _VALUE] = ARR
- (parentPath.isAssignmentPattern({ left: node }) &&
- parentPath.parentPath.isArrayPattern()) ||
+ (
+ parentPath.isAssignmentPattern({ left: node }) &&
+ parentPath.parentPath.isArrayPattern()
+ ) ||
// {...MEMBER}
// [...MEMBER]
parentPath.isRestElement()
diff --git ORI/babel/packages/babel-helper-module-imports/src/import-injector.ts ALT/babel/packages/babel-helper-module-imports/src/import-injector.ts
index 1e51580f..f6402c73 100644
--- ORI/babel/packages/babel-helper-module-imports/src/import-injector.ts
+++ ALT/babel/packages/babel-helper-module-imports/src/import-injector.ts
@@ -529,10 +529,14 @@ function isValueImport(node: t.ImportDeclaration) {
function hasNamespaceImport(node: t.ImportDeclaration) {
return (
- (node.specifiers.length === 1 &&
- node.specifiers[0].type === "ImportNamespaceSpecifier") ||
- (node.specifiers.length === 2 &&
- node.specifiers[1].type === "ImportNamespaceSpecifier")
+ (
+ node.specifiers.length === 1 &&
+ node.specifiers[0].type === "ImportNamespaceSpecifier"
+ ) ||
+ (
+ node.specifiers.length === 2 &&
+ node.specifiers[1].type === "ImportNamespaceSpecifier"
+ )
);
}
diff --git ORI/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.ts ALT/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.ts
index c6994033..1e7e9dbd 100644
--- ORI/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.ts
+++ ALT/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.ts
@@ -334,9 +334,11 @@ const rewriteReferencesVisitor: Visitor<RewriteReferencesVisitorState> = {
ref.loc = path.node.loc;
if (
- (path.parentPath.isCallExpression({ callee: path.node }) ||
+ (
+ path.parentPath.isCallExpression({ callee: path.node }) ||
path.parentPath.isOptionalCallExpression({ callee: path.node }) ||
- path.parentPath.isTaggedTemplateExpression({ tag: path.node })) &&
+ path.parentPath.isTaggedTemplateExpression({ tag: path.node })
+ ) &&
isMemberExpression(ref)
) {
path.replaceWith(sequenceExpression([numericLiteral(0), ref]));
diff --git ORI/babel/packages/babel-helper-plugin-utils/src/index.ts ALT/babel/packages/babel-helper-plugin-utils/src/index.ts
index 8dd3e762..4c8aab8d 100644
--- ORI/babel/packages/babel-helper-plugin-utils/src/index.ts
+++ ALT/babel/packages/babel-helper-plugin-utils/src/index.ts
@@ -78,10 +78,12 @@ function copyApiObject(api: PluginAPI): PluginAPI {
proto = Object.getPrototypeOf(api);
if (
proto &&
- (!Object.hasOwn(proto, "version") ||
+ (
+ !Object.hasOwn(proto, "version") ||
!Object.hasOwn(proto, "transform") ||
!Object.hasOwn(proto, "template") ||
- !Object.hasOwn(proto, "types"))
+ !Object.hasOwn(proto, "types")
+ )
) {
proto = null;
}
diff --git ORI/babel/packages/babel-helper-replace-supers/src/index.ts ALT/babel/packages/babel-helper-replace-supers/src/index.ts
index 6ecffe97..10dbc4de 100644
--- ORI/babel/packages/babel-helper-replace-supers/src/index.ts
+++ ALT/babel/packages/babel-helper-replace-supers/src/index.ts
@@ -392,7 +392,7 @@ export default class ReplaceSupers {
this.constantSuper = process.env.BABEL_8_BREAKING
? opts.constantSuper
: // Fallback to isLoose for backward compatibility
- (opts.constantSuper ?? (opts as any).isLoose);
+ opts.constantSuper ?? (opts as any).isLoose;
this.opts = opts;
}
diff --git ORI/babel/packages/babel-helper-string-parser/src/index.ts ALT/babel/packages/babel-helper-string-parser/src/index.ts
index 189675ce..1f1a6063 100644
--- ORI/babel/packages/babel-helper-string-parser/src/index.ts
+++ ALT/babel/packages/babel-helper-string-parser/src/index.ts
@@ -137,8 +137,10 @@ function isStringEnd(
if (type === "template") {
return (
ch === charCodes.graveAccent ||
- (ch === charCodes.dollarSign &&
- input.charCodeAt(pos + 1) === charCodes.leftCurlyBrace)
+ (
+ ch === charCodes.dollarSign &&
+ input.charCodeAt(pos + 1) === charCodes.leftCurlyBrace
+ )
);
}
return (
diff --git ORI/babel/packages/babel-helper-transform-fixture-test-runner/src/index.ts ALT/babel/packages/babel-helper-transform-fixture-test-runner/src/index.ts
index de575a16..483d66ae 100644
--- ORI/babel/packages/babel-helper-transform-fixture-test-runner/src/index.ts
+++ ALT/babel/packages/babel-helper-transform-fixture-test-runner/src/index.ts
@@ -882,8 +882,10 @@ export function buildProcessTests(
}
const skip =
- (opts.minNodeVersion &&
- parseInt(process.versions.node, 10) < opts.minNodeVersion) ||
+ (
+ opts.minNodeVersion &&
+ parseInt(process.versions.node, 10) < opts.minNodeVersion
+ ) ||
(opts.flaky && !process.env.BABEL_CLI_FLAKY_TESTS) ||
opts.BABEL_8_BREAKING === false;
diff --git ORI/babel/packages/babel-helpers/src/helpers/iterableToArrayLimitLoose.js ALT/babel/packages/babel-helpers/src/helpers/iterableToArrayLimitLoose.js
index 2d521715..c64c1067 100644
--- ORI/babel/packages/babel-helpers/src/helpers/iterableToArrayLimitLoose.js
+++ ALT/babel/packages/babel-helpers/src/helpers/iterableToArrayLimitLoose.js
@@ -3,8 +3,10 @@
export default function _iterableToArrayLimitLoose(arr, i) {
var _i =
arr &&
- ((typeof Symbol !== "undefined" && arr[Symbol.iterator]) ||
- arr["@@iterator"]);
+ (
+ (typeof Symbol !== "undefined" && arr[Symbol.iterator]) ||
+ arr["@@iterator"]
+ );
if (_i == null) return;
var _arr = [];
diff --git ORI/babel/packages/babel-helpers/src/helpers/jsx.js ALT/babel/packages/babel-helpers/src/helpers/jsx.js
index e6f7de73..57c90453 100644
--- ORI/babel/packages/babel-helpers/src/helpers/jsx.js
+++ ALT/babel/packages/babel-helpers/src/helpers/jsx.js
@@ -5,10 +5,12 @@ var REACT_ELEMENT_TYPE;
export default function _createRawReactElement(type, props, key, children) {
if (!REACT_ELEMENT_TYPE) {
REACT_ELEMENT_TYPE =
- (typeof Symbol === "function" &&
+ (
+ typeof Symbol === "function" &&
// "for" is a reserved keyword in ES3 so escaping it here for backward compatibility
Symbol["for"] &&
- Symbol["for"]("react.element")) ||
+ Symbol["for"]("react.element")
+ ) ||
0xeac7;
}
diff --git ORI/babel/packages/babel-parser/src/parser/expression.ts ALT/babel/packages/babel-parser/src/parser/expression.ts
index 471493cf..e05430bf 100644
--- ORI/babel/packages/babel-parser/src/parser/expression.ts
+++ ALT/babel/packages/babel-parser/src/parser/expression.ts
@@ -2129,9 +2129,11 @@ export default abstract class ExpressionParser extends LValParser {
return (
!prop.computed &&
prop.key.type === "Identifier" &&
- (this.isLiteralPropertyName() ||
+ (
+ this.isLiteralPropertyName() ||
this.match(tt.bracketL) ||
- this.match(tt.star))
+ this.match(tt.star)
+ )
);
}
diff --git ORI/babel/packages/babel-parser/src/parser/statement.ts ALT/babel/packages/babel-parser/src/parser/statement.ts
index aeb44572..d72e369e 100644
--- ORI/babel/packages/babel-parser/src/parser/statement.ts
+++ ALT/babel/packages/babel-parser/src/parser/statement.ts
@@ -598,10 +598,14 @@ export default abstract class StatementParser extends ExpressionParser {
);
if (
- (result.type === "ExportNamedDeclaration" &&
- (!result.exportKind || result.exportKind === "value")) ||
- (result.type === "ExportAllDeclaration" &&
- (!result.exportKind || result.exportKind === "value")) ||
+ (
+ result.type === "ExportNamedDeclaration" &&
+ (!result.exportKind || result.exportKind === "value")
+ ) ||
+ (
+ result.type === "ExportAllDeclaration" &&
+ (!result.exportKind || result.exportKind === "value")
+ ) ||
result.type === "ExportDefaultDeclaration"
) {
this.sawUnambiguousESM = true;
@@ -1472,11 +1476,13 @@ export default abstract class StatementParser extends ExpressionParser {
if (
init.type === "VariableDeclaration" &&
init.declarations[0].init != null &&
- (!isForIn ||
+ (
+ !isForIn ||
!this.options.annexB ||
this.state.strict ||
init.kind !== "var" ||
- init.declarations[0].id.type !== "Identifier")
+ init.declarations[0].id.type !== "Identifier"
+ )
) {
this.raise(Errors.ForInOfLoopInitializer, init, {
type: isForIn ? "ForInStatement" : "ForOfStatement",
diff --git ORI/babel/packages/babel-parser/src/parser/util.ts ALT/babel/packages/babel-parser/src/parser/util.ts
index 0b02d448..1e610c6c 100644
--- ORI/babel/packages/babel-parser/src/parser/util.ts
+++ ALT/babel/packages/babel-parser/src/parser/util.ts
@@ -287,8 +287,10 @@ export default abstract class UtilParser extends Tokenizer {
*/
hasPropertyAsPrivateName(node: Node): boolean {
return (
- (node.type === "MemberExpression" ||
- node.type === "OptionalMemberExpression") &&
+ (
+ node.type === "MemberExpression" ||
+ node.type === "OptionalMemberExpression"
+ ) &&
this.isPrivateName(node.property)
);
}
diff --git ORI/babel/packages/babel-parser/src/plugins/flow/index.ts ALT/babel/packages/babel-parser/src/plugins/flow/index.ts
index 1e858b86..aab7fbe9 100644
--- ORI/babel/packages/babel-parser/src/plugins/flow/index.ts
+++ ALT/babel/packages/babel-parser/src/plugins/flow/index.ts
@@ -227,10 +227,16 @@ const FlowErrors = ParseErrorEnum`flow`({
function isEsModuleType(bodyElement: N.Node): boolean {
return (
bodyElement.type === "DeclareExportAllDeclaration" ||
- (bodyElement.type === "DeclareExportDeclaration" &&
- (!bodyElement.declaration ||
- (bodyElement.declaration.type !== "TypeAlias" &&
- bodyElement.declaration.type !== "InterfaceDeclaration")))
+ (
+ bodyElement.type === "DeclareExportDeclaration" &&
+ (
+ !bodyElement.declaration ||
+ (
+ bodyElement.declaration.type !== "TypeAlias" &&
+ bodyElement.declaration.type !== "InterfaceDeclaration"
+ )
+ )
+ )
);
}
@@ -593,8 +599,10 @@ export default (superClass: typeof Parser) =>
if (
this.match(tt._const) ||
this.isLet() ||
- ((this.isContextual(tt._type) || this.isContextual(tt._interface)) &&
- !insideModule)
+ (
+ (this.isContextual(tt._type) || this.isContextual(tt._interface)) &&
+ !insideModule
+ )
) {
const label = this.state.value as
| "const"
@@ -2230,10 +2238,14 @@ export default (superClass: typeof Parser) =>
assertModuleNodeAllowed(node: N.Node) {
if (
- (node.type === "ImportDeclaration" &&
- (node.importKind === "type" || node.importKind === "typeof")) ||
- (node.type === "ExportNamedDeclaration" &&
- node.exportKind === "type") ||
+ (
+ node.type === "ImportDeclaration" &&
+ (node.importKind === "type" || node.importKind === "typeof")
+ ) ||
+ (
+ node.type === "ExportNamedDeclaration" &&
+ node.exportKind === "type"
+ ) ||
(node.type === "ExportAllDeclaration" && node.exportKind === "type")
) {
// Allow Flowtype imports and exports in all conditions because
diff --git ORI/babel/packages/babel-parser/src/plugins/typescript/index.ts ALT/babel/packages/babel-parser/src/plugins/typescript/index.ts
index 7ece3b69..bc2033c6 100644
--- ORI/babel/packages/babel-parser/src/plugins/typescript/index.ts
+++ ALT/babel/packages/babel-parser/src/plugins/typescript/index.ts
@@ -289,12 +289,14 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
tsTokenCanFollowModifier() {
return (
- (this.match(tt.bracketL) ||
+ (
+ this.match(tt.bracketL) ||
this.match(tt.braceL) ||
this.match(tt.star) ||
this.match(tt.ellipsis) ||
this.match(tt.privateName) ||
- this.isLiteralPropertyName()) &&
+ this.isLiteralPropertyName()
+ ) &&
!this.hasPrecedingLineBreak()
);
}
@@ -2340,8 +2342,10 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
isSimpleParameter(node: N.Pattern | N.TSParameterProperty) {
return (
- (node.type === "TSParameterProperty" &&
- super.isSimpleParameter(node.parameter)) ||
+ (
+ node.type === "TSParameterProperty" &&
+ super.isSimpleParameter(node.parameter)
+ ) ||
super.isSimpleParameter(node)
);
}
@@ -2549,9 +2553,11 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
// a<b>>>c is not (a<b>)>>c, but a<(b>>>c)
tokenType === tt.bitShiftR ||
// a<b>c is (a<b)>c
- (tokenType !== tt.parenL &&
+ (
+ tokenType !== tt.parenL &&
tokenCanStartExpression(tokenType) &&
- !this.hasPrecedingLineBreak())
+ !this.hasPrecedingLineBreak()
+ )
) {
// Bail out.
return;
@@ -2570,9 +2576,13 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
if (result) {
if (
result.type === "TSInstantiationExpression" &&
- (this.match(tt.dot) ||
- (this.match(tt.questionDot) &&
- this.lookaheadCharCode() !== charCodes.leftParenthesis))
+ (
+ this.match(tt.dot) ||
+ (
+ this.match(tt.questionDot) &&
+ this.lookaheadCharCode() !== charCodes.leftParenthesis
+ )
+ )
) {
this.raise(
TSErrors.InvalidPropertyAccessAfterInstantiationExpression,
@@ -2608,8 +2618,10 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
if (
tokenOperatorPrecedence(tt._in) > minPrec &&
!this.hasPrecedingLineBreak() &&
- (this.isContextual(tt._as) ||
- (isSatisfies = this.isContextual(tt._satisfies)))
+ (
+ this.isContextual(tt._as) ||
+ (isSatisfies = this.isContextual(tt._satisfies))
+ )
) {
const node = this.startNodeAt<
N.TsAsExpression | N.TsSatisfiesExpression
@@ -3708,12 +3720,18 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
TSTypeCastExpression: true,
TSParameterProperty: "parameter",
TSNonNullExpression: "expression",
- TSAsExpression: (binding !== BindingFlag.TYPE_NONE ||
- !isUnparenthesizedInAssign) && ["expression", true],
- TSSatisfiesExpression: (binding !== BindingFlag.TYPE_NONE ||
- !isUnparenthesizedInAssign) && ["expression", true],
- TSTypeAssertion: (binding !== BindingFlag.TYPE_NONE ||
- !isUnparenthesizedInAssign) && ["expression", true],
+ TSAsExpression: (
+ binding !== BindingFlag.TYPE_NONE ||
+ !isUnparenthesizedInAssign
+ ) && ["expression", true],
+ TSSatisfiesExpression: (
+ binding !== BindingFlag.TYPE_NONE ||
+ !isUnparenthesizedInAssign
+ ) && ["expression", true],
+ TSTypeAssertion: (
+ binding !== BindingFlag.TYPE_NONE ||
+ !isUnparenthesizedInAssign
+ ) && ["expression", true],
},
type,
) || super.isValidLVal(type, isUnparenthesizedInAssign, binding)
diff --git ORI/babel/packages/babel-parser/src/util/scope.ts ALT/babel/packages/babel-parser/src/util/scope.ts
index b4cde272..85289fe9 100644
--- ORI/babel/packages/babel-parser/src/util/scope.ts
+++ ALT/babel/packages/babel-parser/src/util/scope.ts
@@ -179,15 +179,19 @@ export default class ScopeHandler<IScope extends Scope = Scope> {
}
return (
- ((type & NameType.Lexical) > 0 &&
+ (
+ (type & NameType.Lexical) > 0 &&
// Annex B.3.4
// https://tc39.es/ecma262/#sec-variablestatements-in-catch-blocks
!(
scope.flags & ScopeFlag.SIMPLE_CATCH &&
scope.firstLexicalName === name
- )) ||
- (!this.treatFunctionsAsVarInScope(scope) &&
- (type & NameType.Function) > 0)
+ )
+ ) ||
+ (
+ !this.treatFunctionsAsVarInScope(scope) &&
+ (type & NameType.Function) > 0
+ )
);
}
diff --git ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/util.ts ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/util.ts
index c5eb72f8..334228f8 100644
--- ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/util.ts
+++ ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/util.ts
@@ -360,8 +360,10 @@ export function* transformPrivateKeyDestructuring(
const indexPath = searchPrivateKey.value;
for (
let indexPathIndex = 0, index;
- (indexPathIndex < indexPath.length &&
- (index = indexPath[indexPathIndex]) !== undefined) ||
+ (
+ indexPathIndex < indexPath.length &&
+ (index = indexPath[indexPathIndex]) !== undefined
+ ) ||
left.type === "AssignmentPattern";
indexPathIndex++
) {
diff --git ORI/babel/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.ts ALT/babel/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.ts
index d653dc9b..02b1b079 100644
--- ORI/babel/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.ts
+++ ALT/babel/packages/babel-plugin-proposal-pipeline-operator/src/hackVisitor.ts
@@ -63,8 +63,10 @@ const visitor: Visitor<PluginPass> = {
if (
visitorState.topicReferences.length === 1 &&
- (!visitorState.sideEffectsBeforeFirstTopicReference ||
- path.scope.isPure(node.left, true))
+ (
+ !visitorState.sideEffectsBeforeFirstTopicReference ||
+ path.scope.isPure(node.left, true)
+ )
) {
visitorState.topicReferences[0].replaceWith(node.left);
path.replaceWith(node.right);
diff --git ORI/babel/packages/babel-plugin-transform-destructuring/src/util.ts ALT/babel/packages/babel-plugin-transform-destructuring/src/util.ts
index 5a6a71ed..ec518c35 100644
--- ORI/babel/packages/babel-plugin-transform-destructuring/src/util.ts
+++ ALT/babel/packages/babel-plugin-transform-destructuring/src/util.ts
@@ -727,8 +727,10 @@ export function convertAssignmentExpression(
let ref: t.Identifier | void;
if (
- (!parentPath.isExpressionStatement() &&
- !parentPath.isSequenceExpression()) ||
+ (
+ !parentPath.isExpressionStatement() &&
+ !parentPath.isSequenceExpression()
+ ) ||
path.isCompletionRecord()
) {
ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref");
diff --git ORI/babel/packages/babel-plugin-transform-instanceof/src/index.ts ALT/babel/packages/babel-plugin-transform-instanceof/src/index.ts
index 6bd6d5b9..84b487f9 100644
--- ORI/babel/packages/babel-plugin-transform-instanceof/src/index.ts
+++ ALT/babel/packages/babel-plugin-transform-instanceof/src/index.ts
@@ -15,9 +15,11 @@ export default declare(api => {
const isUnderHelper = path.findParent(path => {
return (
(path.isVariableDeclarator() && path.node.id === helper) ||
- (path.isFunctionDeclaration() &&
+ (
+ path.isFunctionDeclaration() &&
path.node.id &&
- path.node.id.name === helper.name)
+ path.node.id.name === helper.name
+ )
);
});
diff --git ORI/babel/packages/babel-plugin-transform-modules-commonjs/src/index.ts ALT/babel/packages/babel-plugin-transform-modules-commonjs/src/index.ts
index a7ecffbf..f70d87ee 100644
--- ORI/babel/packages/babel-plugin-transform-modules-commonjs/src/index.ts
+++ ALT/babel/packages/babel-plugin-transform-modules-commonjs/src/index.ts
@@ -96,8 +96,10 @@ export default declare((api, options: Options) => {
if (
// redeclared in this scope
rootBinding !== localBinding ||
- (path.parentPath.isObjectProperty({ value: path.node }) &&
- path.parentPath.parentPath.isObjectPattern()) ||
+ (
+ path.parentPath.isObjectProperty({ value: path.node }) &&
+ path.parentPath.parentPath.isObjectPattern()
+ ) ||
path.parentPath.isAssignmentExpression({ left: path.node }) ||
path.isAssignmentExpression({ left: path.node })
) {
diff --git ORI/babel/packages/babel-plugin-transform-object-rest-spread/src/index.ts ALT/babel/packages/babel-plugin-transform-object-rest-spread/src/index.ts
index f85525db..dc631d08 100644
--- ORI/babel/packages/babel-plugin-transform-object-rest-spread/src/index.ts
+++ ALT/babel/packages/babel-plugin-transform-object-rest-spread/src/index.ts
@@ -134,10 +134,14 @@ export default declare((api, opts: Options) => {
keys.push(t.cloneNode(key));
if (
- (t.isMemberExpression(key, { computed: false }) &&
- t.isIdentifier(key.object, { name: "Symbol" })) ||
- (t.isCallExpression(key) &&
- t.matchesPattern(key.callee, "Symbol.for"))
+ (
+ t.isMemberExpression(key, { computed: false }) &&
+ t.isIdentifier(key.object, { name: "Symbol" })
+ ) ||
+ (
+ t.isCallExpression(key) &&
+ t.matchesPattern(key.callee, "Symbol.for")
+ )
) {
// there all return a primitive
} else {
diff --git ORI/babel/packages/babel-plugin-transform-optional-chaining/src/transform.ts ALT/babel/packages/babel-plugin-transform-optional-chaining/src/transform.ts
index 704b043c..333375a7 100644
--- ORI/babel/packages/babel-plugin-transform-optional-chaining/src/transform.ts
+++ ALT/babel/packages/babel-plugin-transform-optional-chaining/src/transform.ts
@@ -19,9 +19,11 @@ function isSimpleMemberExpression(
return (
t.isIdentifier(expression) ||
t.isSuper(expression) ||
- (t.isMemberExpression(expression) &&
+ (
+ t.isMemberExpression(expression) &&
!expression.computed &&
- isSimpleMemberExpression(expression.object))
+ isSimpleMemberExpression(expression.object)
+ )
);
}
@@ -213,10 +215,14 @@ export function transformOptionalChain(
!ifNullishBoolean && t.isUnaryExpression(ifNullish, { operator: "void" });
const isEvaluationValueIgnored =
- (t.isExpressionStatement(replacementPath.parent) &&
- !replacementPath.isCompletionRecord()) ||
- (t.isSequenceExpression(replacementPath.parent) &&
- last(replacementPath.parent.expressions) !== replacementPath.node);
+ (
+ t.isExpressionStatement(replacementPath.parent) &&
+ !replacementPath.isCompletionRecord()
+ ) ||
+ (
+ t.isSequenceExpression(replacementPath.parent) &&
+ last(replacementPath.parent.expressions) !== replacementPath.node
+ );
// prettier-ignore
const tpl = ifNullishFalse
diff --git ORI/babel/packages/babel-plugin-transform-parameters/src/rest.ts ALT/babel/packages/babel-plugin-transform-parameters/src/rest.ts
index e7b516d3..ced49042 100644
--- ORI/babel/packages/babel-plugin-transform-parameters/src/rest.ts
+++ ALT/babel/packages/babel-plugin-transform-parameters/src/rest.ts
@@ -137,8 +137,10 @@ const memberExpressionOptimisationVisitor: Visitor<State> = {
!(
// ex: `args[0] = "whatever"`
(
- (grandparentPath.isAssignmentExpression() &&
- parentPath.node === grandparentPath.node.left) ||
+ (
+ grandparentPath.isAssignmentExpression() &&
+ parentPath.node === grandparentPath.node.left
+ ) ||
// ex: `[args[0]] = ["whatever"]`
grandparentPath.isLVal() ||
// ex: `for (rest[0] in this)`
@@ -152,9 +154,13 @@ const memberExpressionOptimisationVisitor: Visitor<State> = {
// ex: `args[0]()`
// ex: `new args[0]()`
// ex: `new args[0]`
- ((grandparentPath.isCallExpression() ||
- grandparentPath.isNewExpression()) &&
- parentPath.node === grandparentPath.node.callee)
+ (
+ (
+ grandparentPath.isCallExpression() ||
+ grandparentPath.isNewExpression()
+ ) &&
+ parentPath.node === grandparentPath.node.callee
+ )
)
);
diff --git ORI/babel/packages/babel-plugin-transform-parameters/src/shadow-utils.ts ALT/babel/packages/babel-plugin-transform-parameters/src/shadow-utils.ts
index fe9648ed..619aeee2 100644
--- ORI/babel/packages/babel-plugin-transform-parameters/src/shadow-utils.ts
+++ ALT/babel/packages/babel-plugin-transform-parameters/src/shadow-utils.ts
@@ -16,8 +16,10 @@ export const iifeVisitor: Visitor<State> = {
if (
name === "eval" ||
- (scope.getBinding(name) === state.scope.parent.getBinding(name) &&
- state.scope.hasOwnBinding(name))
+ (
+ scope.getBinding(name) === state.scope.parent.getBinding(name) &&
+ state.scope.hasOwnBinding(name)
+ )
) {
state.needsOuterBinding = true;
path.stop();
diff --git ORI/babel/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts ALT/babel/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts
index 65672389..f2835149 100644
--- ORI/babel/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts
+++ ALT/babel/packages/babel-plugin-transform-react-jsx/src/create-plugin.ts
@@ -43,8 +43,10 @@ function hasProto(node: t.ObjectExpression) {
return node.properties.some(
value =>
t.isObjectProperty(value, { computed: false, shorthand: false }) &&
- (t.isIdentifier(value.key, { name: "__proto__" }) ||
- t.isStringLiteral(value.key, { value: "__proto__" })),
+ (
+ t.isIdentifier(value.key, { name: "__proto__" }) ||
+ t.isStringLiteral(value.key, { value: "__proto__" })
+ ),
);
}
diff --git ORI/babel/packages/babel-plugin-transform-typeof-symbol/src/index.ts ALT/babel/packages/babel-plugin-transform-typeof-symbol/src/index.ts
index 5b9e8294..51929733 100644
--- ORI/babel/packages/babel-plugin-transform-typeof-symbol/src/index.ts
+++ ALT/babel/packages/babel-plugin-transform-typeof-symbol/src/index.ts
@@ -57,9 +57,11 @@ export default declare(api => {
isUnderHelper = path.findParent(path => {
return (
(path.isVariableDeclarator() && path.node.id === helper) ||
- (path.isFunctionDeclaration() &&
+ (
+ path.isFunctionDeclaration() &&
path.node.id &&
- path.node.id.name === helper.name)
+ path.node.id.name === helper.name
+ )
);
});
diff --git ORI/babel/packages/babel-plugin-transform-typescript/src/index.ts ALT/babel/packages/babel-plugin-transform-typescript/src/index.ts
index e996c6f1..328f30e1 100644
--- ORI/babel/packages/babel-plugin-transform-typescript/src/index.ts
+++ ALT/babel/packages/babel-plugin-transform-typescript/src/index.ts
@@ -380,8 +380,10 @@ export default declare((api, opts: Options) => {
stmt.isTSInterfaceDeclaration() ||
stmt.isClassDeclaration({ declare: true }) ||
stmt.isTSEnumDeclaration({ declare: true }) ||
- (stmt.isTSModuleDeclaration({ declare: true }) &&
- stmt.get("id").isIdentifier())
+ (
+ stmt.isTSModuleDeclaration({ declare: true }) &&
+ stmt.get("id").isIdentifier()
+ )
) {
registerGlobalType(
programScope,
diff --git ORI/babel/packages/babel-preset-env/src/index.ts ALT/babel/packages/babel-preset-env/src/index.ts
index 23b3da85..d834798c 100644
--- ORI/babel/packages/babel-preset-env/src/index.ts
+++ ALT/babel/packages/babel-preset-env/src/index.ts
@@ -471,9 +471,11 @@ option \`forceAllTransforms: true\` instead.
.map(pluginName => {
if (
!process.env.BABEL_8_BREAKING &&
- (pluginName === "transform-class-properties" ||
+ (
+ pluginName === "transform-class-properties" ||
pluginName === "transform-private-methods" ||
- pluginName === "transform-private-property-in-object")
+ pluginName === "transform-private-property-in-object"
+ )
) {
return [
getPlugin(pluginName),
diff --git ORI/babel/packages/babel-template/src/parse.ts ALT/babel/packages/babel-template/src/parse.ts
index 7c8ef5e7..5768ea27 100644
--- ORI/babel/packages/babel-template/src/parse.ts
+++ ALT/babel/packages/babel-template/src/parse.ts
@@ -112,8 +112,10 @@ function placeholderVisitorHandler(
if (
!hasSyntacticPlaceholders &&
- (state.placeholderPattern === false ||
- !(state.placeholderPattern || PATTERN).test(name)) &&
+ (
+ state.placeholderPattern === false ||
+ !(state.placeholderPattern || PATTERN).test(name)
+ ) &&
!state.placeholderWhitelist?.has(name)
) {
return;
diff --git ORI/babel/packages/babel-traverse/src/path/context.ts ALT/babel/packages/babel-traverse/src/path/context.ts
index 43a209a9..15cf1437 100644
--- ORI/babel/packages/babel-traverse/src/path/context.ts
+++ ALT/babel/packages/babel-traverse/src/path/context.ts
@@ -137,8 +137,10 @@ export function setScope(this: NodePath) {
if (
// Skip method scope if is computed method key or decorator expression
- ((this.key === "key" || this.listKey === "decorators") &&
- path.isMethod()) ||
+ (
+ (this.key === "key" || this.listKey === "decorators") &&
+ path.isMethod()
+ ) ||
// Skip switch scope if for discriminant (`x` in `switch (x) {}`).
(this.key === "discriminant" && path.isSwitchStatement())
) {
diff --git ORI/babel/packages/babel-traverse/src/path/evaluation.ts ALT/babel/packages/babel-traverse/src/path/evaluation.ts
index a6f4c0dd..c2c8ba7c 100644
--- ORI/babel/packages/babel-traverse/src/path/evaluation.ts
+++ ALT/babel/packages/babel-traverse/src/path/evaluation.ts
@@ -425,8 +425,10 @@ function _evaluate(path: NodePath, state: State): any {
if (
callee.isIdentifier() &&
!path.scope.getBinding(callee.node.name) &&
- (isValidObjectCallee(callee.node.name) ||
- isValidIdentifierCallee(callee.node.name))
+ (
+ isValidObjectCallee(callee.node.name) ||
+ isValidIdentifierCallee(callee.node.name)
+ )
) {
func = global[callee.node.name];
}
diff --git ORI/babel/packages/babel-traverse/src/path/family.ts ALT/babel/packages/babel-traverse/src/path/family.ts
index afac45d0..04c7916b 100644
--- ORI/babel/packages/babel-traverse/src/path/family.ts
+++ ALT/babel/packages/babel-traverse/src/path/family.ts
@@ -133,8 +133,10 @@ function getStatementListCompletion(
const newContext = { ...context, inCaseClause: false };
if (
path.isBlockStatement() &&
- (context.inCaseClause || // case test: { break }
- context.shouldPopulateBreak) // case test: { { break } }
+ (
+ context.inCaseClause || // case test: { break }
+ context.shouldPopulateBreak
+ ) // case test: { { break } }
) {
newContext.shouldPopulateBreak = true;
} else {
@@ -211,8 +213,10 @@ function getStatementListCompletion(
const pathCompletions = _getCompletionRecords(paths[i], context);
if (
pathCompletions.length > 1 ||
- (pathCompletions.length === 1 &&
- !pathCompletions[0].path.isVariableDeclaration())
+ (
+ pathCompletions.length === 1 &&
+ !pathCompletions[0].path.isVariableDeclaration()
+ )
) {
completions.push(...pathCompletions);
break;
diff --git ORI/babel/packages/babel-traverse/src/path/inference/index.ts ALT/babel/packages/babel-traverse/src/path/inference/index.ts
index ab8b79b4..7b95727c 100644
--- ORI/babel/packages/babel-traverse/src/path/inference/index.ts
+++ ALT/babel/packages/babel-traverse/src/path/inference/index.ts
@@ -183,13 +183,17 @@ export function isGenericType(this: NodePath, genericName: string): boolean {
}
}
return (
- (isGenericTypeAnnotation(type) &&
+ (
+ isGenericTypeAnnotation(type) &&
isIdentifier(type.id, {
name: genericName,
- })) ||
- (isTSTypeReference(type) &&
+ })
+ ) ||
+ (
+ isTSTypeReference(type) &&
isIdentifier(type.typeName, {
name: genericName,
- }))
+ })
+ )
);
}
diff --git ORI/babel/packages/babel-traverse/src/path/introspection.ts ALT/babel/packages/babel-traverse/src/path/introspection.ts
index de8a4066..377c38e6 100644
--- ORI/babel/packages/babel-traverse/src/path/introspection.ts
+++ ALT/babel/packages/babel-traverse/src/path/introspection.ts
@@ -195,12 +195,16 @@ export function referencesImport(
): boolean {
if (!this.isReferencedIdentifier()) {
if (
- (this.isJSXMemberExpression() &&
- this.node.property.name === importName) ||
- ((this.isMemberExpression() || this.isOptionalMemberExpression()) &&
+ (
+ this.isJSXMemberExpression() &&
+ this.node.property.name === importName
+ ) ||
+ (
+ (this.isMemberExpression() || this.isOptionalMemberExpression()) &&
(this.node.computed
? isStringLiteral(this.node.property, { value: importName })
- : (this.node.property as t.Identifier).name === importName))
+ : (this.node.property as t.Identifier).name === importName)
+ )
) {
const object = (
this as NodePath<t.MemberExpression | t.OptionalMemberExpression>
diff --git ORI/babel/packages/babel-traverse/src/path/lib/removal-hooks.ts ALT/babel/packages/babel-traverse/src/path/lib/removal-hooks.ts
index 958e0802..91bd6460 100644
--- ORI/babel/packages/babel-traverse/src/path/lib/removal-hooks.ts
+++ ALT/babel/packages/babel-traverse/src/path/lib/removal-hooks.ts
@@ -22,9 +22,11 @@ export const hooks = [
(self.key === "body" && parent.isLabeledStatement()) ||
// let NODE;
// remove an entire declaration if there are no declarators left
- (self.listKey === "declarations" &&
+ (
+ self.listKey === "declarations" &&
parent.isVariableDeclaration() &&
- parent.node.declarations.length === 1) ||
+ parent.node.declarations.length === 1
+ ) ||
// NODE;
// remove the entire expression statement if there's no expression
(self.key === "expression" && parent.isExpressionStatement());
@@ -63,8 +65,10 @@ export const hooks = [
function (self: NodePath, parent: NodePath) {
if (
(parent.isIfStatement() && self.key === "consequent") ||
- (self.key === "body" &&
- (parent.isLoop() || parent.isArrowFunctionExpression()))
+ (
+ self.key === "body" &&
+ (parent.isLoop() || parent.isArrowFunctionExpression())
+ )
) {
self.replaceWith({
type: "BlockStatement",
diff --git ORI/babel/packages/babel-traverse/src/path/modification.ts ALT/babel/packages/babel-traverse/src/path/modification.ts
index 8696f192..c790213f 100644
--- ORI/babel/packages/babel-traverse/src/path/modification.ts
+++ ALT/babel/packages/babel-traverse/src/path/modification.ts
@@ -64,8 +64,10 @@ export function insertBefore(
const node = this.node as t.Statement;
const shouldInsertCurrentNode =
node &&
- (!this.isExpressionStatement() ||
- (node as t.ExpressionStatement).expression != null);
+ (
+ !this.isExpressionStatement() ||
+ (node as t.ExpressionStatement).expression != null
+ );
this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
return (this as NodePath<t.BlockStatement>).unshiftContainer(
@@ -135,8 +137,10 @@ const last = <T>(arr: T[]) => arr[arr.length - 1];
function isHiddenInSequenceExpression(path: NodePath): boolean {
return (
isSequenceExpression(path.parent) &&
- (last(path.parent.expressions) !== path.node ||
- isHiddenInSequenceExpression(path.parentPath))
+ (
+ last(path.parent.expressions) !== path.node ||
+ isHiddenInSequenceExpression(path.parentPath)
+ )
);
}
@@ -197,9 +201,11 @@ export function insertAfter(
}),
);
} else if (
- (this.isNodeType("Expression") &&
+ (
+ this.isNodeType("Expression") &&
!this.isJSXElement() &&
- !parentPath.isJSXElement()) ||
+ !parentPath.isJSXElement()
+ ) ||
(parentPath.isForStatement() && this.key === "init")
) {
const self = this as NodePath<t.Expression | t.VariableDeclaration>;
@@ -255,8 +261,10 @@ export function insertAfter(
const node = this.node as t.Statement;
const shouldInsertCurrentNode =
node &&
- (!this.isExpressionStatement() ||
- (node as t.ExpressionStatement).expression != null);
+ (
+ !this.isExpressionStatement() ||
+ (node as t.ExpressionStatement).expression != null
+ );
this.replaceWith(blockStatement(shouldInsertCurrentNode ? [node] : []));
// @ts-expect-error Fixme: refine nodes to t.BlockStatement["body"] when this is a BlockStatement path
diff --git ORI/babel/packages/babel-traverse/src/scope/index.ts ALT/babel/packages/babel-traverse/src/scope/index.ts
index d945a55f..4729c696 100644
--- ORI/babel/packages/babel-traverse/src/scope/index.ts
+++ ALT/babel/packages/babel-traverse/src/scope/index.ts
@@ -65,9 +65,11 @@ function gatherNodeParts(node: t.Node, parts: NodePart[]) {
default:
if (isImportDeclaration(node) || isExportDeclaration(node)) {
if (
- (isExportAllDeclaration(node) ||
+ (
+ isExportAllDeclaration(node) ||
isExportNamedDeclaration(node) ||
- isImportDeclaration(node)) &&
+ isImportDeclaration(node)
+ ) &&
node.source
) {
gatherNodeParts(node.source, parts);
@@ -77,8 +79,10 @@ function gatherNodeParts(node: t.Node, parts: NodePart[]) {
) {
for (const e of node.specifiers) gatherNodeParts(e, parts);
} else if (
- (isExportDefaultDeclaration(node) ||
- isExportNamedDeclaration(node)) &&
+ (
+ isExportDefaultDeclaration(node) ||
+ isExportNamedDeclaration(node)
+ ) &&
node.declaration
) {
gatherNodeParts(node.declaration, parts);
@@ -766,9 +770,13 @@ export default class Scope {
for (const specifier of specifiers) {
const isTypeSpecifier =
isTypeDeclaration ||
- (specifier.isImportSpecifier() &&
- (specifier.node.importKind === "type" ||
- specifier.node.importKind === "typeof"));
+ (
+ specifier.isImportSpecifier() &&
+ (
+ specifier.node.importKind === "type" ||
+ specifier.node.importKind === "typeof"
+ )
+ );
this.registerBinding(isTypeSpecifier ? "unknown" : "module", specifier);
}
diff --git ORI/babel/packages/babel-types/src/validators/isLet.ts ALT/babel/packages/babel-types/src/validators/isLet.ts
index c0101c44..0b6a4ae2 100644
--- ORI/babel/packages/babel-types/src/validators/isLet.ts
+++ ALT/babel/packages/babel-types/src/validators/isLet.ts
@@ -8,8 +8,10 @@ import type * as t from "../index.ts";
export default function isLet(node: t.Node): boolean {
return (
isVariableDeclaration(node) &&
- (node.kind !== "var" ||
+ (
+ node.kind !== "var" ||
// @ts-expect-error Fixme: document private properties
- node[BLOCK_SCOPED_SYMBOL])
+ node[BLOCK_SCOPED_SYMBOL]
+ )
);
} |
prettier/prettier#11103 VS prettier/prettier@main :: mdn/content@7e059cd Diff (90 lines)diff --git ORI/content/files/en-us/web/api/htmltextareaelement/index.md ALT/content/files/en-us/web/api/htmltextareaelement/index.md
index e7333692..b53ca793 100644
--- ORI/content/files/en-us/web/api/htmltextareaelement/index.md
+++ ALT/content/files/en-us/web/api/htmltextareaelement/index.md
@@ -251,9 +251,13 @@ function checkRows(oField, oKeyEvent) {
nKey === 13 ||
nLen + 1 < nCols ||
/\n/.test(sRow) ||
- ((nRowStart === 0 || nDeltaForw > 0 || nKey > 0) &&
- (sRow.length < nCols ||
- (nKey > 0 && (nLen === nRowEnd || sVal.charAt(nRowEnd) === "\n"))));
+ (
+ (nRowStart === 0 || nDeltaForw > 0 || nKey > 0) &&
+ (
+ sRow.length < nCols ||
+ (nKey > 0 && (nLen === nRowEnd || sVal.charAt(nRowEnd) === "\n"))
+ )
+ );
return (
(nKey !== 13 || (aReturns ? aReturns.length + 1 : 1) < nRows) &&
diff --git ORI/content/files/en-us/web/api/keyboardevent/getmodifierstate/index.md ALT/content/files/en-us/web/api/keyboardevent/getmodifierstate/index.md
index 231ae2c5..099f4a3a 100644
--- ORI/content/files/en-us/web/api/keyboardevent/getmodifierstate/index.md
+++ ALT/content/files/en-us/web/api/keyboardevent/getmodifierstate/index.md
@@ -249,8 +249,10 @@ function handleKeyboardEvent(event) {
// Do something different for arrow keys if ScrollLock is locked.
if (
- (event.getModifierState("ScrollLock") ||
- event.getModifierState("Scroll")) /* hack for IE */ &&
+ (
+ event.getModifierState("ScrollLock") ||
+ event.getModifierState("Scroll")
+ ) /* hack for IE */ &&
!event.getModifierState("Control") &&
!event.getModifierState("Alt") &&
!event.getModifierState("Meta")
diff --git ORI/content/files/en-us/web/api/rtcicecandidatestats/deleted/index.md ALT/content/files/en-us/web/api/rtcicecandidatestats/deleted/index.md
index 09af60b0..72fd4b23 100644
--- ORI/content/files/en-us/web/api/rtcicecandidatestats/deleted/index.md
+++ ALT/content/files/en-us/web/api/rtcicecandidatestats/deleted/index.md
@@ -46,8 +46,10 @@ setInterval(() => {
stats.forEach((report) => {
if (
- (stats.type === "local-candidate" ||
- stats.type === "remote.candidate") &&
+ (
+ stats.type === "local-candidate" ||
+ stats.type === "remote.candidate"
+ ) &&
!stats.deleted
) {
statsOutput +=
diff --git ORI/content/files/en-us/web/api/web_storage_api/using_the_web_storage_api/index.md ALT/content/files/en-us/web/api/web_storage_api/using_the_web_storage_api/index.md
index c42da983..12974751 100644
--- ORI/content/files/en-us/web/api/web_storage_api/using_the_web_storage_api/index.md
+++ ALT/content/files/en-us/web/api/web_storage_api/using_the_web_storage_api/index.md
@@ -61,14 +61,16 @@ function storageAvailable(type) {
return (
e instanceof DOMException &&
// everything except Firefox
- (e.code === 22 ||
+ (
+ e.code === 22 ||
// Firefox
e.code === 1014 ||
// test name field too, because code might not be present
// everything except Firefox
e.name === "QuotaExceededError" ||
// Firefox
- e.name === "NS_ERROR_DOM_QUOTA_REACHED") &&
+ e.name === "NS_ERROR_DOM_QUOTA_REACHED"
+ ) &&
// acknowledge QuotaExceededError only if there's something already stored
storage &&
storage.length !== 0
diff --git ORI/content/files/en-us/web/javascript/reference/global_objects/math/atan2/index.md ALT/content/files/en-us/web/javascript/reference/global_objects/math/atan2/index.md
index d634a8c9..a1febd44 100644
--- ORI/content/files/en-us/web/javascript/reference/global_objects/math/atan2/index.md
+++ ALT/content/files/en-us/web/javascript/reference/global_objects/math/atan2/index.md
@@ -88,7 +88,7 @@ function format(template, ...args) {
...args.map((num) =>
(Object.is(num, -0)
? "-0"
- : (formattedNumbers.get(num) ?? String(num))
+ : formattedNumbers.get(num) ?? String(num)
).padEnd(5),
),
); |
prettier/prettier#11103 VS prettier/prettier@main :: vuejs/eslint-plugin-vue@cfad3ee Diff (1041 lines)diff --git ORI/eslint-plugin-vue/lib/rules/attributes-order.js ALT/eslint-plugin-vue/lib/rules/attributes-order.js
index 30dc75c..40997d2 100644
--- ORI/eslint-plugin-vue/lib/rules/attributes-order.js
+++ ALT/eslint-plugin-vue/lib/rules/attributes-order.js
@@ -368,8 +368,10 @@ function create(context) {
const attributes = node.attributes.filter((node, index, attributes) => {
if (
isVBindObject(node) &&
- (isVAttributeOrVBindOrVModel(attributes[index - 1]) ||
- isVAttributeOrVBindOrVModel(attributes[index + 1]))
+ (
+ isVAttributeOrVBindOrVModel(attributes[index - 1]) ||
+ isVAttributeOrVBindOrVModel(attributes[index + 1])
+ )
) {
// In Vue 3, ignore `v-bind="object"`, which is
// a pair of `v-bind:foo="..."` and `v-bind="object"` and
diff --git ORI/eslint-plugin-vue/lib/rules/component-definition-name-casing.js ALT/eslint-plugin-vue/lib/rules/component-definition-name-casing.js
index 840a89e..4a30870 100644
--- ORI/eslint-plugin-vue/lib/rules/component-definition-name-casing.js
+++ ALT/eslint-plugin-vue/lib/rules/component-definition-name-casing.js
@@ -15,9 +15,11 @@ const allowedCaseOptions = ['PascalCase', 'kebab-case']
function canConvert(node) {
return (
node.type === 'Literal' ||
- (node.type === 'TemplateLiteral' &&
+ (
+ node.type === 'TemplateLiteral' &&
node.expressions.length === 0 &&
- node.quasis.length === 1)
+ node.quasis.length === 1
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/html-comment-indent.js ALT/eslint-plugin-vue/lib/rules/html-comment-indent.js
index f0f7bab..9e7a836 100644
--- ORI/eslint-plugin-vue/lib/rules/html-comment-indent.js
+++ ALT/eslint-plugin-vue/lib/rules/html-comment-indent.js
@@ -179,8 +179,10 @@ module.exports = {
// validate base indent
if (
baseIndentText &&
- (actualIndentText.length < baseIndentText.length ||
- !actualIndentText.startsWith(baseIndentText))
+ (
+ actualIndentText.length < baseIndentText.length ||
+ !actualIndentText.startsWith(baseIndentText)
+ )
) {
context.report({
loc: {
diff --git ORI/eslint-plugin-vue/lib/rules/match-component-file-name.js ALT/eslint-plugin-vue/lib/rules/match-component-file-name.js
index 181d88f..ea09702 100644
--- ORI/eslint-plugin-vue/lib/rules/match-component-file-name.js
+++ ALT/eslint-plugin-vue/lib/rules/match-component-file-name.js
@@ -15,9 +15,11 @@ const path = require('path')
function canVerify(node) {
return (
node.type === 'Literal' ||
- (node.type === 'TemplateLiteral' &&
+ (
+ node.type === 'TemplateLiteral' &&
node.expressions.length === 0 &&
- node.quasis.length === 1)
+ node.quasis.length === 1
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/max-len.js ALT/eslint-plugin-vue/lib/rules/max-len.js
index 0492aa4..ca06012 100644
--- ORI/eslint-plugin-vue/lib/rules/max-len.js
+++ ALT/eslint-plugin-vue/lib/rules/max-len.js
@@ -103,8 +103,10 @@ function isTrailingComment(line, lineNumber, comment) {
comment &&
comment.loc.start.line === lineNumber &&
lineNumber <= comment.loc.end.line &&
- (comment.loc.end.line > lineNumber ||
- comment.loc.end.column === line.length)
+ (
+ comment.loc.end.line > lineNumber ||
+ comment.loc.end.column === line.length
+ )
)
}
@@ -125,10 +127,14 @@ function isFullLineComment(line, lineNumber, comment) {
return (
comment &&
- (start.line < lineNumber ||
- (start.line === lineNumber && isFirstTokenOnLine)) &&
- (end.line > lineNumber ||
- (end.line === lineNumber && end.column === line.length))
+ (
+ start.line < lineNumber ||
+ (start.line === lineNumber && isFirstTokenOnLine)
+ ) &&
+ (
+ end.line > lineNumber ||
+ (end.line === lineNumber && end.column === line.length)
+ )
)
}
@@ -262,9 +268,11 @@ module.exports = {
return tokens.filter(
(token) =>
token.type === 'String' ||
- (token.type === 'JSXText' &&
+ (
+ token.type === 'JSXText' &&
sourceCode.getNodeByRangeIndex(token.range[0] - 1).type ===
- 'JSXAttribute')
+ 'JSXAttribute'
+ )
)
}
@@ -413,8 +421,10 @@ module.exports = {
(ignoreStrings && stringsByLine[lineNumber]) ||
(ignoreTemplateLiterals && templateLiteralsByLine[lineNumber]) ||
(ignoreRegExpLiterals && regExpLiteralsByLine[lineNumber]) ||
- (ignoreHTMLAttributeValues &&
- htmlAttributeValuesByLine[lineNumber]) ||
+ (
+ ignoreHTMLAttributeValues &&
+ htmlAttributeValuesByLine[lineNumber]
+ ) ||
(ignoreHTMLTextContents && htmlTextContentsByLine[lineNumber])
) {
// ignore this line
diff --git ORI/eslint-plugin-vue/lib/rules/next-tick-style.js ALT/eslint-plugin-vue/lib/rules/next-tick-style.js
index 08cc85a..3b8ade3 100644
--- ORI/eslint-plugin-vue/lib/rules/next-tick-style.js
+++ ALT/eslint-plugin-vue/lib/rules/next-tick-style.js
@@ -73,9 +73,11 @@ function getVueNextTickCallExpression(identifier, context) {
function isAwaitedPromise(callExpression) {
return (
callExpression.parent.type === 'AwaitExpression' ||
- (callExpression.parent.type === 'MemberExpression' &&
+ (
+ callExpression.parent.type === 'MemberExpression' &&
callExpression.parent.property.type === 'Identifier' &&
- callExpression.parent.property.name === 'then')
+ callExpression.parent.property.name === 'then'
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-async-in-computed-properties.js ALT/eslint-plugin-vue/lib/rules/no-async-in-computed-properties.js
index e8ed02f..f1df125 100644
--- ORI/eslint-plugin-vue/lib/rules/no-async-in-computed-properties.js
+++ ALT/eslint-plugin-vue/lib/rules/no-async-in-computed-properties.js
@@ -29,11 +29,15 @@ const TIMED_FUNCTIONS = new Set([
function isTimedFunction(node) {
const callee = utils.skipChainExpression(node.callee)
return (
- ((callee.type === 'Identifier' && TIMED_FUNCTIONS.has(callee.name)) ||
- (callee.type === 'MemberExpression' &&
+ (
+ (callee.type === 'Identifier' && TIMED_FUNCTIONS.has(callee.name)) ||
+ (
+ callee.type === 'MemberExpression' &&
callee.object.type === 'Identifier' &&
callee.object.name === 'window' &&
- TIMED_FUNCTIONS.has(utils.getStaticPropertyName(callee) || ''))) &&
+ TIMED_FUNCTIONS.has(utils.getStaticPropertyName(callee) || '')
+ )
+ ) &&
node.arguments.length > 0
)
}
@@ -48,11 +52,15 @@ function isPromise(node) {
return (
name &&
// hello.PROMISE_FUNCTION()
- (PROMISE_FUNCTIONS.has(name) ||
+ (
+ PROMISE_FUNCTIONS.has(name) ||
// Promise.PROMISE_METHOD()
- (callee.object.type === 'Identifier' &&
+ (
+ callee.object.type === 'Identifier' &&
callee.object.name === 'Promise' &&
- PROMISE_METHODS.has(name)))
+ PROMISE_METHODS.has(name)
+ )
+ )
)
}
return false
@@ -68,9 +76,11 @@ function isNextTick(node, context) {
const name = utils.getStaticPropertyName(callee)
return (
(utils.isThis(callee.object, context) && name === '$nextTick') ||
- (callee.object.type === 'Identifier' &&
+ (
+ callee.object.type === 'Identifier' &&
callee.object.name === 'Vue' &&
- name === 'nextTick')
+ name === 'nextTick'
+ )
)
}
return false
diff --git ORI/eslint-plugin-vue/lib/rules/no-computed-properties-in-data.js ALT/eslint-plugin-vue/lib/rules/no-computed-properties-in-data.js
index a227394..bf49f2e 100644
--- ORI/eslint-plugin-vue/lib/rules/no-computed-properties-in-data.js
+++ ALT/eslint-plugin-vue/lib/rules/no-computed-properties-in-data.js
@@ -58,8 +58,10 @@ module.exports = {
const dataProperty = utils.findProperty(node, 'data')
if (
!dataProperty ||
- (dataProperty.value.type !== 'FunctionExpression' &&
- dataProperty.value.type !== 'ArrowFunctionExpression')
+ (
+ dataProperty.value.type !== 'FunctionExpression' &&
+ dataProperty.value.type !== 'ArrowFunctionExpression'
+ )
) {
return
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-duplicate-attributes.js ALT/eslint-plugin-vue/lib/rules/no-duplicate-attributes.js
index 0c7d3eb..eab5cef 100644
--- ORI/eslint-plugin-vue/lib/rules/no-duplicate-attributes.js
+++ ALT/eslint-plugin-vue/lib/rules/no-duplicate-attributes.js
@@ -18,9 +18,11 @@ function getName(attribute) {
}
if (attribute.key.name.name === 'bind') {
return (
- (attribute.key.argument &&
+ (
+ attribute.key.argument &&
attribute.key.argument.type === 'VIdentifier' &&
- attribute.key.argument.name) ||
+ attribute.key.argument.name
+ ) ||
null
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-mutating-props.js ALT/eslint-plugin-vue/lib/rules/no-mutating-props.js
index 3689d38..3d66354 100644
--- ORI/eslint-plugin-vue/lib/rules/no-mutating-props.js
+++ ALT/eslint-plugin-vue/lib/rules/no-mutating-props.js
@@ -289,8 +289,10 @@ module.exports = {
function isShallowOnlyInvalid(invalid, isRootProps) {
return (
!shallowOnly ||
- (invalid.pathNodes.length === (isRootProps ? 1 : 0) &&
- ['assignment', 'update'].includes(invalid.kind))
+ (
+ invalid.pathNodes.length === (isRootProps ? 1 : 0) &&
+ ['assignment', 'update'].includes(invalid.kind)
+ )
)
}
@@ -367,9 +369,13 @@ module.exports = {
},
onVueObjectExit(node, { type }) {
if (
- (!vueObjectData ||
- (vueObjectData.type !== 'export' &&
- vueObjectData.type !== 'setup')) &&
+ (
+ !vueObjectData ||
+ (
+ vueObjectData.type !== 'export' &&
+ vueObjectData.type !== 'setup'
+ )
+ ) &&
type !== 'instance'
) {
vueObjectData = {
@@ -453,9 +459,11 @@ module.exports = {
const isRootProps = !!node.name && propsInfo.name === node.name
const parent = node.parent
const name =
- (isRootProps &&
+ (
+ isRootProps &&
parent.type === 'MemberExpression' &&
- utils.getStaticPropertyName(parent)) ||
+ utils.getStaticPropertyName(parent)
+ ) ||
node.name
if (name && (propsInfo.set.has(name) || isRootProps)) {
verifyMutating(node, name, isRootProps)
diff --git ORI/eslint-plugin-vue/lib/rules/no-ref-object-reactivity-loss.js ALT/eslint-plugin-vue/lib/rules/no-ref-object-reactivity-loss.js
index 8f61804..4ccbed6 100644
--- ORI/eslint-plugin-vue/lib/rules/no-ref-object-reactivity-loss.js
+++ ALT/eslint-plugin-vue/lib/rules/no-ref-object-reactivity-loss.js
@@ -33,8 +33,10 @@ function isUpdate(node) {
if (
(parent.type === 'Property' && parent.value === node) ||
parent.type === 'ArrayPattern' ||
- (parent.type === 'ObjectPattern' &&
- parent.properties.includes(/** @type {any} */ (node))) ||
+ (
+ parent.type === 'ObjectPattern' &&
+ parent.properties.includes(/** @type {any} */ (node))
+ ) ||
(parent.type === 'AssignmentPattern' && parent.left === node) ||
parent.type === 'RestElement' ||
(parent.type === 'MemberExpression' && parent.object === node)
diff --git ORI/eslint-plugin-vue/lib/rules/no-reserved-component-names.js ALT/eslint-plugin-vue/lib/rules/no-reserved-component-names.js
index 90e5360..5fd8c84 100644
--- ORI/eslint-plugin-vue/lib/rules/no-reserved-component-names.js
+++ ALT/eslint-plugin-vue/lib/rules/no-reserved-component-names.js
@@ -54,9 +54,11 @@ const RESERVED_NAMES_IN_OTHERS = new Set([
function canVerify(node) {
return (
node.type === 'Literal' ||
- (node.type === 'TemplateLiteral' &&
+ (
+ node.type === 'TemplateLiteral' &&
node.expressions.length === 0 &&
- node.quasis.length === 1)
+ node.quasis.length === 1
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-setup-props-reactivity-loss.js ALT/eslint-plugin-vue/lib/rules/no-setup-props-reactivity-loss.js
index b8e8960..86994ff 100644
--- ORI/eslint-plugin-vue/lib/rules/no-setup-props-reactivity-loss.js
+++ ALT/eslint-plugin-vue/lib/rules/no-setup-props-reactivity-loss.js
@@ -94,9 +94,11 @@ module.exports = {
}
if (
rightId.type === 'ConditionalExpression' &&
- (isPropsMemberAccessed(rightId.test, propsReferences) ||
+ (
+ isPropsMemberAccessed(rightId.test, propsReferences) ||
isPropsMemberAccessed(rightId.consequent, propsReferences) ||
- isPropsMemberAccessed(rightId.alternate, propsReferences))
+ isPropsMemberAccessed(rightId.alternate, propsReferences)
+ )
) {
report(right, 'getProperty', propsReferences.scopeName)
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js ALT/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
index 36b0e87..5ae9a23 100644
--- ORI/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
+++ ALT/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
@@ -98,8 +98,10 @@ module.exports = {
const isVueSet =
mem.parent.type === 'CallExpression' &&
mem.property.type === 'Identifier' &&
- ((isThis && mem.property.name === '$set') ||
- (isVue && mem.property.name === 'set'))
+ (
+ (isThis && mem.property.name === '$set') ||
+ (isVue && mem.property.name === 'set')
+ )
const invalid = isVueSet
? { node: mem.property }
diff --git ORI/eslint-plugin-vue/lib/rules/no-undef-components.js ALT/eslint-plugin-vue/lib/rules/no-undef-components.js
index 9eb74ad..500ad00 100644
--- ORI/eslint-plugin-vue/lib/rules/no-undef-components.js
+++ ALT/eslint-plugin-vue/lib/rules/no-undef-components.js
@@ -215,7 +215,8 @@ module.exports = {
// Check for type definitions. e.g. type Foo = {}
(variable.isTypeVariable && !variable.isValueVariable) ||
// type-only import seems to have isValueVariable set to true. So we need to check the actual Node.
- (variable.defs.length > 0 &&
+ (
+ variable.defs.length > 0 &&
variable.defs.every((def) => {
if (def.type !== 'ImportBinding') {
return false
@@ -232,7 +233,8 @@ module.exports = {
return true
}
return false
- }))
+ })
+ )
) {
scriptTypeOnlyNames.add(variable.name)
} else {
diff --git ORI/eslint-plugin-vue/lib/rules/no-undef-properties.js ALT/eslint-plugin-vue/lib/rules/no-undef-properties.js
index 06eda24..f6ba098 100644
--- ORI/eslint-plugin-vue/lib/rules/no-undef-properties.js
+++ ALT/eslint-plugin-vue/lib/rules/no-undef-properties.js
@@ -347,8 +347,10 @@ module.exports = {
])
)) {
const propertyMap =
- (prop.groupName === GROUP_DATA ||
- prop.groupName === GROUP_ASYNC_DATA) &&
+ (
+ prop.groupName === GROUP_DATA ||
+ prop.groupName === GROUP_ASYNC_DATA
+ ) &&
prop.type === 'object' &&
prop.property.value.type === 'ObjectExpression'
? getObjectPropertyMap(prop.property.value)
diff --git ORI/eslint-plugin-vue/lib/rules/no-unused-components.js ALT/eslint-plugin-vue/lib/rules/no-unused-components.js
index 75b08fa..4f5b7a4 100644
--- ORI/eslint-plugin-vue/lib/rules/no-unused-components.js
+++ ALT/eslint-plugin-vue/lib/rules/no-unused-components.js
@@ -111,8 +111,10 @@ module.exports = {
[...usedComponents].some(
(n) =>
!n.includes('_') &&
- (name === casing.pascalCase(n) ||
- name === casing.camelCase(n))
+ (
+ name === casing.pascalCase(n) ||
+ name === casing.camelCase(n)
+ )
)
) {
continue
diff --git ORI/eslint-plugin-vue/lib/rules/no-unused-properties.js ALT/eslint-plugin-vue/lib/rules/no-unused-properties.js
index b15cf5a..908adfe 100644
--- ORI/eslint-plugin-vue/lib/rules/no-unused-properties.js
+++ ALT/eslint-plugin-vue/lib/rules/no-unused-properties.js
@@ -334,8 +334,10 @@ module.exports = {
for (const property of container.properties) {
if (
- (property.groupName === 'props' &&
- propertyReferencesForProps.hasProperty(property.name)) ||
+ (
+ property.groupName === 'props' &&
+ propertyReferencesForProps.hasProperty(property.name)
+ ) ||
propertyReferences.hasProperty('$props')
) {
// used props
@@ -359,8 +361,10 @@ module.exports = {
// used
if (
deepData &&
- (property.groupName === 'data' ||
- property.groupName === 'asyncData') &&
+ (
+ property.groupName === 'data' ||
+ property.groupName === 'asyncData'
+ ) &&
property.type === 'object'
) {
// Check the deep properties of the data option.
@@ -535,8 +539,10 @@ module.exports = {
for (const element of arg.elements) {
if (
!element ||
- (element.type !== 'Literal' &&
- element.type !== 'TemplateLiteral')
+ (
+ element.type !== 'Literal' &&
+ element.type !== 'TemplateLiteral'
+ )
) {
continue
}
diff --git ORI/eslint-plugin-vue/lib/rules/order-in-components.js ALT/eslint-plugin-vue/lib/rules/order-in-components.js
index 38624d0..a934fcc 100644
--- ORI/eslint-plugin-vue/lib/rules/order-in-components.js
+++ ALT/eslint-plugin-vue/lib/rules/order-in-components.js
@@ -180,12 +180,18 @@ function isNotSideEffectsNode(node, visitorKeys) {
node.type !== 'Property' &&
node.type !== 'ObjectExpression' &&
node.type !== 'ArrayExpression' &&
- (node.type !== 'UnaryExpression' ||
- !['!', '~', '+', '-', 'typeof'].includes(node.operator)) &&
- (node.type !== 'BinaryExpression' ||
- !ALL_BINARY_OPERATORS.has(node.operator)) &&
- (node.type !== 'LogicalExpression' ||
- !LOGICAL_OPERATORS.has(node.operator)) &&
+ (
+ node.type !== 'UnaryExpression' ||
+ !['!', '~', '+', '-', 'typeof'].includes(node.operator)
+ ) &&
+ (
+ node.type !== 'BinaryExpression' ||
+ !ALL_BINARY_OPERATORS.has(node.operator)
+ ) &&
+ (
+ node.type !== 'LogicalExpression' ||
+ !LOGICAL_OPERATORS.has(node.operator)
+ ) &&
node.type !== 'MemberExpression' &&
node.type !== 'ConditionalExpression' &&
// es2015
diff --git ORI/eslint-plugin-vue/lib/rules/prefer-separate-static-class.js ALT/eslint-plugin-vue/lib/rules/prefer-separate-static-class.js
index f01de12..b468736 100644
--- ORI/eslint-plugin-vue/lib/rules/prefer-separate-static-class.js
+++ ALT/eslint-plugin-vue/lib/rules/prefer-separate-static-class.js
@@ -34,8 +34,10 @@ function findStaticClasses(expressionNode) {
property.type === 'Property' &&
property.value.type === 'Literal' &&
property.value.value === true &&
- (isStringLiteral(property.key) ||
- (property.key.type === 'Identifier' && !property.computed))
+ (
+ isStringLiteral(property.key) ||
+ (property.key.type === 'Identifier' && !property.computed)
+ )
) {
return [property.key]
}
@@ -77,8 +79,10 @@ function* removeNodeWithComma(fixer, tokenStore, node) {
if (
nextToken.type === 'Punctuator' &&
nextToken.value === ',' &&
- (nextNextToken.type !== 'Punctuator' ||
- (nextNextToken.value !== ']' && nextNextToken.value !== '}'))
+ (
+ nextNextToken.type !== 'Punctuator' ||
+ (nextNextToken.value !== ']' && nextNextToken.value !== '}')
+ )
) {
yield fixer.removeRange([node.range[0], nextNextToken.range[0]])
return
diff --git ORI/eslint-plugin-vue/lib/rules/require-default-prop.js ALT/eslint-plugin-vue/lib/rules/require-default-prop.js
index 313574a..82bce2b 100644
--- ORI/eslint-plugin-vue/lib/rules/require-default-prop.js
+++ ALT/eslint-plugin-vue/lib/rules/require-default-prop.js
@@ -124,14 +124,16 @@ module.exports = {
return (
isValueNodeOfBooleanType(value) ||
- (value.type === 'ObjectExpression' &&
+ (
+ value.type === 'ObjectExpression' &&
value.properties.some(
(p) =>
p.type === 'Property' &&
p.key.type === 'Identifier' &&
p.key.name === 'type' &&
isValueNodeOfBooleanType(p.value)
- ))
+ )
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/require-direct-export.js ALT/eslint-plugin-vue/lib/rules/require-direct-export.js
index 1c91bd4..71712e3 100644
--- ORI/eslint-plugin-vue/lib/rules/require-direct-export.js
+++ ALT/eslint-plugin-vue/lib/rules/require-direct-export.js
@@ -63,13 +63,19 @@ module.exports = {
if (
firstArg &&
firstArg.type === 'ObjectExpression' &&
- ((callee.type === 'Identifier' &&
- callee.name === 'defineComponent') ||
- (callee.type === 'MemberExpression' &&
+ (
+ (
+ callee.type === 'Identifier' &&
+ callee.name === 'defineComponent'
+ ) ||
+ (
+ callee.type === 'MemberExpression' &&
callee.object.type === 'Identifier' &&
callee.object.name === 'Vue' &&
callee.property.type === 'Identifier' &&
- callee.property.name === 'extend'))
+ callee.property.name === 'extend'
+ )
+ )
) {
return
}
diff --git ORI/eslint-plugin-vue/lib/rules/require-explicit-emits.js ALT/eslint-plugin-vue/lib/rules/require-explicit-emits.js
index ba5c406..15cf1f1 100644
--- ORI/eslint-plugin-vue/lib/rules/require-explicit-emits.js
+++ ALT/eslint-plugin-vue/lib/rules/require-explicit-emits.js
@@ -271,11 +271,10 @@ module.exports = {
// e.g. $emit() / emit() in template
if (
callee.type === 'Identifier' &&
- (callee.name === '$emit' ||
- isEmitVariableName(
- callee.name,
- vueTemplateDefineData.defineEmits
- ))
+ (
+ callee.name === '$emit' ||
+ isEmitVariableName(callee.name, vueTemplateDefineData.defineEmits)
+ )
) {
verifyEmit(
vueTemplateDefineData.emits,
@@ -424,9 +423,13 @@ module.exports = {
onVueObjectExit(node, { type }) {
const emits = vueEmitsDeclarations.get(node)
if (
- (!vueTemplateDefineData ||
- (vueTemplateDefineData.type !== 'export' &&
- vueTemplateDefineData.type !== 'setup')) &&
+ (
+ !vueTemplateDefineData ||
+ (
+ vueTemplateDefineData.type !== 'export' &&
+ vueTemplateDefineData.type !== 'setup'
+ )
+ ) &&
emits &&
(type === 'mark' || type === 'export' || type === 'definition')
) {
diff --git ORI/eslint-plugin-vue/lib/rules/require-prop-types.js ALT/eslint-plugin-vue/lib/rules/require-prop-types.js
index af2a956..4102ad0 100644
--- ORI/eslint-plugin-vue/lib/rules/require-prop-types.js
+++ ALT/eslint-plugin-vue/lib/rules/require-prop-types.js
@@ -75,7 +75,7 @@ module.exports = {
return
}
const hasType =
- prop.type === 'array' ? false : (optionHasType(prop.value) ?? true)
+ prop.type === 'array' ? false : optionHasType(prop.value) ?? true
if (!hasType) {
const { node, propName } = prop
diff --git ORI/eslint-plugin-vue/lib/rules/require-valid-default-prop.js ALT/eslint-plugin-vue/lib/rules/require-valid-default-prop.js
index ddae351..68cb5e2 100644
--- ORI/eslint-plugin-vue/lib/rules/require-valid-default-prop.js
+++ ALT/eslint-plugin-vue/lib/rules/require-valid-default-prop.js
@@ -408,8 +408,10 @@ module.exports = {
Boolean(
prop.type === 'type' ||
prop.type === 'infer-type' ||
- (prop.type === 'object' &&
- prop.value.type === 'ObjectExpression')
+ (
+ prop.type === 'object' &&
+ prop.value.type === 'ObjectExpression'
+ )
)
)
const defaults = utils.getWithDefaultsPropExpressions(node)
diff --git ORI/eslint-plugin-vue/lib/rules/script-setup-uses-vars.js ALT/eslint-plugin-vue/lib/rules/script-setup-uses-vars.js
index 703d0cb..10bc647 100644
--- ORI/eslint-plugin-vue/lib/rules/script-setup-uses-vars.js
+++ ALT/eslint-plugin-vue/lib/rules/script-setup-uses-vars.js
@@ -95,9 +95,13 @@ module.exports = {
VElement(node) {
if (
(!utils.isHtmlElementNode(node) && !utils.isSvgElementNode(node)) ||
- (node.rawName === node.name &&
- (utils.isHtmlWellKnownElementName(node.rawName) ||
- utils.isSvgWellKnownElementName(node.rawName))) ||
+ (
+ node.rawName === node.name &&
+ (
+ utils.isHtmlWellKnownElementName(node.rawName) ||
+ utils.isSvgWellKnownElementName(node.rawName)
+ )
+ ) ||
utils.isBuiltInComponentName(node.rawName)
) {
return
diff --git ORI/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js ALT/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js
index 61891df..6499c92 100644
--- ORI/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js
+++ ALT/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js
@@ -76,8 +76,10 @@ module.exports = {
(attr) =>
attr.directive === true &&
attr.key.name &&
- (attr.key.name.name === 'slot-scope' ||
- attr.key.name.name === 'scope')
+ (
+ attr.key.name.name === 'slot-scope' ||
+ attr.key.name.name === 'scope'
+ )
)
let nameArgument = ''
if (slotName) {
diff --git ORI/eslint-plugin-vue/lib/rules/v-if-else-key.js ALT/eslint-plugin-vue/lib/rules/v-if-else-key.js
index 75add9c..f43bc7c 100644
--- ORI/eslint-plugin-vue/lib/rules/v-if-else-key.js
+++ ALT/eslint-plugin-vue/lib/rules/v-if-else-key.js
@@ -49,10 +49,12 @@ const checkForKey = (
if (
conditionalFamily &&
- (utils.hasDirective(node, 'bind', 'key') ||
+ (
+ utils.hasDirective(node, 'bind', 'key') ||
utils.hasAttribute(node, 'key') ||
!hasConditionalDirective(node) ||
- !(conditionalFamily.else || conditionalFamily.elseIf.length > 0))
+ !(conditionalFamily.else || conditionalFamily.elseIf.length > 0)
+ )
) {
return
}
diff --git ORI/eslint-plugin-vue/lib/rules/v-on-function-call.js ALT/eslint-plugin-vue/lib/rules/v-on-function-call.js
index efd5b6f..9a45b69 100644
--- ORI/eslint-plugin-vue/lib/rules/v-on-function-call.js
+++ ALT/eslint-plugin-vue/lib/rules/v-on-function-call.js
@@ -191,8 +191,10 @@ module.exports = {
}
const value = method.property.value
if (
- (value.type === 'FunctionExpression' ||
- value.type === 'ArrowFunctionExpression') &&
+ (
+ value.type === 'FunctionExpression' ||
+ value.type === 'ArrowFunctionExpression'
+ ) &&
value.params.length > 0
) {
useArgsMethods.add(method.name)
diff --git ORI/eslint-plugin-vue/lib/rules/valid-v-model.js ALT/eslint-plugin-vue/lib/rules/valid-v-model.js
index ca2830d..3077d99 100644
--- ORI/eslint-plugin-vue/lib/rules/valid-v-model.js
+++ ALT/eslint-plugin-vue/lib/rules/valid-v-model.js
@@ -20,11 +20,13 @@ function isValidElement(node) {
name === 'input' ||
name === 'select' ||
name === 'textarea' ||
- (name !== 'keep-alive' &&
+ (
+ name !== 'keep-alive' &&
name !== 'slot' &&
name !== 'transition' &&
name !== 'transition-group' &&
- utils.isCustomComponent(node))
+ utils.isCustomComponent(node)
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/rules/valid-v-slot.js ALT/eslint-plugin-vue/lib/rules/valid-v-slot.js
index d5c0efd..04aae9d 100644
--- ORI/eslint-plugin-vue/lib/rules/valid-v-slot.js
+++ ALT/eslint-plugin-vue/lib/rules/valid-v-slot.js
@@ -288,8 +288,10 @@ module.exports = {
"VAttribute[directive=true][key.name.name='slot']"(node) {
const isDefaultSlot =
node.key.argument == null ||
- (node.key.argument.type === 'VIdentifier' &&
- node.key.argument.name === 'default')
+ (
+ node.key.argument.type === 'VIdentifier' &&
+ node.key.argument.name === 'default'
+ )
const element = node.parent.parent
const parentElement = element.parent
const ownerElement =
@@ -387,9 +389,11 @@ module.exports = {
if (
ownerElement === element &&
isDefaultSlot &&
- (!node.value ||
+ (
+ !node.value ||
utils.isEmptyValueDirective(node, context) ||
- utils.isEmptyExpressionValueDirective(node, context))
+ utils.isEmptyExpressionValueDirective(node, context)
+ )
) {
context.report({
node,
diff --git ORI/eslint-plugin-vue/lib/utils/indent-common.js ALT/eslint-plugin-vue/lib/utils/indent-common.js
index bacf43e..6c47a2f 100644
--- ORI/eslint-plugin-vue/lib/utils/indent-common.js
+++ ALT/eslint-plugin-vue/lib/utils/indent-common.js
@@ -169,10 +169,14 @@ function isBeginningOfLine(node, index, nodes) {
function isClosingToken(token) {
return (
token != null &&
- (token.type === 'HTMLEndTagOpen' ||
+ (
+ token.type === 'HTMLEndTagOpen' ||
token.type === 'VExpressionEnd' ||
- (token.type === 'Punctuator' &&
- (token.value === ')' || token.value === '}' || token.value === ']')))
+ (
+ token.type === 'Punctuator' &&
+ (token.value === ')' || token.value === '}' || token.value === ']')
+ )
+ )
)
}
@@ -298,11 +302,13 @@ module.exports.defineVisitor = function create(
includeComments: true,
filter: (token) =>
token != null &&
- (token.type === 'HTMLText' ||
+ (
+ token.type === 'HTMLText' ||
token.type === 'HTMLRCDataText' ||
token.type === 'HTMLTagOpen' ||
token.type === 'HTMLEndTagOpen' ||
- token.type === 'HTMLComment')
+ token.type === 'HTMLComment'
+ )
}
const contentTokens = endToken
? tokenStore.getTokensBetween(node.startTag, endToken, cursorOptions)
@@ -763,8 +769,10 @@ module.exports.defineVisitor = function create(
if (
actualIndent !== expectedIndent &&
- (optionalExpectedIndents == null ||
- !optionalExpectedIndents.includes(actualIndent))
+ (
+ optionalExpectedIndents == null ||
+ !optionalExpectedIndents.includes(actualIndent)
+ )
) {
context.report({
loc: {
@@ -1154,11 +1162,17 @@ module.exports.defineVisitor = function create(
/** @param {BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement} node */
'BreakStatement, ContinueStatement, ReturnStatement, ThrowStatement'(node) {
if (
- ((node.type === 'ReturnStatement' || node.type === 'ThrowStatement') &&
- node.argument != null) ||
- ((node.type === 'BreakStatement' ||
- node.type === 'ContinueStatement') &&
- node.label != null)
+ (
+ (node.type === 'ReturnStatement' || node.type === 'ThrowStatement') &&
+ node.argument != null
+ ) ||
+ (
+ (
+ node.type === 'BreakStatement' ||
+ node.type === 'ContinueStatement'
+ ) &&
+ node.label != null
+ )
) {
const firstToken = tokenStore.getFirstToken(node)
const nextToken = tokenStore.getTokenAfter(firstToken)
@@ -1411,9 +1425,11 @@ module.exports.defineVisitor = function create(
'ForInStatement, ForOfStatement'(node) {
const forToken = tokenStore.getFirstToken(node)
const awaitToken =
- (node.type === 'ForOfStatement' &&
+ (
+ node.type === 'ForOfStatement' &&
node.await &&
- tokenStore.getTokenAfter(forToken)) ||
+ tokenStore.getTokenAfter(forToken)
+ ) ||
null
const leftParenToken = tokenStore.getTokenAfter(awaitToken || forToken)
const leftToken = tokenStore.getTokenAfter(leftParenToken)
diff --git ORI/eslint-plugin-vue/lib/utils/indent-ts.js ALT/eslint-plugin-vue/lib/utils/indent-ts.js
index f021e8a..0b7ba20 100644
--- ORI/eslint-plugin-vue/lib/utils/indent-ts.js
+++ ALT/eslint-plugin-vue/lib/utils/indent-ts.js
@@ -1323,8 +1323,10 @@ function defineVisitor({
} else {
const startParentToken = tokenStore.getFirstToken(
parent.parent &&
- (parent.parent.type === 'ExportDefaultDeclaration' ||
- parent.parent.type === 'ExportNamedDeclaration') &&
+ (
+ parent.parent.type === 'ExportDefaultDeclaration' ||
+ parent.parent.type === 'ExportNamedDeclaration'
+ ) &&
node.range[0] < parent.parent.range[0]
? parent.parent
: parent
diff --git ORI/eslint-plugin-vue/lib/utils/indent-utils.js ALT/eslint-plugin-vue/lib/utils/indent-utils.js
index 5e40ba9..c3b62b8 100644
--- ORI/eslint-plugin-vue/lib/utils/indent-utils.js
+++ ALT/eslint-plugin-vue/lib/utils/indent-utils.js
@@ -48,12 +48,16 @@ function isNotWhitespace(token) {
function isComment(token) {
return (
token != null &&
- (token.type === 'Block' ||
+ (
+ token.type === 'Block' ||
token.type === 'Line' ||
token.type === 'Shebang' ||
- (typeof token.type ===
- 'string' /* Although acorn supports new tokens, espree may not yet support new tokens.*/ &&
- token.type.endsWith('Comment')))
+ (
+ typeof token.type ===
+ 'string' /* Although acorn supports new tokens, espree may not yet support new tokens.*/ &&
+ token.type.endsWith('Comment')
+ )
+ )
)
}
diff --git ORI/eslint-plugin-vue/lib/utils/index.js ALT/eslint-plugin-vue/lib/utils/index.js
index f16bcef..8db5d96 100644
--- ORI/eslint-plugin-vue/lib/utils/index.js
+++ ALT/eslint-plugin-vue/lib/utils/index.js
@@ -944,10 +944,14 @@ module.exports = {
*/
isCustomComponent(node) {
return (
- (this.isHtmlElementNode(node) &&
- !this.isHtmlWellKnownElementName(node.rawName)) ||
- (this.isSvgElementNode(node) &&
- !this.isSvgWellKnownElementName(node.rawName)) ||
+ (
+ this.isHtmlElementNode(node) &&
+ !this.isHtmlWellKnownElementName(node.rawName)
+ ) ||
+ (
+ this.isSvgElementNode(node) &&
+ !this.isSvgWellKnownElementName(node.rawName)
+ ) ||
hasAttribute(node, 'is') ||
hasDirective(node, 'bind', 'is') ||
hasDirective(node, 'is')
@@ -2724,9 +2728,11 @@ function getVueComponentDefinitionType(node) {
propName && isObjectArgument(parent)
return maybeFullVueComponentForVue2 &&
- (propName === 'component' ||
+ (
+ propName === 'component' ||
propName === 'mixin' ||
- propName === 'extend')
+ propName === 'extend'
+ )
? propName
: null
}
@@ -2906,11 +2912,13 @@ function isSFCObject(context, node) {
const { callee } = parent
if (
(callee.type === 'Identifier' && callee.name === 'defineComponent') ||
- (callee.type === 'MemberExpression' &&
+ (
+ callee.type === 'MemberExpression' &&
callee.object.type === 'Identifier' &&
callee.object.name === 'Vue' &&
callee.property.type === 'Identifier' &&
- callee.property.name === 'extend')
+ callee.property.name === 'extend'
+ )
) {
return isSFC(parent)
}
@@ -2993,8 +3001,10 @@ function getAttribute(node, name, value) {
(node) =>
!node.directive &&
node.key.name === name &&
- (value === undefined ||
- (node.value != null && node.value.value === value))
+ (
+ value === undefined ||
+ (node.value != null && node.value.value === value)
+ )
) || null
)
}
@@ -3033,10 +3043,12 @@ function getDirective(node, name, argument) {
(node) =>
node.directive &&
node.key.name.name === name &&
- (argument === undefined ||
+ (
+ argument === undefined ||
(node.key.argument &&
node.key.argument.type === 'VIdentifier' &&
- node.key.argument.name) === argument)
+ node.key.argument.name) === argument
+ )
) || null
)
}
diff --git ORI/eslint-plugin-vue/lib/utils/ref-object-references.js ALT/eslint-plugin-vue/lib/utils/ref-object-references.js
index fe6f261..46e9dc1 100644
--- ORI/eslint-plugin-vue/lib/utils/ref-object-references.js
+++ ALT/eslint-plugin-vue/lib/utils/ref-object-references.js
@@ -659,8 +659,10 @@ class ReactiveVariableReferenceExtractor {
}
if (
(parent.type === 'Property' && parent.value === target) ||
- (parent.type === 'ObjectExpression' &&
- parent.properties.includes(/** @type {any} */ (target))) ||
+ (
+ parent.type === 'ObjectExpression' &&
+ parent.properties.includes(/** @type {any} */ (target))
+ ) ||
parent.type === 'ArrayExpression' ||
parent.type === 'SpreadElement'
) {
diff --git ORI/eslint-plugin-vue/lib/utils/ts-utils/ts-types.js ALT/eslint-plugin-vue/lib/utils/ts-utils/ts-types.js
index abb3038..dbb52dd 100644
--- ORI/eslint-plugin-vue/lib/utils/ts-utils/ts-types.js
+++ ALT/eslint-plugin-vue/lib/utils/ts-utils/ts-types.js
@@ -51,9 +51,11 @@ function getTSParserServices(context) {
const hasFullTypeInformation =
sourceCode.parserServices.hasFullTypeInformation !== false
const checker =
- (hasFullTypeInformation &&
+ (
+ hasFullTypeInformation &&
sourceCode.parserServices.program &&
- sourceCode.parserServices.program.getTypeChecker()) ||
+ sourceCode.parserServices.program.getTypeChecker()
+ ) ||
null
if (!checker) return null
const ts = getTypeScript()
@@ -189,10 +191,12 @@ function inferRuntimeTypeInternal(type, services) {
types.add('Function')
} else if (
isArrayLikeObject(targetType) ||
- (targetType.isClassOrInterface() &&
+ (
+ targetType.isClassOrInterface() &&
['Array', 'ReadonlyArray'].includes(
checker.getFullyQualifiedName(targetType.symbol)
- ))
+ )
+ )
) {
types.add('Array')
} else if (isObject(targetType)) {
diff --git ORI/eslint-plugin-vue/tools/update-vue3-export-names.js ALT/eslint-plugin-vue/tools/update-vue3-export-names.js
index e86d77c..b102d9c 100644
--- ORI/eslint-plugin-vue/tools/update-vue3-export-names.js
+++ ALT/eslint-plugin-vue/tools/update-vue3-export-names.js
@@ -135,9 +135,11 @@ async function resolveTypeContents(m) {
const packageJson = JSON.parse(packageJsonText)
let typesPath =
- (packageJson.exports &&
+ (
+ packageJson.exports &&
packageJson.exports['.'] &&
- packageJson.exports['.'].types) ||
+ packageJson.exports['.'].types
+ ) ||
packageJson.types
if (typesPath.startsWith('./')) {
typesPath = typesPath.slice(2) |
prettier/prettier#11103 VS prettier/prettier@main :: excalidraw/excalidraw@275f6fb Diff (1334 lines)diff --git ORI/excalidraw/excalidraw-app/collab/Collab.tsx ALT/excalidraw/excalidraw-app/collab/Collab.tsx
index 273c10c..d5155c4 100644
--- ORI/excalidraw/excalidraw-app/collab/Collab.tsx
+++ ALT/excalidraw/excalidraw-app/collab/Collab.tsx
@@ -262,8 +262,10 @@ class Collab extends PureComponent<CollabProps, CollabState> {
if (
this.isCollaborating() &&
- (this.fileManager.shouldPreventUnload(syncableElements) ||
- !isSavedToFirebase(this.portal, syncableElements))
+ (
+ this.fileManager.shouldPreventUnload(syncableElements) ||
+ !isSavedToFirebase(this.portal, syncableElements)
+ )
) {
// this won't run in time if user decides to leave the site, but
// the purpose is to run in immediately after user decides to stay
diff --git ORI/excalidraw/excalidraw-app/collab/Portal.tsx ALT/excalidraw/excalidraw-app/collab/Portal.tsx
index 3561009..b0ccf20 100644
--- ORI/excalidraw/excalidraw-app/collab/Portal.tsx
+++ ALT/excalidraw/excalidraw-app/collab/Portal.tsx
@@ -146,9 +146,11 @@ class Portal {
// due to a dropped message (server goes down etc).
const syncableElements = elements.reduce((acc, element) => {
if (
- (syncAll ||
+ (
+ syncAll ||
!this.broadcastedElementVersions.has(element.id) ||
- element.version > this.broadcastedElementVersions.get(element.id)!) &&
+ element.version > this.broadcastedElementVersions.get(element.id)!
+ ) &&
isSyncableElement(element)
) {
acc.push(element);
diff --git ORI/excalidraw/excalidraw-app/data/LocalData.ts ALT/excalidraw/excalidraw-app/data/LocalData.ts
index 9d19e07..06f2660 100644
--- ORI/excalidraw/excalidraw-app/data/LocalData.ts
+++ ALT/excalidraw/excalidraw-app/data/LocalData.ts
@@ -50,8 +50,10 @@ class LocalFileManager extends FileManager {
// the image was used (loaded on canvas), not when it was initially
// created.
if (
- (!imageData.lastRetrieved ||
- Date.now() - imageData.lastRetrieved > 24 * 3600 * 1000) &&
+ (
+ !imageData.lastRetrieved ||
+ Date.now() - imageData.lastRetrieved > 24 * 3600 * 1000
+ ) &&
!opts.currentFileIds.includes(id as FileId)
) {
del(id, filesStore);
diff --git ORI/excalidraw/packages/excalidraw/actions/actionFinalize.tsx ALT/excalidraw/packages/excalidraw/actions/actionFinalize.tsx
index ec5ce82..8db6b57 100644
--- ORI/excalidraw/packages/excalidraw/actions/actionFinalize.tsx
+++ ALT/excalidraw/packages/excalidraw/actions/actionFinalize.tsx
@@ -136,8 +136,10 @@ export const actionFinalize = register({
}
if (
- (!appState.activeTool.locked &&
- appState.activeTool.type !== "freedraw") ||
+ (
+ !appState.activeTool.locked &&
+ appState.activeTool.type !== "freedraw"
+ ) ||
!multiPointElement
) {
resetCursor(interactiveCanvas);
@@ -163,8 +165,10 @@ export const actionFinalize = register({
...appState,
cursorButton: "up",
activeTool:
- (appState.activeTool.locked ||
- appState.activeTool.type === "freedraw") &&
+ (
+ appState.activeTool.locked ||
+ appState.activeTool.type === "freedraw"
+ ) &&
multiPointElement
? appState.activeTool
: activeTool,
@@ -195,11 +199,17 @@ export const actionFinalize = register({
};
},
keyTest: (event, appState) =>
- (event.key === KEYS.ESCAPE &&
- (appState.editingLinearElement !== null ||
- (!appState.draggingElement && appState.multiElement === null))) ||
- ((event.key === KEYS.ESCAPE || event.key === KEYS.ENTER) &&
- appState.multiElement !== null),
+ (
+ event.key === KEYS.ESCAPE &&
+ (
+ appState.editingLinearElement !== null ||
+ (!appState.draggingElement && appState.multiElement === null)
+ )
+ ) ||
+ (
+ (event.key === KEYS.ESCAPE || event.key === KEYS.ENTER) &&
+ appState.multiElement !== null
+ ),
PanelComponent: ({ appState, updateData, data }) => (
<ToolButton
type="button"
diff --git ORI/excalidraw/packages/excalidraw/actions/actionHistory.tsx ALT/excalidraw/packages/excalidraw/actions/actionHistory.tsx
index 23767bd..f1a5183 100644
--- ORI/excalidraw/packages/excalidraw/actions/actionHistory.tsx
+++ ALT/excalidraw/packages/excalidraw/actions/actionHistory.tsx
@@ -94,9 +94,11 @@ export const createRedoAction: ActionCreator = (history, store) => ({
),
),
keyTest: (event) =>
- (event[KEYS.CTRL_OR_CMD] &&
+ (
+ event[KEYS.CTRL_OR_CMD] &&
event.shiftKey &&
- event.key.toLowerCase() === KEYS.Z) ||
+ event.key.toLowerCase() === KEYS.Z
+ ) ||
(isWindows && event.ctrlKey && !event.shiftKey && event.key === KEYS.Y),
PanelComponent: ({ updateData, data }) => {
const { isRedoStackEmpty } = useEmitter(
diff --git ORI/excalidraw/packages/excalidraw/actions/actionProperties.tsx ALT/excalidraw/packages/excalidraw/actions/actionProperties.tsx
index ec94d1f..8ff2b40 100644
--- ORI/excalidraw/packages/excalidraw/actions/actionProperties.tsx
+++ ALT/excalidraw/packages/excalidraw/actions/actionProperties.tsx
@@ -230,7 +230,7 @@ const changeFontSize = (
currentItemFontSize:
newFontSizes.size === 1
? [...newFontSizes][0]
- : (fallbackValue ?? appState.currentItemFontSize),
+ : fallbackValue ?? appState.currentItemFontSize,
},
storeAction: StoreAction.CAPTURE,
};
diff --git ORI/excalidraw/packages/excalidraw/components/Actions.tsx ALT/excalidraw/packages/excalidraw/components/Actions.tsx
index dd224e1..4cc6e90 100644
--- ORI/excalidraw/packages/excalidraw/components/Actions.tsx
+++ ALT/excalidraw/packages/excalidraw/components/Actions.tsx
@@ -61,11 +61,13 @@ export const canChangeStrokeColor = (
}
return (
- (hasStrokeColor(appState.activeTool.type) &&
+ (
+ hasStrokeColor(appState.activeTool.type) &&
appState.activeTool.type !== "image" &&
commonSelectedType !== "image" &&
commonSelectedType !== "frame" &&
- commonSelectedType !== "magicframe") ||
+ commonSelectedType !== "magicframe"
+ ) ||
targetElements.some((element) => hasStrokeColor(element.type))
);
};
@@ -94,8 +96,10 @@ export const SelectedShapeActions = ({
let isSingleElementBoundContainer = false;
if (
targetElements.length === 2 &&
- (hasBoundTextElement(targetElements[0]) ||
- hasBoundTextElement(targetElements[1]))
+ (
+ hasBoundTextElement(targetElements[0]) ||
+ hasBoundTextElement(targetElements[1])
+ )
) {
isSingleElementBoundContainer = true;
}
@@ -104,8 +108,10 @@ export const SelectedShapeActions = ({
const isRTL = document.documentElement.getAttribute("dir") === "rtl";
const showFillIcons =
- (hasBackground(appState.activeTool.type) &&
- !isTransparent(appState.currentItemBackgroundColor)) ||
+ (
+ hasBackground(appState.activeTool.type) &&
+ !isTransparent(appState.currentItemBackgroundColor)
+ ) ||
targetElements.some(
(element) =>
hasBackground(element.type) && !isTransparent(element.backgroundColor),
@@ -125,46 +131,56 @@ export const SelectedShapeActions = ({
)}
{showFillIcons && renderAction("changeFillStyle")}
- {(hasStrokeWidth(appState.activeTool.type) ||
- targetElements.some((element) => hasStrokeWidth(element.type))) &&
+ {(
+ hasStrokeWidth(appState.activeTool.type) ||
+ targetElements.some((element) => hasStrokeWidth(element.type))
+ ) &&
renderAction("changeStrokeWidth")}
- {(appState.activeTool.type === "freedraw" ||
- targetElements.some((element) => element.type === "freedraw")) &&
+ {(
+ appState.activeTool.type === "freedraw" ||
+ targetElements.some((element) => element.type === "freedraw")
+ ) &&
renderAction("changeStrokeShape")}
- {(hasStrokeStyle(appState.activeTool.type) ||
- targetElements.some((element) => hasStrokeStyle(element.type))) && (
+ {(
+ hasStrokeStyle(appState.activeTool.type) ||
+ targetElements.some((element) => hasStrokeStyle(element.type))
+ ) && (
<>
{renderAction("changeStrokeStyle")}
{renderAction("changeSloppiness")}
</>
)}
- {(canChangeRoundness(appState.activeTool.type) ||
- targetElements.some((element) => canChangeRoundness(element.type))) && (
- <>{renderAction("changeRoundness")}</>
- )}
+ {(
+ canChangeRoundness(appState.activeTool.type) ||
+ targetElements.some((element) => canChangeRoundness(element.type))
+ ) && <>{renderAction("changeRoundness")}</>}
- {(appState.activeTool.type === "text" ||
- targetElements.some(isTextElement)) && (
+ {(
+ appState.activeTool.type === "text" ||
+ targetElements.some(isTextElement)
+ ) && (
<>
{renderAction("changeFontSize")}
{renderAction("changeFontFamily")}
- {(appState.activeTool.type === "text" ||
- suppportsHorizontalAlign(targetElements, elementsMap)) &&
+ {(
+ appState.activeTool.type === "text" ||
+ suppportsHorizontalAlign(targetElements, elementsMap)
+ ) &&
renderAction("changeTextAlign")}
</>
)}
{shouldAllowVerticalAlign(targetElements, elementsMap) &&
renderAction("changeVerticalAlign")}
- {(canHaveArrowheads(appState.activeTool.type) ||
- targetElements.some((element) => canHaveArrowheads(element.type))) && (
- <>{renderAction("changeArrowhead")}</>
- )}
+ {(
+ canHaveArrowheads(appState.activeTool.type) ||
+ targetElements.some((element) => canHaveArrowheads(element.type))
+ ) && <>{renderAction("changeArrowhead")}</>}
{renderAction("changeOpacity")}
diff --git ORI/excalidraw/packages/excalidraw/components/App.tsx ALT/excalidraw/packages/excalidraw/components/App.tsx
index ae2f1bb..812a406 100644
--- ORI/excalidraw/packages/excalidraw/components/App.tsx
+++ ALT/excalidraw/packages/excalidraw/components/App.tsx
@@ -901,9 +901,11 @@ class App extends React.Component<AppProps, AppState> {
!event.shiftKey &&
!event.metaKey &&
!event.ctrlKey &&
- (this.state.activeEmbeddable?.element !== el ||
+ (
+ this.state.activeEmbeddable?.element !== el ||
this.state.activeEmbeddable?.state === "hover" ||
- !this.state.activeEmbeddable) &&
+ !this.state.activeEmbeddable
+ ) &&
sceneX >= el.x + el.width / 3 &&
sceneX <= el.x + (2 * el.width) / 3 &&
sceneY >= el.y + el.height / 3 &&
@@ -963,8 +965,10 @@ class App extends React.Component<AppProps, AppState> {
.getNonDeletedElements()
.filter(
(el): el is Ordered<NonDeleted<ExcalidrawIframeLikeElement>> =>
- (isEmbeddableElement(el) &&
- this.embedsValidationStatus.get(el.id) === true) ||
+ (
+ isEmbeddableElement(el) &&
+ this.embedsValidationStatus.get(el.id) === true
+ ) ||
isIframeElement(el),
);
@@ -999,8 +1003,10 @@ class App extends React.Component<AppProps, AppState> {
if (isIframeElement(el)) {
src = null;
- const data: MagicCacheData = (el.customData?.generationData ??
- this.magicGenerations.get(el.id)) || {
+ const data: MagicCacheData = (
+ el.customData?.generationData ??
+ this.magicGenerations.get(el.id)
+ ) || {
status: "error",
message: "No generation data",
code: "ERR_NO_GENERATION_DATA",
@@ -1216,7 +1222,7 @@ class App extends React.Component<AppProps, AppState> {
: undefined
}
src={
- src?.type !== "document" ? (src?.link ?? "") : undefined
+ src?.type !== "document" ? src?.link ?? "" : undefined
}
// https://stackoverflow.com/q/18470015
scrolling="no"
@@ -1476,14 +1482,17 @@ class App extends React.Component<AppProps, AppState> {
!(
this.state.editingElement && isLinearElement(this.state.editingElement)
) &&
- (this.state.selectionElement ||
+ (
+ this.state.selectionElement ||
this.state.draggingElement ||
this.state.resizingElement ||
- (this.state.activeTool.type === "laser" &&
+ (
+ this.state.activeTool.type === "laser" &&
// technically we can just test on this once we make it more safe
- this.state.cursorButton === "down") ||
- (this.state.editingElement &&
- !isTextElement(this.state.editingElement)));
+ this.state.cursorButton === "down"
+ ) ||
+ (this.state.editingElement && !isTextElement(this.state.editingElement))
+ );
const firstSelectedElement = selectedElements[0];
@@ -2952,8 +2961,10 @@ class App extends React.Component<AppProps, AppState> {
);
if (
event &&
- (!(elementUnderCursor instanceof HTMLCanvasElement) ||
- isWritableElement(target))
+ (
+ !(elementUnderCursor instanceof HTMLCanvasElement) ||
+ isWritableElement(target)
+ )
) {
return;
}
@@ -3055,8 +3066,10 @@ class App extends React.Component<AppProps, AppState> {
.filter((string) => {
return (
embeddableURLValidator(string, this.props.validateEmbeddable) &&
- (/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(string) ||
- getEmbedLink(string)?.type === "video")
+ (
+ /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(string) ||
+ getEmbedLink(string)?.type === "video"
+ )
);
});
@@ -3786,8 +3799,10 @@ class App extends React.Component<AppProps, AppState> {
if (
"Proxy" in window &&
- ((!event.shiftKey && /^[A-Z]$/.test(event.key)) ||
- (event.shiftKey && /^[a-z]$/.test(event.key)))
+ (
+ (!event.shiftKey && /^[A-Z]$/.test(event.key)) ||
+ (event.shiftKey && /^[a-z]$/.test(event.key))
+ )
) {
event = new Proxy(event, {
get(ev: any, prop) {
@@ -3844,9 +3859,11 @@ class App extends React.Component<AppProps, AppState> {
// bail if
if (
// inside an input
- (isWritableElement(event.target) &&
+ (
+ isWritableElement(event.target) &&
// unless pressing escape (finalize action)
- event.key !== KEYS.ESCAPE) ||
+ event.key !== KEYS.ESCAPE
+ ) ||
// or unless using arrows (to move between buttons)
(isArrowKey(event.key) && isInputLike(event.target))
) {
@@ -3900,10 +3917,10 @@ class App extends React.Component<AppProps, AppState> {
if (isArrowKey(event.key)) {
const step =
- (this.state.gridSize &&
- (event.shiftKey
- ? ELEMENT_TRANSLATE_AMOUNT
- : this.state.gridSize)) ||
+ (
+ this.state.gridSize &&
+ (event.shiftKey ? ELEMENT_TRANSLATE_AMOUNT : this.state.gridSize)
+ ) ||
(event.shiftKey
? ELEMENT_SHIFT_TRANSLATE_AMOUNT
: ELEMENT_TRANSLATE_AMOUNT);
@@ -4033,8 +4050,10 @@ class App extends React.Component<AppProps, AppState> {
if (
event.key === KEYS.G &&
- (hasBackground(this.state.activeTool.type) ||
- selectedElements.some((element) => hasBackground(element.type)))
+ (
+ hasBackground(this.state.activeTool.type) ||
+ selectedElements.some((element) => hasBackground(element.type))
+ )
) {
this.setState({ openPopup: "elementBackground" });
event.stopPropagation();
@@ -4563,8 +4582,10 @@ class App extends React.Component<AppProps, AppState> {
.filter(
(element) =>
(includeLockedElements || !element.locked) &&
- (includeBoundTextElement ||
- !(isTextElement(element) && element.containerId)),
+ (
+ includeBoundTextElement ||
+ !(isTextElement(element) && element.containerId)
+ ),
)
)
.filter((el) => this.hitElement(x, y, el))
@@ -4851,8 +4872,10 @@ class App extends React.Component<AppProps, AppState> {
if (selectedElements.length === 1 && isLinearElement(selectedElements[0])) {
if (
event[KEYS.CTRL_OR_CMD] &&
- (!this.state.editingLinearElement ||
- this.state.editingLinearElement.elementId !== selectedElements[0].id)
+ (
+ !this.state.editingLinearElement ||
+ this.state.editingLinearElement.elementId !== selectedElements[0].id
+ )
) {
this.store.shouldCaptureIncrement();
this.setState({
@@ -5318,9 +5341,11 @@ class App extends React.Component<AppProps, AppState> {
const hasDeselectedButton = Boolean(event.buttons);
if (
hasDeselectedButton ||
- (this.state.activeTool.type !== "selection" &&
+ (
+ this.state.activeTool.type !== "selection" &&
this.state.activeTool.type !== "text" &&
- this.state.activeTool.type !== "eraser")
+ this.state.activeTool.type !== "eraser"
+ )
) {
return;
}
@@ -5441,11 +5466,13 @@ class App extends React.Component<AppProps, AppState> {
!event[KEYS.CTRL_OR_CMD]
) {
if (
- (hitElement ||
+ (
+ hitElement ||
this.isHittingCommonBoundingBoxOfSelectedElements(
scenePointer,
selectedElements,
- )) &&
+ )
+ ) &&
!hitElement?.locked
) {
if (
@@ -5560,8 +5587,10 @@ class App extends React.Component<AppProps, AppState> {
for (const element of this.scene.getNonDeletedElements()) {
if (
isBoundToContainer(element) &&
- (this.elementsPendingErasure.has(element.id) ||
- this.elementsPendingErasure.has(element.containerId))
+ (
+ this.elementsPendingErasure.has(element.id) ||
+ this.elementsPendingErasure.has(element.containerId)
+ )
) {
if (event.altKey) {
this.elementsPendingErasure.delete(element.id);
@@ -6087,10 +6116,12 @@ class App extends React.Component<AppProps, AppState> {
if (
!(
gesture.pointers.size <= 1 &&
- (event.button === POINTER_BUTTON.WHEEL ||
+ (
+ event.button === POINTER_BUTTON.WHEEL ||
(event.button === POINTER_BUTTON.MAIN && isHoldingSpace) ||
isHandToolActive(this.state) ||
- this.state.viewModeEnabled)
+ this.state.viewModeEnabled
+ )
) ||
isTextElement(this.state.editingElement)
) {
@@ -7233,8 +7264,10 @@ class App extends React.Component<AppProps, AppState> {
// triggering pointermove)
if (
!pointerDownState.drag.hasOccurred &&
- (this.state.activeTool.type === "arrow" ||
- this.state.activeTool.type === "line")
+ (
+ this.state.activeTool.type === "arrow" ||
+ this.state.activeTool.type === "line"
+ )
) {
if (
distance2d(
@@ -7363,8 +7396,10 @@ class App extends React.Component<AppProps, AppState> {
this.state.editingLinearElement.elementId ===
pointerDownState.hit.element?.id;
if (
- (hasHitASelectedElement ||
- pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements) &&
+ (
+ hasHitASelectedElement ||
+ pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements
+ ) &&
!isSelectingPointsInLineEditor
) {
const selectedElements = this.scene.getSelectedElements(this.state);
@@ -7486,8 +7521,10 @@ class App extends React.Component<AppProps, AppState> {
selectedElementIds.has(element.id) ||
// case: the state.selectedElementIds might not have been
// updated yet by the time this mousemove event is fired
- (element.id === hitElement?.id &&
- pointerDownState.hit.wasAddedToSelection)
+ (
+ element.id === hitElement?.id &&
+ pointerDownState.hit.wasAddedToSelection
+ )
) {
const duplicatedElement = duplicateElement(
this.state.editingGroupId,
@@ -7703,8 +7740,10 @@ class App extends React.Component<AppProps, AppState> {
: null,
showHyperlinkPopup:
elementsWithinSelection.length === 1 &&
- (elementsWithinSelection[0].link ||
- isEmbeddableElement(elementsWithinSelection[0]))
+ (
+ elementsWithinSelection[0].link ||
+ isEmbeddableElement(elementsWithinSelection[0])
+ )
? "info"
: false,
};
@@ -8282,8 +8321,10 @@ class App extends React.Component<AppProps, AppState> {
!pointerDownState.hit.wasAddedToSelection &&
// if we're editing a line, pointerup shouldn't switch selection if
// box selected
- (!this.state.editingLinearElement ||
- !pointerDownState.boxSelection.hasOccurred)
+ (
+ !this.state.editingLinearElement ||
+ !pointerDownState.boxSelection.hasOccurred
+ )
) {
// when inside line editor, shift selects points instead
if (childEvent.shiftKey && !this.state.editingLinearElement) {
@@ -8435,22 +8476,28 @@ class App extends React.Component<AppProps, AppState> {
// not resized
!this.state.isResizing &&
// only hitting the bounding box of the previous hit element
- ((hitElement &&
- hitElementBoundingBoxOnly(
- {
- x: pointerDownState.origin.x,
- y: pointerDownState.origin.y,
- element: hitElement,
- shape: this.getElementShape(hitElement),
- threshold: this.getElementHitThreshold(),
- frameNameBound: isFrameLikeElement(hitElement)
- ? this.frameNameBoundsCache.get(hitElement)
- : null,
- },
- elementsMap,
- )) ||
- (!hitElement &&
- pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements))
+ (
+ (
+ hitElement &&
+ hitElementBoundingBoxOnly(
+ {
+ x: pointerDownState.origin.x,
+ y: pointerDownState.origin.y,
+ element: hitElement,
+ shape: this.getElementShape(hitElement),
+ threshold: this.getElementHitThreshold(),
+ frameNameBound: isFrameLikeElement(hitElement)
+ ? this.frameNameBoundsCache.get(hitElement)
+ : null,
+ },
+ elementsMap,
+ )
+ ) ||
+ (
+ !hitElement &&
+ pointerDownState.hit.hasHitCommonBoundingBoxOfSelectedElements
+ )
+ )
) {
if (this.state.editingLinearElement) {
this.setState({ editingLinearElement: null });
@@ -8563,8 +8610,10 @@ class App extends React.Component<AppProps, AppState> {
if (
this.elementsPendingErasure.has(ele.id) ||
(ele.frameId && this.elementsPendingErasure.has(ele.frameId)) ||
- (isBoundToContainer(ele) &&
- this.elementsPendingErasure.has(ele.containerId))
+ (
+ isBoundToContainer(ele) &&
+ this.elementsPendingErasure.has(ele.containerId)
+ )
) {
didChange = true;
return newElementWith(ele, { isDeleted: true });
@@ -8892,8 +8941,10 @@ class App extends React.Component<AppProps, AppState> {
// if user-created bounding box is below threshold, assume the
// intention was to click instead of drag, and use the image's
// intrinsic size
- (imageElement.width < DRAGGING_THRESHOLD / this.state.zoom.value &&
- imageElement.height < DRAGGING_THRESHOLD / this.state.zoom.value)
+ (
+ imageElement.width < DRAGGING_THRESHOLD / this.state.zoom.value &&
+ imageElement.height < DRAGGING_THRESHOLD / this.state.zoom.value
+ )
) {
const minHeight = Math.max(this.state.height - 120, 160);
// max 65% of canvas height, clamped to <300px, vh - 120px>
@@ -9197,8 +9248,10 @@ class App extends React.Component<AppProps, AppState> {
if (
text &&
embeddableURLValidator(text, this.props.validateEmbeddable) &&
- (/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(text) ||
- getEmbedLink(text)?.type === "video")
+ (
+ /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(text) ||
+ getEmbedLink(text)?.type === "video"
+ )
) {
const embeddable = this.insertEmbeddableElement({
sceneX,
@@ -9292,12 +9345,18 @@ class App extends React.Component<AppProps, AppState> {
event.preventDefault();
if (
- (("pointerType" in event.nativeEvent &&
- event.nativeEvent.pointerType === "touch") ||
- ("pointerType" in event.nativeEvent &&
+ (
+ (
+ "pointerType" in event.nativeEvent &&
+ event.nativeEvent.pointerType === "touch"
+ ) ||
+ (
+ "pointerType" in event.nativeEvent &&
event.nativeEvent.pointerType === "pen" &&
// always allow if user uses a pen secondary button
- event.button !== POINTER_BUTTON.SECONDARY)) &&
+ event.button !== POINTER_BUTTON.SECONDARY
+ )
+ ) &&
this.state.activeTool.type !== "selection"
) {
return;
diff --git ORI/excalidraw/packages/excalidraw/components/CommandPalette/CommandPalette.tsx ALT/excalidraw/packages/excalidraw/components/CommandPalette/CommandPalette.tsx
index 1748031..b8be134 100644
--- ORI/excalidraw/packages/excalidraw/components/CommandPalette/CommandPalette.tsx
+++ ALT/excalidraw/packages/excalidraw/components/CommandPalette/CommandPalette.tsx
@@ -113,8 +113,10 @@ const isCommandPaletteToggleShortcut = (event: KeyboardEvent) => {
return (
!event.altKey &&
event[KEYS.CTRL_OR_CMD] &&
- ((event.shiftKey && event.key.toLowerCase() === KEYS.P) ||
- event.key === KEYS.SLASH)
+ (
+ (event.shiftKey && event.key.toLowerCase() === KEYS.P) ||
+ event.key === KEYS.SLASH
+ )
);
};
diff --git ORI/excalidraw/packages/excalidraw/components/ContextMenu.tsx ALT/excalidraw/packages/excalidraw/components/ContextMenu.tsx
index 23959a9..fc5328d 100644
--- ORI/excalidraw/packages/excalidraw/components/ContextMenu.tsx
+++ ALT/excalidraw/packages/excalidraw/components/ContextMenu.tsx
@@ -34,14 +34,16 @@ export const ContextMenu = React.memo(
const filteredItems = items.reduce((acc: ContextMenuItem[], item) => {
if (
item &&
- (item === CONTEXT_MENU_SEPARATOR ||
+ (
+ item === CONTEXT_MENU_SEPARATOR ||
!item.predicate ||
item.predicate(
elements,
appState,
actionManager.app.props,
actionManager.app,
- ))
+ )
+ )
) {
acc.push(item);
}
diff --git ORI/excalidraw/packages/excalidraw/components/LayerUI.tsx ALT/excalidraw/packages/excalidraw/components/LayerUI.tsx
index 995c6a0..1568ced 100644
--- ORI/excalidraw/packages/excalidraw/components/LayerUI.tsx
+++ ALT/excalidraw/packages/excalidraw/components/LayerUI.tsx
@@ -348,10 +348,10 @@ const LayerUI = ({
{renderTopRightUI?.(device.editor.isMobile, appState)}
{!appState.viewModeEnabled &&
// hide button when sidebar docked
- (!isSidebarDocked ||
- appState.openSidebar?.name !== DEFAULT_SIDEBAR.name) && (
- <tunnels.DefaultSidebarTriggerTunnel.Out />
- )}
+ (
+ !isSidebarDocked ||
+ appState.openSidebar?.name !== DEFAULT_SIDEBAR.name
+ ) && <tunnels.DefaultSidebarTriggerTunnel.Out />}
</div>
</div>
</FixedSideContainer>
diff --git ORI/excalidraw/packages/excalidraw/components/LibraryMenuItems.tsx ALT/excalidraw/packages/excalidraw/components/LibraryMenuItems.tsx
index ff88e53..075df7a 100644
--- ORI/excalidraw/packages/excalidraw/components/LibraryMenuItems.tsx
+++ ALT/excalidraw/packages/excalidraw/components/LibraryMenuItems.tsx
@@ -287,9 +287,11 @@ export default function LibraryMenuItems({
</>
<>
- {(publishedItems.length > 0 ||
+ {(
+ publishedItems.length > 0 ||
pendingElements.length > 0 ||
- unpublishedItems.length > 0) && (
+ unpublishedItems.length > 0
+ ) && (
<div className="library-menu-items-container__header library-menu-items-container__header--excal">
{t("labels.excalidrawLib")}
</div>
diff --git ORI/excalidraw/packages/excalidraw/components/Sidebar/Sidebar.tsx ALT/excalidraw/packages/excalidraw/components/Sidebar/Sidebar.tsx
index ae75f57..cd0bd22 100644
--- ORI/excalidraw/packages/excalidraw/components/Sidebar/Sidebar.tsx
+++ ALT/excalidraw/packages/excalidraw/components/Sidebar/Sidebar.tsx
@@ -161,13 +161,19 @@ export const Sidebar = Object.assign(
useEffect(() => {
if (
// closing sidebar
- ((!appState.openSidebar &&
- refPrevOpenSidebar?.current?.name === props.name) ||
+ (
+ (
+ !appState.openSidebar &&
+ refPrevOpenSidebar?.current?.name === props.name
+ ) ||
// opening current sidebar
- (appState.openSidebar?.name === props.name &&
- refPrevOpenSidebar?.current?.name !== props.name) ||
+ (
+ appState.openSidebar?.name === props.name &&
+ refPrevOpenSidebar?.current?.name !== props.name
+ ) ||
// switching tabs or switching to a different sidebar
- refPrevOpenSidebar.current?.name === props.name) &&
+ refPrevOpenSidebar.current?.name === props.name
+ ) &&
appState.openSidebar !== refPrevOpenSidebar.current
) {
onStateChange?.(
diff --git ORI/excalidraw/packages/excalidraw/components/canvases/InteractiveCanvas.tsx ALT/excalidraw/packages/excalidraw/components/canvases/InteractiveCanvas.tsx
index c8eb799..644f5a1 100644
--- ORI/excalidraw/packages/excalidraw/components/canvases/InteractiveCanvas.tsx
+++ ALT/excalidraw/packages/excalidraw/components/canvases/InteractiveCanvas.tsx
@@ -110,10 +110,12 @@ const InteractiveCanvas = (props: InteractiveCanvasProps) => {
});
const selectionColor =
- (props.containerRef?.current &&
+ (
+ props.containerRef?.current &&
getComputedStyle(props.containerRef.current).getPropertyValue(
"--color-selection",
- )) ||
+ )
+ ) ||
"#6965db";
renderInteractiveScene(
diff --git ORI/excalidraw/packages/excalidraw/components/hoc/withInternalFallback.tsx ALT/excalidraw/packages/excalidraw/components/hoc/withInternalFallback.tsx
index 4131c51..e8112dd 100644
--- ORI/excalidraw/packages/excalidraw/components/hoc/withInternalFallback.tsx
+++ ALT/excalidraw/packages/excalidraw/components/hoc/withInternalFallback.tsx
@@ -54,9 +54,11 @@ export const withInternalFallback = <P,>(
// ensure we don't render fallback and host components at the same time
if (
// either before the counters are initialized
- (!metaRef.current.counter &&
+ (
+ !metaRef.current.counter &&
props.__fallback &&
- metaRef.current.preferHost) ||
+ metaRef.current.preferHost
+ ) ||
// or after the counters are initialized, and both are rendered
// (this is the default when host renders as well)
(metaRef.current.counter > 1 && props.__fallback)
diff --git ORI/excalidraw/packages/excalidraw/data/json.ts ALT/excalidraw/packages/excalidraw/data/json.ts
index 94dddf2..7e3e4c2 100644
--- ORI/excalidraw/packages/excalidraw/data/json.ts
+++ ALT/excalidraw/packages/excalidraw/data/json.ts
@@ -116,9 +116,13 @@ export const isValidExcalidrawData = (data?: {
}): data is ImportedDataState => {
return (
data?.type === EXPORT_DATA_TYPES.excalidraw &&
- (!data.elements ||
- (Array.isArray(data.elements) &&
- (!data.appState || typeof data.appState === "object")))
+ (
+ !data.elements ||
+ (
+ Array.isArray(data.elements) &&
+ (!data.appState || typeof data.appState === "object")
+ )
+ )
);
};
diff --git ORI/excalidraw/packages/excalidraw/data/reconcile.ts ALT/excalidraw/packages/excalidraw/data/reconcile.ts
index 221dd04..3fd745a 100644
--- ORI/excalidraw/packages/excalidraw/data/reconcile.ts
+++ ALT/excalidraw/packages/excalidraw/data/reconcile.ts
@@ -18,15 +18,19 @@ const shouldDiscardRemoteElement = (
if (
local &&
// local element is being edited
- (local.id === localAppState.editingElement?.id ||
+ (
+ local.id === localAppState.editingElement?.id ||
local.id === localAppState.resizingElement?.id ||
local.id === localAppState.draggingElement?.id || // TODO: Is this still valid? As draggingElement is selection element, which is never part of the elements array
// local element is newer
local.version > remote.version ||
// resolve conflicting edits deterministically by taking the one with
// the lowest versionNonce
- (local.version === remote.version &&
- local.versionNonce < remote.versionNonce))
+ (
+ local.version === remote.version &&
+ local.versionNonce < remote.versionNonce
+ )
+ )
) {
return true;
}
diff --git ORI/excalidraw/packages/excalidraw/data/restore.ts ALT/excalidraw/packages/excalidraw/data/restore.ts
index c5e2fad..8691d22 100644
--- ORI/excalidraw/packages/excalidraw/data/restore.ts
+++ ALT/excalidraw/packages/excalidraw/data/restore.ts
@@ -153,7 +153,7 @@ const restoreElementWithProperties = <
: null,
boundElements: element.boundElementIds
? element.boundElementIds.map((id) => ({ type: "arrow", id }))
- : (element.boundElements ?? []),
+ : element.boundElements ?? [],
updated: element.updated ?? getUpdatedTimestamp(),
link: element.link ? normalizeLink(element.link) : null,
locked: element.locked ?? false,
@@ -540,7 +540,7 @@ export const restoreAppState = (
// reset on fresh restore so as to hide the UI button if penMode not active
penDetected:
localAppState?.penDetected ??
- (appState.penMode ? (appState.penDetected ?? false) : false),
+ (appState.penMode ? appState.penDetected ?? false : false),
activeTool: {
...updateActiveTool(
defaultAppState,
diff --git ORI/excalidraw/packages/excalidraw/element/binding.ts ALT/excalidraw/packages/excalidraw/element/binding.ts
index 596be86..d9a245a 100644
--- ORI/excalidraw/packages/excalidraw/element/binding.ts
+++ ALT/excalidraw/packages/excalidraw/element/binding.ts
@@ -473,8 +473,10 @@ const updateBoundPoint = (
if (
binding == null ||
// We only need to update the other end if this is a 2 point line element
- (binding.elementId !== bindableElement.id &&
- linearElement.points.length > 2)
+ (
+ binding.elementId !== bindableElement.id &&
+ linearElement.points.length > 2
+ )
) {
return;
}
diff --git ORI/excalidraw/packages/excalidraw/element/linearElementEditor.ts ALT/excalidraw/packages/excalidraw/element/linearElementEditor.ts
index 51c6b18..7e00e7e 100644
--- ORI/excalidraw/packages/excalidraw/element/linearElementEditor.ts
+++ ALT/excalidraw/packages/excalidraw/element/linearElementEditor.ts
@@ -165,10 +165,12 @@ export class LinearElementEditor {
const nextSelectedPoints = pointsSceneCoords.reduce(
(acc: number[], point, index) => {
if (
- (point[0] >= selectionX1 &&
+ (
+ point[0] >= selectionX1 &&
point[0] <= selectionX2 &&
point[1] >= selectionY1 &&
- point[1] <= selectionY2) ||
+ point[1] <= selectionY2
+ ) ||
(event.shiftKey && selectedPointsIndices?.includes(index))
) {
acc.push(index);
diff --git ORI/excalidraw/packages/excalidraw/element/mutateElement.ts ALT/excalidraw/packages/excalidraw/element/mutateElement.ts
index a44f5e7..79be16d 100644
--- ORI/excalidraw/packages/excalidraw/element/mutateElement.ts
+++ ALT/excalidraw/packages/excalidraw/element/mutateElement.ts
@@ -38,10 +38,12 @@ export const mutateElement = <TElement extends Mutable<ExcalidrawElement>>(
(element as any)[key] === value &&
// if object, always update because its attrs could have changed
// (except for specific keys we handle below)
- (typeof value !== "object" ||
+ (
+ typeof value !== "object" ||
value === null ||
key === "groupIds" ||
- key === "scale")
+ key === "scale"
+ )
) {
continue;
}
diff --git ORI/excalidraw/packages/excalidraw/element/resizeElements.ts ALT/excalidraw/packages/excalidraw/element/resizeElements.ts
index b3df073..e886b7c 100644
--- ORI/excalidraw/packages/excalidraw/element/resizeElements.ts
+++ ALT/excalidraw/packages/excalidraw/element/resizeElements.ts
@@ -86,10 +86,12 @@ export const transformElements = (
updateBoundElements(element, elementsMap);
} else if (
isTextElement(element) &&
- (transformHandleType === "nw" ||
+ (
+ transformHandleType === "nw" ||
transformHandleType === "ne" ||
transformHandleType === "sw" ||
- transformHandleType === "se")
+ transformHandleType === "se"
+ )
) {
resizeSingleTextElement(
element,
diff --git ORI/excalidraw/packages/excalidraw/element/showSelectedShapeActions.ts ALT/excalidraw/packages/excalidraw/element/showSelectedShapeActions.ts
index 1fd47f6..af6a3cd 100644
--- ORI/excalidraw/packages/excalidraw/element/showSelectedShapeActions.ts
+++ ALT/excalidraw/packages/excalidraw/element/showSelectedShapeActions.ts
@@ -8,11 +8,19 @@ export const showSelectedShapeActions = (
) =>
Boolean(
!appState.viewModeEnabled &&
- ((appState.activeTool.type !== "custom" &&
- (appState.editingElement ||
- (appState.activeTool.type !== "selection" &&
- appState.activeTool.type !== "eraser" &&
- appState.activeTool.type !== "hand" &&
- appState.activeTool.type !== "laser"))) ||
- getSelectedElements(elements, appState).length),
+ (
+ (
+ appState.activeTool.type !== "custom" &&
+ (
+ appState.editingElement ||
+ (
+ appState.activeTool.type !== "selection" &&
+ appState.activeTool.type !== "eraser" &&
+ appState.activeTool.type !== "hand" &&
+ appState.activeTool.type !== "laser"
+ )
+ )
+ ) ||
+ getSelectedElements(elements, appState).length
+ ),
);
diff --git ORI/excalidraw/packages/excalidraw/element/textElement.ts ALT/excalidraw/packages/excalidraw/element/textElement.ts
index b7b6cf6..9aeabe8 100644
--- ORI/excalidraw/packages/excalidraw/element/textElement.ts
+++ ALT/excalidraw/packages/excalidraw/element/textElement.ts
@@ -212,9 +212,11 @@ export const handleBindTextResize = (
// fix the y coord when resizing from ne/nw/n
const updatedY =
!isArrowElement(container) &&
- (transformHandleType === "ne" ||
+ (
+ transformHandleType === "ne" ||
transformHandleType === "nw" ||
- transformHandleType === "n")
+ transformHandleType === "n"
+ )
? container.y - diff
: container.y;
mutateElement(container, {
diff --git ORI/excalidraw/packages/excalidraw/element/textWysiwyg.tsx ALT/excalidraw/packages/excalidraw/element/textWysiwyg.tsx
index 7dfdbc6..27a25b8 100644
--- ORI/excalidraw/packages/excalidraw/element/textWysiwyg.tsx
+++ ALT/excalidraw/packages/excalidraw/element/textWysiwyg.tsx
@@ -368,9 +368,13 @@ export const textWysiwyg = ({
handleSubmit();
} else if (
event.key === KEYS.TAB ||
- (event[KEYS.CTRL_OR_CMD] &&
- (event.code === CODES.BRACKET_LEFT ||
- event.code === CODES.BRACKET_RIGHT))
+ (
+ event[KEYS.CTRL_OR_CMD] &&
+ (
+ event.code === CODES.BRACKET_LEFT ||
+ event.code === CODES.BRACKET_RIGHT
+ )
+ )
) {
event.preventDefault();
if (event.isComposing) {
@@ -629,10 +633,14 @@ export const textWysiwyg = ({
event.target.classList.contains("active-color");
if (
- ((event.target instanceof HTMLElement ||
- event.target instanceof SVGElement) &&
+ (
+ (
+ event.target instanceof HTMLElement ||
+ event.target instanceof SVGElement
+ ) &&
event.target.closest(`.${CLASSES.SHAPE_ACTIONS_MENU}`) &&
- !isWritableElement(event.target)) ||
+ !isWritableElement(event.target)
+ ) ||
isTargetPickerTrigger
) {
editable.onblur = null;
diff --git ORI/excalidraw/packages/excalidraw/element/typeChecks.ts ALT/excalidraw/packages/excalidraw/element/typeChecks.ts
index a84798c..9accda9 100644
--- ORI/excalidraw/packages/excalidraw/element/typeChecks.ts
+++ ALT/excalidraw/packages/excalidraw/element/typeChecks.ts
@@ -138,7 +138,8 @@ export const isBindableElement = (
return (
element != null &&
(!element.locked || includeLocked === true) &&
- (element.type === "rectangle" ||
+ (
+ element.type === "rectangle" ||
element.type === "diamond" ||
element.type === "ellipse" ||
element.type === "image" ||
@@ -146,7 +147,8 @@ export const isBindableElement = (
element.type === "embeddable" ||
element.type === "frame" ||
element.type === "magicframe" ||
- (element.type === "text" && !element.containerId))
+ (element.type === "text" && !element.containerId)
+ )
);
};
@@ -157,10 +159,12 @@ export const isTextBindableContainer = (
return (
element != null &&
(!element.locked || includeLocked === true) &&
- (element.type === "rectangle" ||
+ (
+ element.type === "rectangle" ||
element.type === "diamond" ||
element.type === "ellipse" ||
- isArrowElement(element))
+ isArrowElement(element)
+ )
);
};
@@ -228,10 +232,12 @@ export const canApplyRoundnessTypeToElement = (
element: ExcalidrawElement,
) => {
if (
- (roundnessType === ROUNDNESS.ADAPTIVE_RADIUS ||
+ (
+ roundnessType === ROUNDNESS.ADAPTIVE_RADIUS ||
// if legacy roundness, it can be applied to elements that currently
// use adaptive radius
- roundnessType === ROUNDNESS.LEGACY) &&
+ roundnessType === ROUNDNESS.LEGACY
+ ) &&
isUsingAdaptiveRadius(element.type)
) {
return true;
diff --git ORI/excalidraw/packages/excalidraw/hooks/useOutsideClick.ts ALT/excalidraw/packages/excalidraw/hooks/useOutsideClick.ts
index c720a83..6c37db2 100644
--- ORI/excalidraw/packages/excalidraw/hooks/useOutsideClick.ts
+++ ALT/excalidraw/packages/excalidraw/hooks/useOutsideClick.ts
@@ -55,8 +55,10 @@ export function useOutsideClick<T extends HTMLElement>(
// the `body` element, so the target element is going to be the `html`
// (note: this won't work if we selectively re-enable pointer events on
// specific elements as we do with navbar or excalidraw UI elements)
- (_event.target === document.documentElement &&
- document.body.style.pointerEvents === "none");
+ (
+ _event.target === document.documentElement &&
+ document.body.style.pointerEvents === "none"
+ );
// if clicking on radix portal, assume it's a popup that
// should be considered as part of the UI. Obviously this is a terrible
diff --git ORI/excalidraw/packages/excalidraw/renderer/renderElement.ts ALT/excalidraw/packages/excalidraw/renderer/renderElement.ts
index 0dd0a35..8591e3b 100644
--- ORI/excalidraw/packages/excalidraw/renderer/renderElement.ts
+++ ALT/excalidraw/packages/excalidraw/renderer/renderElement.ts
@@ -862,10 +862,12 @@ export const renderElement = (
// on low resolution (while still zooming in) than sharp ones
!appState?.shouldCacheIgnoreZoom &&
// angle is 0 -> always disable smoothing
- (!element.angle ||
+ (
+ !element.angle ||
// or check if angle is a right angle in which case we can still
// disable smoothing without adversely affecting the result
- isRightAngle(element.angle))
+ isRightAngle(element.angle)
+ )
) {
// Disabling smoothing makes output much sharper, especially for
// text. Unless for non-right angles, where the aliasing is really
diff --git ORI/excalidraw/packages/excalidraw/renderer/staticScene.ts ALT/excalidraw/packages/excalidraw/renderer/staticScene.ts
index b7dcdd5..f0a06b7 100644
--- ORI/excalidraw/packages/excalidraw/renderer/staticScene.ts
+++ ALT/excalidraw/packages/excalidraw/renderer/staticScene.ts
@@ -218,12 +218,14 @@ const _renderStaticScene = ({
element.groupIds.length > 0 &&
appState.frameToHighlight &&
appState.selectedElementIds[element.id] &&
- (elementOverlapsWithFrame(
- element,
- appState.frameToHighlight,
- elementsMap,
- ) ||
- element.groupIds.find((groupId) => groupsToBeAddedToFrame.has(groupId)))
+ (
+ elementOverlapsWithFrame(
+ element,
+ appState.frameToHighlight,
+ elementsMap,
+ ) ||
+ element.groupIds.find((groupId) => groupsToBeAddedToFrame.has(groupId))
+ )
) {
element.groupIds.forEach((groupId) =>
groupsToBeAddedToFrame.add(groupId),
@@ -322,10 +324,13 @@ const _renderStaticScene = ({
if (
isIframeLikeElement(element) &&
- (isExporting ||
- (isEmbeddableElement(element) &&
- renderConfig.embedsValidationStatus.get(element.id) !==
- true)) &&
+ (
+ isExporting ||
+ (
+ isEmbeddableElement(element) &&
+ renderConfig.embedsValidationStatus.get(element.id) !== true
+ )
+ ) &&
element.width &&
element.height
) {
diff --git ORI/excalidraw/packages/excalidraw/scene/Shape.ts ALT/excalidraw/packages/excalidraw/scene/Shape.ts
index 98cdd47..6c769c5 100644
--- ORI/excalidraw/packages/excalidraw/scene/Shape.ts
+++ ALT/excalidraw/packages/excalidraw/scene/Shape.ts
@@ -38,9 +38,11 @@ function adjustRoughness(element: ExcalidrawElement): number {
// both sides relatively big
(minSize >= 20 && maxSize >= 50) ||
// is round & both sides above 15px
- (minSize >= 15 &&
+ (
+ minSize >= 15 &&
!!element.roundness &&
- canChangeRoundness(element.type)) ||
+ canChangeRoundness(element.type)
+ ) ||
// relatively long linear element
(isLinearElement(element) && maxSize >= 50)
) {
@@ -123,9 +125,13 @@ const modifyIframeLikeForRoughOptions = (
) => {
if (
isIframeLikeElement(element) &&
- (isExporting ||
- (isEmbeddableElement(element) &&
- embedsValidationStatus?.get(element.id) !== true)) &&
+ (
+ isExporting ||
+ (
+ isEmbeddableElement(element) &&
+ embedsValidationStatus?.get(element.id) !== true
+ )
+ ) &&
isTransparent(element.backgroundColor) &&
isTransparent(element.strokeColor)
) {
diff --git ORI/excalidraw/packages/excalidraw/shapes.tsx ALT/excalidraw/packages/excalidraw/shapes.tsx
index a8b9b53..f1061fd 100644
--- ORI/excalidraw/packages/excalidraw/shapes.tsx
+++ ALT/excalidraw/packages/excalidraw/shapes.tsx
@@ -89,10 +89,12 @@ export const findShapeByKey = (key: string) => {
const shape = SHAPES.find((shape, index) => {
return (
(shape.numericKey != null && key === shape.numericKey.toString()) ||
- (shape.key &&
+ (
+ shape.key &&
(typeof shape.key === "string"
? shape.key === key
- : (shape.key as readonly string[]).includes(key)))
+ : (shape.key as readonly string[]).includes(key))
+ )
);
});
return shape?.value || null;
diff --git ORI/excalidraw/packages/excalidraw/snapping.ts ALT/excalidraw/packages/excalidraw/snapping.ts
index bc83d00..7bfd00b 100644
--- ORI/excalidraw/packages/excalidraw/snapping.ts
+++ ALT/excalidraw/packages/excalidraw/snapping.ts
@@ -151,9 +151,11 @@ export const isSnappingEnabled = ({
if (event) {
return (
(appState.objectsSnapModeEnabled && !event[KEYS.CTRL_OR_CMD]) ||
- (!appState.objectsSnapModeEnabled &&
+ (
+ !appState.objectsSnapModeEnabled &&
event[KEYS.CTRL_OR_CMD] &&
- appState.gridSize === null)
+ appState.gridSize === null
+ )
);
}
@@ -1083,8 +1085,10 @@ export const snapResizingElements = (
if (
!isSnappingEnabled({ event, selectedElements, appState }) ||
selectedElements.length === 0 ||
- (selectedElements.length === 1 &&
- !areRoughlyEqual(selectedElements[0].angle, 0))
+ (
+ selectedElements.length === 1 &&
+ !areRoughlyEqual(selectedElements[0].angle, 0)
+ )
) {
return {
snapOffset: { x: 0, y: 0 },
diff --git ORI/excalidraw/packages/excalidraw/utils.ts ALT/excalidraw/packages/excalidraw/utils.ts
index fd477f2..12b47a5 100644
--- ORI/excalidraw/packages/excalidraw/utils.ts
+++ ALT/excalidraw/packages/excalidraw/utils.ts
@@ -76,10 +76,14 @@ export const isWritableElement = (
(target instanceof HTMLElement && target.dataset.type === "wysiwyg") ||
target instanceof HTMLBRElement || // newline in wysiwyg
target instanceof HTMLTextAreaElement ||
- (target instanceof HTMLInputElement &&
- (target.type === "text" ||
+ (
+ target instanceof HTMLInputElement &&
+ (
+ target.type === "text" ||
target.type === "number" ||
- target.type === "password"));
+ target.type === "password"
+ )
+ );
export const getFontFamilyString = ({
fontFamily,
@@ -611,9 +615,11 @@ export const getNearestScrollableContainer = (
const hasScrollableContent = parent.scrollHeight > parent.clientHeight;
if (
hasScrollableContent &&
- (overflowY === "auto" ||
+ (
+ overflowY === "auto" ||
overflowY === "scroll" ||
- overflowY === "overlay")
+ overflowY === "overlay"
+ )
) {
return parent;
}
diff --git ORI/excalidraw/packages/utils/export.ts ALT/excalidraw/packages/utils/export.ts
index 0c345cc..5bdddba 100644
--- ORI/excalidraw/packages/utils/export.ts
+++ ALT/excalidraw/packages/utils/export.ts
@@ -71,7 +71,7 @@ export const exportToCanvas = ({
const scale =
maxWidthOrHeight < max
? maxWidthOrHeight / max
- : (appState?.exportScale ?? 1);
+ : appState?.exportScale ?? 1;
canvas.width = width * scale;
canvas.height = height * scale;
diff --git ORI/excalidraw/packages/utils/withinBounds.ts ALT/excalidraw/packages/utils/withinBounds.ts
index a804689..0682600 100644
--- ORI/excalidraw/packages/utils/withinBounds.ts
+++ ALT/excalidraw/packages/utils/withinBounds.ts
@@ -134,10 +134,14 @@ export const elementPartiallyOverlapsWithOrContainsBBox = (
const elementBBox = getRotatedBBox(element);
return (
- (isValueInRange(elementBBox[0], bbox[0], bbox[2]) ||
- isValueInRange(bbox[0], elementBBox[0], elementBBox[2])) &&
- (isValueInRange(elementBBox[1], bbox[1], bbox[3]) ||
- isValueInRange(bbox[1], elementBBox[1], elementBBox[3]))
+ (
+ isValueInRange(elementBBox[0], bbox[0], bbox[2]) ||
+ isValueInRange(bbox[0], elementBBox[0], elementBBox[2])
+ ) &&
+ (
+ isValueInRange(elementBBox[1], bbox[1], bbox[3]) ||
+ isValueInRange(bbox[1], elementBBox[1], elementBBox[3])
+ )
);
};
|
prettier/prettier#11103 VS prettier/prettier@main :: marmelab/react-admin@83f6ec3 Diff (276 lines)diff --git ORI/react-admin/packages/ra-core/src/auth/useAuthState.ts ALT/react-admin/packages/ra-core/src/auth/useAuthState.ts
index 7e597d0..33157e5 100644
--- ORI/react-admin/packages/ra-core/src/auth/useAuthState.ts
+++ ALT/react-admin/packages/ra-core/src/auth/useAuthState.ts
@@ -95,7 +95,7 @@ const useAuthState = (
// If the data is undefined and the query isn't loading anymore, it means the query failed.
// In that case, we set authenticated to false unless there's no authProvider.
authenticated:
- (result.data ?? result.isLoading) ? true : authProvider == null, // Optimistic
+ result.data ?? result.isLoading ? true : authProvider == null, // Optimistic
isLoading: result.isLoading,
error: result.error,
};
diff --git ORI/react-admin/packages/ra-core/src/controller/input/referenceDataStatus.ts ALT/react-admin/packages/ra-core/src/controller/input/referenceDataStatus.ts
index 7364ea1..5252c36 100644
--- ORI/react-admin/packages/ra-core/src/controller/input/referenceDataStatus.ts
+++ ALT/react-admin/packages/ra-core/src/controller/input/referenceDataStatus.ts
@@ -39,9 +39,11 @@ export const getStatusForInput = <RecordType extends RaRecord = RaRecord>({
(field.value && selectedReferenceError && !matchingReferences) ||
(!field.value && !matchingReferences),
error:
- (field.value &&
+ (
+ field.value &&
selectedReferenceError &&
- matchingReferencesError) ||
+ matchingReferencesError
+ ) ||
(!field.value && matchingReferencesError)
? field.value
? selectedReferenceError
@@ -108,23 +110,31 @@ export const getStatusForArrayInput = <RecordType extends RaRecord = any>({
return {
waiting:
- (!matchingReferences &&
+ (
+ !matchingReferences &&
field.value &&
- selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY) ||
+ selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY
+ ) ||
(!matchingReferences && !field.value),
error:
matchingReferencesError &&
- (!field.value ||
- (field.value &&
- selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY))
+ (
+ !field.value ||
+ (
+ field.value &&
+ selectedReferencesDataStatus === REFERENCES_STATUS_EMPTY
+ )
+ )
? translate('ra.input.references.all_missing', {
_: 'ra.input.references.all_missing',
})
: null,
warning:
matchingReferencesError ||
- (field.value &&
- selectedReferencesDataStatus !== REFERENCES_STATUS_READY)
+ (
+ field.value &&
+ selectedReferencesDataStatus !== REFERENCES_STATUS_READY
+ )
? matchingReferencesError ||
translate('ra.input.references.many_missing', {
_: 'ra.input.references.many_missing',
diff --git ORI/react-admin/packages/ra-core/src/controller/input/useReferenceParams.ts ALT/react-admin/packages/ra-core/src/controller/input/useReferenceParams.ts
index 118392a..8860ba7 100644
--- ORI/react-admin/packages/ra-core/src/controller/input/useReferenceParams.ts
+++ ALT/react-admin/packages/ra-core/src/controller/input/useReferenceParams.ts
@@ -258,11 +258,13 @@ export const hasCustomParams = (params: ReferenceParams) => {
return (
params &&
params.filter &&
- (Object.keys(params.filter).length > 0 ||
+ (
+ Object.keys(params.filter).length > 0 ||
params.order != null ||
params.page !== 1 ||
params.perPage != null ||
- params.sort != null)
+ params.sort != null
+ )
);
};
diff --git ORI/react-admin/packages/ra-core/src/controller/list/useInfiniteListController.ts ALT/react-admin/packages/ra-core/src/controller/list/useInfiniteListController.ts
index 8572f4f..94d2364 100644
--- ORI/react-admin/packages/ra-core/src/controller/list/useInfiniteListController.ts
+++ ALT/react-admin/packages/ra-core/src/controller/list/useInfiniteListController.ts
@@ -126,9 +126,11 @@ export const useInfiniteListController = <RecordType extends RaRecord = any>(
useEffect(() => {
if (
query.page <= 0 ||
- (!isFetching &&
+ (
+ !isFetching &&
query.page > 1 &&
- (data == null || data?.pages.length === 0))
+ (data == null || data?.pages.length === 0)
+ )
) {
// Query for a page that doesn't exist, set page to 1
queryModifiers.setPage(1);
diff --git ORI/react-admin/packages/ra-core/src/controller/list/useListController.ts ALT/react-admin/packages/ra-core/src/controller/list/useListController.ts
index e63642e..8563e78 100644
--- ORI/react-admin/packages/ra-core/src/controller/list/useListController.ts
+++ ALT/react-admin/packages/ra-core/src/controller/list/useListController.ts
@@ -104,9 +104,11 @@ export const useListController = <RecordType extends RaRecord = any>(
useEffect(() => {
if (
query.page <= 0 ||
- (!isFetching &&
+ (
+ !isFetching &&
query.page > 1 &&
- (data == null || data?.length === 0))
+ (data == null || data?.length === 0)
+ )
) {
// Query for a page that doesn't exist, set page to 1
queryModifiers.setPage(1);
diff --git ORI/react-admin/packages/ra-core/src/controller/list/useListParams.ts ALT/react-admin/packages/ra-core/src/controller/list/useListParams.ts
index 084f218..e7c859b 100644
--- ORI/react-admin/packages/ra-core/src/controller/list/useListParams.ts
+++ ALT/react-admin/packages/ra-core/src/controller/list/useListParams.ts
@@ -325,11 +325,13 @@ export const hasCustomParams = (params: ListParams) => {
return (
params &&
params.filter &&
- (Object.keys(params.filter).length > 0 ||
+ (
+ Object.keys(params.filter).length > 0 ||
params.order != null ||
params.page !== 1 ||
params.perPage != null ||
- params.sort != null)
+ params.sort != null
+ )
);
};
diff --git ORI/react-admin/packages/ra-core/src/form/useInput.ts ALT/react-admin/packages/ra-core/src/form/useInput.ts
index ef6740f..ac09068 100644
--- ORI/react-admin/packages/ra-core/src/form/useInput.ts
+++ ALT/react-admin/packages/ra-core/src/form/useInput.ts
@@ -109,7 +109,7 @@ export const useInput = <ValueType = any>(
const eventOrValue = (
props.type === 'checkbox' && event[0]?.target?.value === 'on'
? event[0].target.checked
- : (event[0]?.target?.value ?? event[0])
+ : event[0]?.target?.value ?? event[0]
) as any;
controllerField.onChange(parse ? parse(eventOrValue) : eventOrValue);
if (initialOnChange) {
diff --git ORI/react-admin/packages/ra-core/src/form/useSuggestions.ts ALT/react-admin/packages/ra-core/src/form/useSuggestions.ts
index 77b0bf5..f2b8dd8 100644
--- ORI/react-admin/packages/ra-core/src/form/useSuggestions.ts
+++ ALT/react-admin/packages/ra-core/src/form/useSuggestions.ts
@@ -182,7 +182,8 @@ export const getSuggestionsFactory =
suggestions = choices.filter(
choice =>
matchSuggestion(filter, choice) ||
- (selectedItem != null &&
+ (
+ selectedItem != null &&
(!Array.isArray(selectedItem)
? getChoiceValue(choice) ===
getChoiceValue(selectedItem)
@@ -190,7 +191,8 @@ export const getSuggestionsFactory =
selected =>
getChoiceValue(choice) ===
getChoiceValue(selected)
- )))
+ ))
+ )
);
}
diff --git ORI/react-admin/packages/ra-core/src/form/useWarnWhenUnsavedChanges.tsx ALT/react-admin/packages/ra-core/src/form/useWarnWhenUnsavedChanges.tsx
index 88aff3e..eb0fb0f 100644
--- ORI/react-admin/packages/ra-core/src/form/useWarnWhenUnsavedChanges.tsx
+++ ALT/react-admin/packages/ra-core/src/form/useWarnWhenUnsavedChanges.tsx
@@ -48,9 +48,11 @@ export const useWarnWhenUnsavedChanges = (
if (
!isSubmitting &&
- (newLocationIsInsideForm ||
+ (
+ newLocationIsInsideForm ||
isSubmitSuccessful ||
- window.confirm(translate('ra.message.unsaved_changes')))
+ window.confirm(translate('ra.message.unsaved_changes'))
+ )
) {
unblock();
tx.retry();
diff --git ORI/react-admin/packages/ra-core/src/inference/assertions.ts ALT/react-admin/packages/ra-core/src/inference/assertions.ts
index 0d066aa..8f0b10d 100644
--- ORI/react-admin/packages/ra-core/src/inference/assertions.ts
+++ ALT/react-admin/packages/ra-core/src/inference/assertions.ts
@@ -47,10 +47,14 @@ export const valuesAreDate = (values: any[]) => values.every(isDate);
export const isDateString = (value: any) =>
!value ||
- (typeof value === 'string' &&
- (isMatch(value, 'MM/dd/yyyy') ||
+ (
+ typeof value === 'string' &&
+ (
+ isMatch(value, 'MM/dd/yyyy') ||
isMatch(value, 'MM/dd/yy') ||
- isValid(parseISO(value))));
+ isValid(parseISO(value))
+ )
+ );
export const valuesAreDateString = (values: any[]) =>
values.every(isDateString);
diff --git ORI/react-admin/packages/ra-core/src/preferences/usePreference.ts ALT/react-admin/packages/ra-core/src/preferences/usePreference.ts
index 76b155d..cc35647 100644
--- ORI/react-admin/packages/ra-core/src/preferences/usePreference.ts
+++ ALT/react-admin/packages/ra-core/src/preferences/usePreference.ts
@@ -21,9 +21,7 @@ export const usePreference = <T = any>(key?: string, defaultValue?: T) => {
}
return useStore<T>(
- preferenceKey && key
- ? `${preferenceKey}.${key}`
- : (preferenceKey ?? key),
+ preferenceKey && key ? `${preferenceKey}.${key}` : preferenceKey ?? key,
defaultValue
);
};
diff --git ORI/react-admin/packages/ra-ui-materialui/src/button/SaveButton.tsx ALT/react-admin/packages/ra-ui-materialui/src/button/SaveButton.tsx
index ff70e7d..faded77 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/button/SaveButton.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/button/SaveButton.tsx
@@ -78,9 +78,13 @@ export const SaveButton = <RecordType extends RaRecord = any>(
warning(
type === 'submit' &&
- ((mutationOptions &&
- (mutationOptions.onSuccess || mutationOptions.onError)) ||
- transform),
+ (
+ (
+ mutationOptions &&
+ (mutationOptions.onSuccess || mutationOptions.onError)
+ ) ||
+ transform
+ ),
'Cannot use <SaveButton mutationOptions> props on a button of type "submit". To override the default mutation options on a particular save button, set the <SaveButton type="button"> prop, or set mutationOptions in the main view component (<Create> or <Edit>).'
);
diff --git ORI/react-admin/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.tsx ALT/react-admin/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.tsx
index 1cf65d4..6300472 100644
--- ORI/react-admin/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.tsx
+++ ALT/react-admin/packages/ra-ui-materialui/src/list/datagrid/DatagridRow.tsx
@@ -59,9 +59,11 @@ const DatagridRow: FC<DatagridRowProps> = React.forwardRef((props, ref) => {
const translate = useTranslate();
const record = useRecordContext(props);
const expandable =
- (!context ||
+ (
+ !context ||
!context.isRowExpandable ||
- context.isRowExpandable(record)) &&
+ context.isRowExpandable(record)
+ ) &&
expand;
const resource = useResourceContext(props);
const createPath = useCreatePath(); |
prettier/prettier#11103 VS prettier/prettier@main :: vega/vega-lite@a573af5 Diff (96 lines)diff --git ORI/vega-lite/src/compile/data/bin.ts ALT/vega-lite/src/compile/data/bin.ts
index 49cb293..1c43602 100644
--- ORI/vega-lite/src/compile/data/bin.ts
+++ ALT/vega-lite/src/compile/data/bin.ts
@@ -17,7 +17,7 @@ function rangeFormula(model: ModelWithField, fieldDef: TypedFieldDef<string>, ch
// read format from axis or legend, if there is no format then use config.numberFormat
const guide = isUnitModel(model)
- ? (model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {})
+ ? model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {}
: {};
const startField = vgField(fieldDef, {expr: 'datum'});
diff --git ORI/vega-lite/src/compile/data/debug.ts ALT/vega-lite/src/compile/data/debug.ts
index fbba4f0..fb2e161 100644
--- ORI/vega-lite/src/compile/data/debug.ts
+++ ALT/vega-lite/src/compile/data/debug.ts
@@ -83,7 +83,7 @@ export function dotString(roots: readonly DataFlowNode[]) {
label: getLabel(node),
hash:
node instanceof SourceNode
- ? (node.data.url ?? node.data.name ?? node.debugName)
+ ? node.data.url ?? node.data.name ?? node.debugName
: String(node.hash()).replace(/"/g, '')
};
diff --git ORI/vega-lite/src/compile/legend/encode.ts ALT/vega-lite/src/compile/legend/encode.ts
index 405c185..334e0b0 100644
--- ORI/vega-lite/src/compile/legend/encode.ts
+++ ALT/vega-lite/src/compile/legend/encode.ts
@@ -58,7 +58,7 @@ export function symbols(
const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;
const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;
- const opacity = symbolOpacity === undefined ? (getMaxValue(encoding.opacity) ?? markDef.opacity) : undefined;
+ const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;
if (out.fill) {
// for fill legend, we don't want any fill in symbol
diff --git ORI/vega-lite/src/compile/mark/encode/position-rect.ts ALT/vega-lite/src/compile/mark/encode/position-rect.ts
index 7b037cb..505bb12 100644
--- ORI/vega-lite/src/compile/mark/encode/position-rect.ts
+++ ALT/vega-lite/src/compile/mark/encode/position-rect.ts
@@ -313,7 +313,7 @@ function rectBinPosition({
const axis = model.component.axes[channel]?.[0];
const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5
- const spacing = isXorY(channel) ? (getMarkPropOrConfig('binSpacing', markDef, config) ?? 0) : 0;
+ const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0;
const channel2 = getSecondaryRangeChannel(channel);
const vgChannel = getVgPositionChannel(channel);
diff --git ORI/vega-lite/src/compile/mark/encode/valueref.ts ALT/vega-lite/src/compile/mark/encode/valueref.ts
index ab3fc5d..7416b18 100644
--- ORI/vega-lite/src/compile/mark/encode/valueref.ts
+++ ALT/vega-lite/src/compile/mark/encode/valueref.ts
@@ -302,7 +302,7 @@ export function midPoint({
{
offset,
// For band, to get mid point, need to offset by half of the band
- band: scaleType === 'band' ? (bandPosition ?? channelDef.bandPosition ?? 0.5) : undefined
+ band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined
}
);
} else if (isValueDef(channelDef)) {
diff --git ORI/vega-lite/src/normalize/index.ts ALT/vega-lite/src/normalize/index.ts
index 43c3523..439c59a 100644
--- ORI/vega-lite/src/normalize/index.ts
+++ ALT/vega-lite/src/normalize/index.ts
@@ -59,7 +59,7 @@ function normalizeGenericSpec(
}
function _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) {
- return isString(autosize) ? {type: autosize} : (autosize ?? {});
+ return isString(autosize) ? {type: autosize} : autosize ?? {};
}
/**
diff --git ORI/vega-lite/src/normalize/toplevelselection.ts ALT/vega-lite/src/normalize/toplevelselection.ts
index 226d700..d7ca8a5 100644
--- ORI/vega-lite/src/normalize/toplevelselection.ts
+++ ALT/vega-lite/src/normalize/toplevelselection.ts
@@ -50,10 +50,12 @@ export class TopLevelSelectionsNormalizer extends SpecMapper<NormalizerParams, N
// view is either a specific unit name, or a partial path through the spec tree.
if (
(isString(view) && (view === spec.name || path.includes(view))) ||
- (isArray(view) &&
+ (
+ isArray(view) &&
// logic for backwards compatibility with view paths before we had unique names
// @ts-ignore
- view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1])))
+ view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1]))
+ )
) {
params.push(selection);
} |
No description provided.
The text was updated successfully, but these errors were encountered: