prettier / prettier-regression-testing

Automates the prettier/prettier regression checks with GitHub Actions.
11 stars 9 forks source link

15447 #419

Open fisker opened 9 months ago

fisker commented 9 months ago

Run #15447

github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: babel/babel@134aa1723c6aa01a42713e379142088b30c6cc0d

Diff (993 lines) ```diff diff --git ORI/babel/packages/babel-compat-data/scripts/build-bugfixes-targets.js ALT/babel/packages/babel-compat-data/scripts/build-bugfixes-targets.js index d91e7a45..9ffb205c 100644 --- ORI/babel/packages/babel-compat-data/scripts/build-bugfixes-targets.js +++ ALT/babel/packages/babel-compat-data/scripts/build-bugfixes-targets.js @@ -14,7 +14,10 @@ const { const pluginBugfixes = require("./data/plugin-bugfixes"); const pluginFeatures = require("./data/plugin-features"); -const { data: dataWithBugfixes, overlapping } = generateData( +const { + data: dataWithBugfixes, + overlapping, +} = generateData( environments, Object.assign({}, pluginBugfixes, pluginFeatures) ); diff --git ORI/babel/packages/babel-core/src/config/config-chain.ts ALT/babel/packages/babel-core/src/config/config-chain.ts index 48b64e22..0fcbd3c1 100644 --- ORI/babel/packages/babel-core/src/config/config-chain.ts +++ ALT/babel/packages/babel-core/src/config/config-chain.ts @@ -218,11 +218,10 @@ export function* buildRootChain( pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) ) { - ({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig( - pkgData, - context.envName, - context.caller, - )); + ({ + ignore: ignoreFile, + config: babelrcFile, + } = yield* findRelativeConfig(pkgData, context.envName, context.caller)); if (ignoreFile) { fileChain.files.add(ignoreFile.filepath); diff --git ORI/babel/packages/babel-core/src/transformation/file/file.ts ALT/babel/packages/babel-core/src/transformation/file/file.ts index 0a7b370f..16eccd2d 100644 --- ORI/babel/packages/babel-core/src/transformation/file/file.ts +++ ALT/babel/packages/babel-core/src/transformation/file/file.ts @@ -196,7 +196,10 @@ export default class File { dependencies[dep] = this.addHelper(dep); } - const { nodes, globals } = helpers.get( + const { + nodes, + globals, + } = helpers.get( name, dep => dependencies[dep], uid, diff --git ORI/babel/packages/babel-core/test/config-chain.js ALT/babel/packages/babel-core/test/config-chain.js index 51019dee..97f1da97 100644 --- ORI/babel/packages/babel-core/test/config-chain.js +++ ALT/babel/packages/babel-core/test/config-chain.js @@ -1117,9 +1117,11 @@ describe("buildConfigChain", function () { test.each(["babel.config.json", "babel.config.js", "babel.config.cjs"])( "should load %s synchronously", async name => { - const { cwd, tmp, config } = await getTemp( - `babel-test-load-config-sync-${name}`, - ); + const { + cwd, + tmp, + config, + } = await getTemp(`babel-test-load-config-sync-${name}`); const filename = tmp("src.js"); await config(name); @@ -1135,9 +1137,11 @@ describe("buildConfigChain", function () { ); test("should not load babel.config.mjs synchronously", async () => { - const { cwd, tmp, config } = await getTemp( - "babel-test-load-config-sync-babel.config.mjs", - ); + const { + cwd, + tmp, + config, + } = await getTemp("babel-test-load-config-sync-babel.config.mjs"); const filename = tmp("src.js"); await config("babel.config.mjs"); @@ -1158,9 +1162,11 @@ describe("buildConfigChain", function () { return; } - const { cwd, tmp, config } = await getTemp( - `babel-test-load-config-async-${name}`, - ); + const { + cwd, + tmp, + config, + } = await getTemp(`babel-test-load-config-async-${name}`); const filename = tmp("src.js"); await config(name); @@ -1194,9 +1200,11 @@ describe("buildConfigChain", function () { return; } - const { cwd, tmp, config } = await getTemp( - `babel-test-dup-config-${name1}-${name2}`, - ); + const { + cwd, + tmp, + config, + } = await getTemp(`babel-test-dup-config-${name1}-${name2}`); await Promise.all([config(name1), config(name2)]); @@ -1214,9 +1222,11 @@ describe("buildConfigChain", function () { ".babelrc.cjs", ".babelrc.json", ])("should load %s synchronously", async name => { - const { cwd, tmp, config } = await getTemp( - `babel-test-load-config-${name}`, - ); + const { + cwd, + tmp, + config, + } = await getTemp(`babel-test-load-config-${name}`); const filename = tmp("src.js"); await config(name); @@ -1231,9 +1241,11 @@ describe("buildConfigChain", function () { }); test("should not load .babelrc.mjs synchronously", async () => { - const { cwd, tmp, config } = await getTemp( - "babel-test-load-config-sync-.babelrc.mjs", - ); + const { + cwd, + tmp, + config, + } = await getTemp("babel-test-load-config-sync-.babelrc.mjs"); const filename = tmp("src.js"); await config(".babelrc.mjs"); @@ -1257,9 +1269,11 @@ describe("buildConfigChain", function () { return; } - const { cwd, tmp, config } = await getTemp( - `babel-test-load-config-${name}`, - ); + const { + cwd, + tmp, + config, + } = await getTemp(`babel-test-load-config-${name}`); const filename = tmp("src.js"); await config(name); @@ -1303,9 +1317,11 @@ describe("buildConfigChain", function () { return; } - const { cwd, tmp, config } = await getTemp( - `babel-test-dup-config-${name1}-${name2}`, - ); + const { + cwd, + tmp, + config, + } = await getTemp(`babel-test-dup-config-${name1}-${name2}`); await Promise.all([config(name1), config(name2)]); diff --git ORI/babel/packages/babel-core/test/helpers/esm.js ALT/babel/packages/babel-core/test/helpers/esm.js index fac6e6cc..509fa826 100644 --- ORI/babel/packages/babel-core/test/helpers/esm.js +++ ALT/babel/packages/babel-core/test/helpers/esm.js @@ -49,7 +49,10 @@ export function spawnTransformSync() { // Remove this function when https://github.com/nodejs/node/issues/35889 is resolved. // Jest supports dynamic import(), but Node.js segfaults when using it in our tests. async function spawn(runner, filename, cwd = process.cwd()) { - const { stdout, stderr } = await util.promisify(cp.execFile)( + const { + stdout, + stderr, + } = await util.promisify(cp.execFile)( process.execPath, // pass `cwd` as params as `process.cwd()` will normalize `cwd` on macOS [require.resolve(`../fixtures/babel-${runner}.mjs`), filename, cwd], diff --git ORI/babel/packages/babel-generator/src/index.ts ALT/babel/packages/babel-generator/src/index.ts index 4807342a..0bf82f9b 100644 --- ORI/babel/packages/babel-generator/src/index.ts +++ ALT/babel/packages/babel-generator/src/index.ts @@ -110,8 +110,11 @@ function normalizeOptions( format.indent.adjustMultilineComment = false; } - const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } = - format; + const { + auxiliaryCommentBefore, + auxiliaryCommentAfter, + shouldPrintComment, + } = format; if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { format.auxiliaryCommentBefore = undefined; diff --git ORI/babel/packages/babel-helper-compilation-targets/src/index.ts ALT/babel/packages/babel-helper-compilation-targets/src/index.ts index 3ec58830..49f5907b 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/index.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/index.ts @@ -285,10 +285,9 @@ export default function getTargets( decimalWarnings.push({ target, value }); } - const [parsedTarget, parsedValue] = - target === "node" - ? nodeTargetParser(value) - : defaultTargetParser(target, value as string); + const [parsedTarget, parsedValue] = target === "node" + ? nodeTargetParser(value) + : defaultTargetParser(target, value as string); if (parsedValue) { // Merge (lowest wins) 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 795c0bd1..85c223a9 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 @@ -239,31 +239,18 @@ export function createClassFeaturePlugin({ if (!process.env.BABEL_8_BREAKING) { if (isDecorated) { staticNodes = pureStaticNodes = keysNodes = []; - ({ instanceNodes, wrapClass } = buildDecoratedClass( - ref, - path, - elements, - file, - )); + ({ + instanceNodes, + wrapClass, + } = buildDecoratedClass(ref, path, elements, file)); } else { keysNodes = extractComputedKeys(path, computedPaths, file); - ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = - buildFieldsInitNodes( - ref, - path.node.superClass, - props, - privateNamesMap, - file, - setPublicClassFields ?? loose, - privateFieldsAsSymbolsOrProperties ?? loose, - constantSuper ?? loose, - innerBinding, - )); - } - } else { - keysNodes = extractComputedKeys(path, computedPaths, file); - ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = - buildFieldsInitNodes( + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( ref, path.node.superClass, props, @@ -274,6 +261,25 @@ export function createClassFeaturePlugin({ constantSuper ?? loose, innerBinding, )); + } + } else { + keysNodes = extractComputedKeys(path, computedPaths, file); + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( + ref, + path.node.superClass, + props, + privateNamesMap, + file, + setPublicClassFields ?? loose, + privateFieldsAsSymbolsOrProperties ?? loose, + constantSuper ?? loose, + innerBinding, + )); } if (instanceNodes.length > 0) { diff --git ORI/babel/packages/babel-helper-module-transforms/src/normalize-and-load-metadata.ts ALT/babel/packages/babel-helper-module-transforms/src/normalize-and-load-metadata.ts index 98f01d40..1ae10380 100644 --- ORI/babel/packages/babel-helper-module-transforms/src/normalize-and-load-metadata.ts +++ ALT/babel/packages/babel-helper-module-transforms/src/normalize-and-load-metadata.ts @@ -137,7 +137,11 @@ export default function normalizeModuleAndLoadMetadata( nameAnonymousExports(programPath); - const { local, sources, hasExports } = getModuleMetadata( + const { + local, + sources, + hasExports, + } = getModuleMetadata( programPath, { initializeReexports, lazy }, stringSpecifiers, 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 fecc1ddf..a00a8aac 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 @@ -270,8 +270,13 @@ const buildImportThrow = (localName: string) => { const rewriteReferencesVisitor: Visitor = { ReferencedIdentifier(path) { - const { seen, buildImportReference, scope, imported, requeueInParent } = - this; + const { + seen, + buildImportReference, + scope, + imported, + requeueInParent, + } = this; if (seen.has(path.node)) return; seen.add(path.node); diff --git ORI/babel/packages/babel-helper-string-parser/src/index.ts ALT/babel/packages/babel-helper-string-parser/src/index.ts index b2abe830..9aeed08f 100644 --- ORI/babel/packages/babel-helper-string-parser/src/index.ts +++ ALT/babel/packages/babel-helper-string-parser/src/index.ts @@ -172,7 +172,10 @@ function readEscapedChar( return res("\r"); case charCodes.lowercaseX: { let code; - ({ code, pos } = readHexChar( + ({ + code, + pos, + } = readHexChar( input, pos, lineStart, @@ -186,7 +189,10 @@ function readEscapedChar( } case charCodes.lowercaseU: { let code; - ({ code, pos } = readCodePoint( + ({ + code, + pos, + } = readCodePoint( input, pos, lineStart, @@ -274,7 +280,10 @@ function readHexChar( ) { const initialPos = pos; let n; - ({ n, pos } = readInt( + ({ + n, + pos, + } = readInt( input, pos, lineStart, @@ -425,7 +434,10 @@ export function readCodePoint( if (ch === charCodes.leftCurlyBrace) { ++pos; - ({ code, pos } = readHexChar( + ({ + code, + pos, + } = readHexChar( input, pos, lineStart, @@ -444,7 +456,10 @@ export function readCodePoint( } } } else { - ({ code, pos } = readHexChar( + ({ + code, + pos, + } = readHexChar( input, pos, lineStart, 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 77ed298d..ee497861 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 @@ -318,7 +318,10 @@ async function run(task: Test) { if (!execCode || inputCode) { let actualLogs; - ({ result, actualLogs } = await maybeMockConsole(validateLogs, () => + ({ + result, + actualLogs, + } = await maybeMockConsole(validateLogs, () => babel.transformAsync(inputCode, getOpts(actual)), )); diff --git ORI/babel/packages/babel-parser/src/parse-error.ts ALT/babel/packages/babel-parser/src/parse-error.ts index 82567d83..0f63c118 100644 --- ORI/babel/packages/babel-parser/src/parse-error.ts +++ ALT/babel/packages/babel-parser/src/parse-error.ts @@ -180,12 +180,14 @@ export function ParseErrorEnum( for (const reasonCode of Object.keys(argument)) { const template = (argument as ParseErrorTemplates)[reasonCode]; - const { message, ...rest } = - typeof template === "string" - ? { message: () => template } - : typeof template === "function" - ? { message: template } - : template; + const { + message, + ...rest + } = typeof template === "string" + ? { message: () => template } + : typeof template === "function" + ? { message: template } + : template; const toMessage = typeof message === "string" ? () => message : message; ParseErrorConstructors[reasonCode] = toParseErrorConstructor({ diff --git ORI/babel/packages/babel-parser/src/plugin-utils.ts ALT/babel/packages/babel-parser/src/plugin-utils.ts index 661cb829..4a92f2b0 100644 --- ORI/babel/packages/babel-parser/src/plugin-utils.ts +++ ALT/babel/packages/babel-parser/src/plugin-utils.ts @@ -25,8 +25,9 @@ export function hasPlugin( // The expectedOptions object is by default an empty object if the given // expectedConfig argument does not give an options object (i.e., if it is a // string). - const [expectedName, expectedOptions] = - typeof expectedConfig === "string" ? [expectedConfig, {}] : expectedConfig; + const [expectedName, expectedOptions] = typeof expectedConfig === "string" + ? [expectedConfig, {}] + : expectedConfig; const expectedKeys = Object.keys(expectedOptions); diff --git ORI/babel/packages/babel-parser/src/plugins/flow/index.ts ALT/babel/packages/babel-parser/src/plugins/flow/index.ts index 55cceae8..6094979f 100644 --- ORI/babel/packages/babel-parser/src/plugins/flow/index.ts +++ ALT/babel/packages/babel-parser/src/plugins/flow/index.ts @@ -437,8 +437,10 @@ export default (superClass: typeof Parser) => typeNode.this = tmp._this; this.expect(tt.parenR); - [typeNode.returnType, node.predicate] = - this.flowParseTypeAndPredicateInitialiser(); + [ + typeNode.returnType, + node.predicate, + ] = this.flowParseTypeAndPredicateInitialiser(); typeContainer.typeAnnotation = this.finishNode( typeNode, @@ -3682,7 +3684,10 @@ export default (superClass: typeof Parser) => const nameLoc = id.loc.start; const explicitType = this.flowEnumParseExplicitType({ enumName }); this.expect(tt.braceL); - const { members, hasUnknownMembers } = this.flowEnumMembers({ + const { + members, + hasUnknownMembers, + } = this.flowEnumMembers({ enumName, explicitType, }); diff --git ORI/babel/packages/babel-parser/src/tokenizer/index.ts ALT/babel/packages/babel-parser/src/tokenizer/index.ts index 8750a3cf..ecec7652 100644 --- ORI/babel/packages/babel-parser/src/tokenizer/index.ts +++ ALT/babel/packages/babel-parser/src/tokenizer/index.ts @@ -1142,7 +1142,10 @@ export default abstract class Tokenizer extends CommentsParser { forceLen: boolean = false, allowNumSeparator: boolean | "bail" = true, ): number | null { - const { n, pos } = readInt( + const { + n, + pos, + } = readInt( this.input, this.state.pos, this.state.lineStart, @@ -1300,7 +1303,10 @@ export default abstract class Tokenizer extends CommentsParser { // Read a string value, interpreting backslash-escapes. readCodePoint(throwOnInvalid: boolean): number | null { - const { code, pos } = readCodePoint( + const { + code, + pos, + } = readCodePoint( this.input, this.state.pos, this.state.lineStart, @@ -1313,7 +1319,12 @@ export default abstract class Tokenizer extends CommentsParser { } readString(quote: number): void { - const { str, pos, curLine, lineStart } = readStringContents( + const { + str, + pos, + curLine, + lineStart, + } = readStringContents( quote === charCodes.quotationMark ? "double" : "single", this.input, this.state.pos + 1, // skip the quote @@ -1340,15 +1351,20 @@ export default abstract class Tokenizer extends CommentsParser { // Reads template string tokens. readTemplateToken(): void { const opening = this.input[this.state.pos]; - const { str, firstInvalidLoc, pos, curLine, lineStart } = - readStringContents( - "template", - this.input, - this.state.pos + 1, // skip '`' or `}` - this.state.lineStart, - this.state.curLine, - this.errorHandlers_readStringContents_template, - ); + const { + str, + firstInvalidLoc, + pos, + curLine, + lineStart, + } = readStringContents( + "template", + this.input, + this.state.pos + 1, // skip '`' or `}` + this.state.lineStart, + this.state.curLine, + this.errorHandlers_readStringContents_template, + ); this.state.pos = pos + 1; // skip '`' or `$` this.state.lineStart = lineStart; this.state.curLine = curLine; diff --git ORI/babel/packages/babel-parser/src/util/class-scope.ts ALT/babel/packages/babel-parser/src/util/class-scope.ts index a3c852ff..8c886985 100644 --- ORI/babel/packages/babel-parser/src/util/class-scope.ts +++ ALT/babel/packages/babel-parser/src/util/class-scope.ts @@ -64,8 +64,11 @@ export default class ClassScopeHandler { elementType: ClassElementTypes, loc: Position, ) { - const { privateNames, loneAccessors, undefinedPrivateNames } = - this.current(); + const { + privateNames, + loneAccessors, + undefinedPrivateNames, + } = this.current(); let redefined = privateNames.has(name); if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) { diff --git ORI/babel/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts ALT/babel/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts index fa5774f4..0a2456fa 100644 --- ORI/babel/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts +++ ALT/babel/packages/babel-plugin-proposal-decorators/src/transformer-2023-05.ts @@ -372,11 +372,10 @@ function generateDecorationExprs( ): t.ArrayExpression { return t.arrayExpression( filteredOrderedDecoratorInfo(info).map(el => { - const { decs, hasThis } = generateDecorationList( - el.decorators, - el.decoratorsThis, - version, - ); + const { + decs, + hasThis, + } = generateDecorationList(el.decorators, el.decoratorsThis, version); let flag = el.kind; if (el.isStatic) { @@ -860,7 +859,10 @@ function transformClass( let classDecorationsFlag = 0; let classDecorations: t.Expression[] = []; if (classDecorators) { - const { hasThis, decs } = generateDecorationList( + const { + hasThis, + decs, + } = generateDecorationList( classDecorators.map(el => el.expression), classDecorators.map(dec => decoratorsThis.get(dec)), version, diff --git ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts index 5888fd1f..17d9a8cb 100644 --- ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts +++ ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts @@ -49,8 +49,10 @@ export default declare(function ({ assertVersion, assumption, types: t }) { ? -1 : params.findIndex(param => param.type === "AssignmentPattern"); const paramsAfterIndex = params.splice(firstPrivateIndex); - const { params: transformedParams, variableDeclaration } = - buildVariableDeclarationFromParams(paramsAfterIndex, scope); + const { + params: transformedParams, + variableDeclaration, + } = buildVariableDeclarationFromParams(paramsAfterIndex, scope); (path.get("body") as NodePath).unshiftContainer( "body", 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 f674c08a..07420907 100644 --- ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/util.ts +++ ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/util.ts @@ -89,11 +89,10 @@ export function buildVariableDeclarationFromParams( params: (t.Identifier | t.RestElement)[]; variableDeclaration: t.VariableDeclaration; } { - const { elements, transformed } = buildAssignmentsFromPatternList( - params, - scope, - /* isAssignment */ false, - ); + const { + elements, + transformed, + } = buildAssignmentsFromPatternList(params, scope, /* isAssignment */ false); return { params: elements, variableDeclaration: variableDeclaration( @@ -442,7 +441,10 @@ export function* transformPrivateKeyDestructuring( // and ordering/array-pattern-side-effect-iterable test const leftElements = left.elements; const leftElementsAfterIndex = leftElements.splice(index); - const { elements, transformed } = buildAssignmentsFromPatternList( + const { + elements, + transformed, + } = buildAssignmentsFromPatternList( leftElementsAfterIndex, scope, isAssignment, diff --git ORI/babel/packages/babel-plugin-transform-block-scoping/src/index.ts ALT/babel/packages/babel-plugin-transform-block-scoping/src/index.ts index 80195171..dc710a84 100644 --- ORI/babel/packages/babel-plugin-transform-block-scoping/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-block-scoping/src/index.ts @@ -81,8 +81,11 @@ export default declare((api, opts: Options) => { headScope.crawl(); binding = headScope.getOwnBinding(name); } - const { usages, capturedInClosure, hasConstantViolations } = - getUsageInBody(binding, path); + const { + usages, + capturedInClosure, + hasConstantViolations, + } = getUsageInBody(binding, path); if ( headScope.parent.hasBinding(name) || diff --git ORI/babel/packages/babel-plugin-transform-modules-amd/src/index.ts ALT/babel/packages/babel-plugin-transform-modules-amd/src/index.ts index b46dff0e..0dfbb947 100644 --- ORI/babel/packages/babel-plugin-transform-modules-amd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-amd/src/index.ts @@ -63,8 +63,13 @@ type State = { export default declare((api, options: Options) => { api.assertVersion(7); - const { allowTopLevelThis, strict, strictMode, importInterop, noInterop } = - options; + const { + allowTopLevelThis, + strict, + strictMode, + importInterop, + noInterop, + } = options; const constantReexports = api.assumption("constantReexports") ?? options.loose; @@ -141,19 +146,19 @@ export default declare((api, options: Options) => { // @ts-expect-error todo(flow->ts): do not reuse variables if (moduleName) moduleName = t.stringLiteral(moduleName); - const { meta, headers } = rewriteModuleStatementsAndPrepareHeader( - path, - { - enumerableModuleMeta, - constantReexports, - strict, - strictMode, - allowTopLevelThis, - importInterop, - noInterop, - filename: this.file.opts.filename, - }, - ); + const { + meta, + headers, + } = rewriteModuleStatementsAndPrepareHeader(path, { + enumerableModuleMeta, + constantReexports, + strict, + strictMode, + allowTopLevelThis, + importInterop, + noInterop, + filename: this.file.opts.filename, + }); if (hasExports(meta)) { amdArgs.push(t.stringLiteral("exports")); 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 b89169e5..d61b3e81 100644 --- ORI/babel/packages/babel-plugin-transform-modules-commonjs/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-commonjs/src/index.ts @@ -212,27 +212,27 @@ export default declare((api, options: Options) => { // @ts-expect-error todo(flow->ts): do not reuse variables if (moduleName) moduleName = t.stringLiteral(moduleName); - const { meta, headers } = rewriteModuleStatementsAndPrepareHeader( - path, - { - exportName: "exports", - constantReexports, - enumerableModuleMeta, - strict, - strictMode, - allowTopLevelThis, - noInterop, - importInterop, - lazy, - esNamespaceOnly: - typeof state.filename === "string" && - /\.mjs$/.test(state.filename) - ? mjsStrictNamespace - : strictNamespace, - noIncompleteNsImportDetection, - filename: this.file.opts.filename, - }, - ); + const { + meta, + headers, + } = rewriteModuleStatementsAndPrepareHeader(path, { + exportName: "exports", + constantReexports, + enumerableModuleMeta, + strict, + strictMode, + allowTopLevelThis, + noInterop, + importInterop, + lazy, + esNamespaceOnly: + typeof state.filename === "string" && + /\.mjs$/.test(state.filename) + ? mjsStrictNamespace + : strictNamespace, + noIncompleteNsImportDetection, + filename: this.file.opts.filename, + }); for (const [source, metadata] of meta.source) { const loadExpr = t.callExpression(t.identifier("require"), [ diff --git ORI/babel/packages/babel-plugin-transform-modules-umd/src/index.ts ALT/babel/packages/babel-plugin-transform-modules-umd/src/index.ts index c7d4c80b..eae6ad8d 100644 --- ORI/babel/packages/babel-plugin-transform-modules-umd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-umd/src/index.ts @@ -172,19 +172,19 @@ export default declare((api, options: Options) => { let moduleNameLiteral: void | t.StringLiteral; if (moduleName) moduleNameLiteral = t.stringLiteral(moduleName); - const { meta, headers } = rewriteModuleStatementsAndPrepareHeader( - path, - { - constantReexports, - enumerableModuleMeta, - strict, - strictMode, - allowTopLevelThis, - noInterop, - importInterop, - filename: this.file.opts.filename, - }, - ); + const { + meta, + headers, + } = rewriteModuleStatementsAndPrepareHeader(path, { + constantReexports, + enumerableModuleMeta, + strict, + strictMode, + allowTopLevelThis, + noInterop, + importInterop, + filename: this.file.opts.filename, + }); const amdArgs = []; const commonjsArgs = []; 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 b0169e30..8b7406c4 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 @@ -189,9 +189,11 @@ export default declare((api, opts: Options) => { path.get("properties") as NodePath[], path.scope, ); - const { keys, allLiteral, hasTemplateLiteral } = extractNormalizedKeys( - path.node, - ); + const { + keys, + allLiteral, + hasTemplateLiteral, + } = extractNormalizedKeys(path.node); if (keys.length === 0) { return [ @@ -435,12 +437,15 @@ export default declare((api, opts: Options) => { path => path.isObjectPattern(), ); - const [impureComputedPropertyDeclarators, argument, callExpression] = - createObjectRest( - objectPatternPath, - file, - ref as t.MemberExpression, - ); + const [ + impureComputedPropertyDeclarators, + argument, + callExpression, + ] = createObjectRest( + objectPatternPath, + file, + ref as t.MemberExpression, + ); if (pureGetters) { removeUnusedExcludedKeys(objectPatternPath); @@ -517,8 +522,11 @@ export default declare((api, opts: Options) => { ]), ); - const [impureComputedPropertyDeclarators, argument, callExpression] = - createObjectRest(leftPath, file, t.identifier(refName)); + const [ + impureComputedPropertyDeclarators, + argument, + callExpression, + ] = createObjectRest(leftPath, file, t.identifier(refName)); if (impureComputedPropertyDeclarators.length > 0) { nodes.push( diff --git ORI/babel/packages/babel-register/src/worker/transform.js ALT/babel/packages/babel-register/src/worker/transform.js index cc3eb9e2..59f88598 100644 --- ORI/babel/packages/babel-register/src/worker/transform.js +++ ALT/babel/packages/babel-register/src/worker/transform.js @@ -67,7 +67,10 @@ exports.transform = async function (input, filename) { const { cached, store } = cacheLookup(opts, filename); if (cached) return cached; - const { code, map } = await babel.transformAsync(input, { + const { + code, + map, + } = await babel.transformAsync(input, { ...opts, sourceMaps: opts.sourceMaps === undefined ? "both" : opts.sourceMaps, ast: false, @@ -91,7 +94,10 @@ if (!process.env.BABEL_8_BREAKING) { const { cached, store } = cacheLookup(opts, filename); if (cached) return cached; - const { code, map } = babel.transformSync(input, { + const { + code, + map, + } = babel.transformSync(input, { ...opts, sourceMaps: opts.sourceMaps === undefined ? "both" : opts.sourceMaps, ast: false, diff --git ORI/babel/packages/babel-template/src/parse.ts ALT/babel/packages/babel-template/src/parse.ts index 913a1588..b37af9db 100644 --- ORI/babel/packages/babel-template/src/parse.ts +++ ALT/babel/packages/babel-template/src/parse.ts @@ -145,9 +145,10 @@ function placeholderVisitorHandler( type = "other"; } - const { placeholders, placeholderNames } = !hasSyntacticPlaceholders - ? state.legacy - : state.syntactic; + const { + placeholders, + placeholderNames, + } = !hasSyntacticPlaceholders ? state.legacy : state.syntactic; placeholders.push({ name, diff --git ORI/babel/packages/babel-traverse/src/path/conversion.ts ALT/babel/packages/babel-traverse/src/path/conversion.ts index a87be3c2..02cd4515 100644 --- ORI/babel/packages/babel-traverse/src/path/conversion.ts +++ ALT/babel/packages/babel-traverse/src/path/conversion.ts @@ -172,7 +172,10 @@ export function arrowFunctionToExpression( ); } - const { thisBinding, fnPath: fn } = hoistFunctionEnvironment( + const { + thisBinding, + fnPath: fn, + } = hoistFunctionEnvironment( this, noNewArrows, allowInsertArrow, @@ -288,8 +291,13 @@ function hoistFunctionEnvironment( } } - const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } = - getScopeInformation(fnPath); + const { + thisPaths, + argumentsPaths, + newTargetPaths, + superProps, + superCalls, + } = getScopeInformation(fnPath); // Convert all super() calls in the constructor, if super is used in an arrow. if (inConstructor && superCalls.length > 0) { diff --git ORI/babel/packages/babel-types/src/definitions/core.ts ALT/babel/packages/babel-types/src/definitions/core.ts index 5ff8984d..d9a8a23f 100644 --- ORI/babel/packages/babel-types/src/definitions/core.ts +++ ALT/babel/packages/babel-types/src/definitions/core.ts @@ -2013,24 +2013,20 @@ defineType("TemplateElement", { // unreachable throw new Error("Internal @babel/types error."); }; - const { str, firstInvalidLoc } = readStringContents( - "template", - raw, - 0, - 0, - 0, - { - unterminated() { - unterminatedCalled = true; - }, - strictNumericEscape: error, - invalidEscapeSequence: error, - numericSeparatorInEscapeSequence: error, - unexpectedNumericSeparator: error, - invalidDigit: error, - invalidCodePoint: error, + const { + str, + firstInvalidLoc, + } = readStringContents("template", raw, 0, 0, 0, { + unterminated() { + unterminatedCalled = true; }, - ); + strictNumericEscape: error, + invalidEscapeSequence: error, + numericSeparatorInEscapeSequence: error, + unexpectedNumericSeparator: error, + invalidDigit: error, + invalidCodePoint: error, + }); if (!unterminatedCalled) throw new Error("Invalid raw"); node.value.cooked = firstInvalidLoc ? null : str; ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: mdn/content@c5dd9c3b9d503a56dc04b6b8f88e89194dc82d7f

Diff (51 lines) ```diff diff --git ORI/content/files/en-us/web/api/streams_api/using_readable_byte_streams/index.md ALT/content/files/en-us/web/api/streams_api/using_readable_byte_streams/index.md index 47b5fb9f..02df47e7 100644 --- ORI/content/files/en-us/web/api/streams_api/using_readable_byte_streams/index.md +++ ALT/content/files/en-us/web/api/streams_api/using_readable_byte_streams/index.md @@ -571,7 +571,10 @@ function makeReadableByteFileStream(filename) { async pull(controller) { // Called when there is a pull request for data const theView = controller.byobRequest.view; - const { bytesRead, buffer } = await fileHandle.read( + const { + bytesRead, + buffer, + } = await fileHandle.read( theView.buffer, theView.offset, theView.length, @@ -809,7 +812,10 @@ function makeReadableByteFileStream(filename) { async pull(controller) { // Called when there is a pull request for data const theView = controller.byobRequest.view; - const { bytesRead, buffer } = await fileHandle.read( + const { + bytesRead, + buffer, + } = await fileHandle.read( theView.buffer, theView.offset, theView.length, @@ -1038,7 +1044,10 @@ function makeReadableByteFileStream(filename) { // Called when there is a pull request for data if (controller.byobRequest) { const theView = controller.byobRequest.view; - const { bytesRead, buffer } = await fileHandle.read( + const { + bytesRead, + buffer, + } = await fileHandle.read( theView.buffer, theView.offset, theView.length, @@ -1060,7 +1069,10 @@ function makeReadableByteFileStream(filename) { // No BYOBRequest so enqueue data to stream // NOTE, this branch would only execute for a default reader if autoAllocateChunkSize is not defined. const mynewBuffer = new Uint8Array(DEFAULT_CHUNK_SIZE); - const { bytesRead, buffer } = await fileHandle.read( + const { + bytesRead, + buffer, + } = await fileHandle.read( mynewBuffer.buffer, mynewBuffer.offset, mynewBuffer.length, ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: vuejs/eslint-plugin-vue@2aa9ac45a4ea66c293b3e7cbfd6ad076afa39bb5

Diff (144 lines) ```diff diff --git ORI/eslint-plugin-vue/lib/rules/attributes-order.js ALT/eslint-plugin-vue/lib/rules/attributes-order.js index e6915ae..8cad039 100644 --- ORI/eslint-plugin-vue/lib/rules/attributes-order.js +++ ALT/eslint-plugin-vue/lib/rules/attributes-order.js @@ -326,8 +326,10 @@ function create(context) { return } - let { attr: previousNode, position: previousPosition } = - attributeAndPositions[0] + let { + attr: previousNode, + position: previousPosition + } = attributeAndPositions[0] for (let index = 1; index < attributeAndPositions.length; index++) { const { attr, position } = attributeAndPositions[index] diff --git ORI/eslint-plugin-vue/lib/rules/no-unsupported-features.js ALT/eslint-plugin-vue/lib/rules/no-unsupported-features.js index 0bcd61a..27d80ee 100644 --- ORI/eslint-plugin-vue/lib/rules/no-unsupported-features.js +++ ALT/eslint-plugin-vue/lib/rules/no-unsupported-features.js @@ -128,7 +128,10 @@ module.exports = { }, /** @param {RuleContext} context */ create(context) { - const { version, ignores } = Object.assign( + const { + version, + ignores + } = Object.assign( { version: null, ignores: [] diff --git ORI/eslint-plugin-vue/lib/rules/v-on-handler-style.js ALT/eslint-plugin-vue/lib/rules/v-on-handler-style.js index aa1214e..a3ddf63 100644 --- ORI/eslint-plugin-vue/lib/rules/v-on-handler-style.js +++ ALT/eslint-plugin-vue/lib/rules/v-on-handler-style.js @@ -278,8 +278,10 @@ module.exports = { * @returns {boolean} Returns `true` if reported. */ function verifyCanUseMethodHandlerForInlineHandler(node) { - const { rangeWithoutQuotes, hasComment } = - getVExpressionContainerTokenInfo(node.parent) + const { + rangeWithoutQuotes, + hasComment + } = getVExpressionContainerTokenInfo(node.parent) if (ignoreIncludesComment && hasComment) { return false } @@ -326,10 +328,12 @@ module.exports = { * @returns {boolean} Returns `true` if reported. */ function verifyCanUseMethodHandlerForInlineFunction(node) { - const { rangeWithoutQuotes, hasComment } = - getVExpressionContainerTokenInfo( - /** @type {VExpressionContainer} */ (node.parent) - ) + const { + rangeWithoutQuotes, + hasComment + } = getVExpressionContainerTokenInfo( + /** @type {VExpressionContainer} */ (node.parent) + ) if (ignoreIncludesComment && hasComment) { return false } @@ -420,8 +424,10 @@ module.exports = { /* The statements contains $event and cannot be fixed. */ return } - const { rangeWithoutQuotes, hasQuote } = - getVExpressionContainerTokenInfo(node.parent) + const { + rangeWithoutQuotes, + hasQuote + } = getVExpressionContainerTokenInfo(node.parent) if (!hasQuote) { /* The statements is not enclosed in quotes and cannot be fixed. */ return diff --git ORI/eslint-plugin-vue/lib/utils/indent-common.js ALT/eslint-plugin-vue/lib/utils/indent-common.js index 4e3edb2..960549a 100644 --- ORI/eslint-plugin-vue/lib/utils/indent-common.js +++ ALT/eslint-plugin-vue/lib/utils/indent-common.js @@ -1528,21 +1528,24 @@ module.exports.defineVisitor = function create( const importToken = tokenStore.getFirstToken(node) const tokens = tokenStore.getTokensBetween(importToken, node.source) const fromIndex = tokens.map((t) => t.value).lastIndexOf('from') - const { fromToken, beforeTokens, afterTokens } = - fromIndex >= 0 - ? { - fromToken: tokens[fromIndex], - beforeTokens: tokens.slice(0, fromIndex), - afterTokens: [ - ...tokens.slice(fromIndex + 1), - tokenStore.getFirstToken(node.source) - ] - } - : { - fromToken: null, - beforeTokens: [...tokens, tokenStore.getFirstToken(node.source)], - afterTokens: [] - } + const { + fromToken, + beforeTokens, + afterTokens + } = fromIndex >= 0 + ? { + fromToken: tokens[fromIndex], + beforeTokens: tokens.slice(0, fromIndex), + afterTokens: [ + ...tokens.slice(fromIndex + 1), + tokenStore.getFirstToken(node.source) + ] + } + : { + fromToken: null, + beforeTokens: [...tokens, tokenStore.getFirstToken(node.source)], + afterTokens: [] + } /** @type {ImportSpecifier[]} */ const namedSpecifiers = [] diff --git ORI/eslint-plugin-vue/lib/utils/indent-ts.js ALT/eslint-plugin-vue/lib/utils/indent-ts.js index 5bee668..a9ca56c 100644 --- ORI/eslint-plugin-vue/lib/utils/indent-ts.js +++ ALT/eslint-plugin-vue/lib/utils/indent-ts.js @@ -1082,10 +1082,12 @@ function defineVisitor({ ['TSAbstractMethodDefinition, TSAbstractPropertyDefinition, TSAbstractAccessorProperty, TSEnumMember,' + // Deprecated in @typescript-eslint/parser v5 'ClassProperty, TSAbstractClassProperty'](node) { - const { keyNode, valueNode } = - node.type === 'TSEnumMember' - ? { keyNode: node.id, valueNode: node.initializer } - : { keyNode: node.key, valueNode: node.value } + const { + keyNode, + valueNode + } = node.type === 'TSEnumMember' + ? { keyNode: node.id, valueNode: node.initializer } + : { keyNode: node.key, valueNode: node.value } const firstToken = tokenStore.getFirstToken(node) const keyTokens = getFirstAndLastTokens(keyNode) const prefixTokens = tokenStore.getTokensBetween( ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: excalidraw/excalidraw@3ddcc48e4c192f525930e503b3e9214627f0043d

Diff (1187 lines) ```diff diff --git ORI/excalidraw/src/actions/actionBoundText.tsx ALT/excalidraw/src/actions/actionBoundText.tsx index c8a1faa..a033999 100644 --- ORI/excalidraw/src/actions/actionBoundText.tsx +++ ALT/excalidraw/src/actions/actionBoundText.tsx @@ -51,7 +51,11 @@ export const actionUnbindText = register({ selectedElements.forEach((element) => { const boundTextElement = getBoundTextElement(element); if (boundTextElement) { - const { width, height, baseline } = measureText( + const { + width, + height, + baseline, + } = measureText( boundTextElement.originalText, getFontString(boundTextElement), boundTextElement.lineHeight, diff --git ORI/excalidraw/src/actions/actionDeleteSelected.tsx ALT/excalidraw/src/actions/actionDeleteSelected.tsx index b0486e0..02d5128 100644 --- ORI/excalidraw/src/actions/actionDeleteSelected.tsx +++ ALT/excalidraw/src/actions/actionDeleteSelected.tsx @@ -143,8 +143,10 @@ export const actionDeleteSelected = register({ commitToHistory: true, }; } - let { elements: nextElements, appState: nextAppState } = - deleteSelectedElements(elements, appState); + let { + elements: nextElements, + appState: nextAppState, + } = deleteSelectedElements(elements, appState); fixBindingsAfterDeletion( nextElements, elements.filter(({ id }) => appState.selectedElementIds[id]), diff --git ORI/excalidraw/src/actions/actionFinalize.tsx ALT/excalidraw/src/actions/actionFinalize.tsx index d7147c5..e708229 100644 --- ORI/excalidraw/src/actions/actionFinalize.tsx +++ ALT/excalidraw/src/actions/actionFinalize.tsx @@ -21,8 +21,11 @@ export const actionFinalize = register({ trackEvent: false, perform: (elements, appState, _, { canvas, focusContainer, scene }) => { if (appState.editingLinearElement) { - const { elementId, startBindingElement, endBindingElement } = - appState.editingLinearElement; + const { + elementId, + startBindingElement, + endBindingElement, + } = appState.editingLinearElement; const element = LinearElementEditor.getElement(elementId); if (element) { diff --git ORI/excalidraw/src/align.ts ALT/excalidraw/src/align.ts index 0638283..26f9f20 100644 --- ORI/excalidraw/src/align.ts +++ ALT/excalidraw/src/align.ts @@ -38,8 +38,9 @@ const calculateTranslation = ( ): { x: number; y: number } => { const groupBoundingBox = getCommonBoundingBox(group); - const [min, max]: ["minX" | "minY", "maxX" | "maxY"] = - axis === "x" ? ["minX", "maxX"] : ["minY", "maxY"]; + const [min, max]: ["minX" | "minY", "maxX" | "maxY"] = axis === "x" + ? ["minX", "maxX"] + : ["minY", "maxY"]; const noTranslation = { x: 0, y: 0 }; if (position === "start") { diff --git ORI/excalidraw/src/charts.test.ts ALT/excalidraw/src/charts.test.ts index 5c2cce7..bddb9af 100644 --- ORI/excalidraw/src/charts.test.ts +++ ALT/excalidraw/src/charts.test.ts @@ -47,7 +47,11 @@ describe("charts", () => { expect(result.type).toBe(VALID_SPREADSHEET); - const { title, labels, values } = ( + const { + title, + labels, + values, + } = ( result as { type: typeof VALID_SPREADSHEET; spreadsheet: Spreadsheet } ).spreadsheet; @@ -78,7 +82,11 @@ describe("charts", () => { expect(result.type).toBe(VALID_SPREADSHEET); - const { title, labels, values } = ( + const { + title, + labels, + values, + } = ( result as { type: typeof VALID_SPREADSHEET; spreadsheet: Spreadsheet } ).spreadsheet; @@ -109,7 +117,11 @@ describe("charts", () => { expect(result.type).toBe(VALID_SPREADSHEET); - const { title, labels, values } = ( + const { + title, + labels, + values, + } = ( result as { type: typeof VALID_SPREADSHEET; spreadsheet: Spreadsheet } ).spreadsheet; diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx index b5abc44..1a8d77b 100644 --- ORI/excalidraw/src/components/App.tsx +++ ALT/excalidraw/src/components/App.tsx @@ -674,10 +674,10 @@ class App extends React.Component { return null; } - const { x: x1, y: y1 } = sceneCoordsToViewportCoords( - { sceneX: f.x, sceneY: f.y }, - this.state, - ); + const { + x: x1, + y: y1, + } = sceneCoordsToViewportCoords({ sceneX: f.x, sceneY: f.y }, this.state); const { x: x2 } = sceneCoordsToViewportCoords( { sceneX: f.x + f.width, sceneY: f.y + f.height }, @@ -1884,7 +1884,10 @@ class App extends React.Component { // prefer spreadsheet data over image file (MS Office/Libre Office) if (isSupportedImageFile(file) && !data.spreadsheet) { - const { x: sceneX, y: sceneY } = viewportCoordsToSceneCoords( + const { + x: sceneX, + y: sceneY, + } = viewportCoordsToSceneCoords( { clientX: this.lastViewportPosition.x, clientY: this.lastViewportPosition.y, @@ -1960,10 +1963,10 @@ class App extends React.Component { ? this.lastViewportPosition.y : this.state.height / 2 + this.state.offsetTop; - const { x, y } = viewportCoordsToSceneCoords( - { clientX, clientY }, - this.state, - ); + const { + x, + y, + } = viewportCoordsToSceneCoords({ clientX, clientY }, this.state); const dx = x - elementsCenterX; const dy = y - elementsCenterY; @@ -2043,7 +2046,10 @@ class App extends React.Component { }; private addTextFromPaste(text: string, isPlainPaste = false) { - const { x, y } = viewportCoordsToSceneCoords( + const { + x, + y, + } = viewportCoordsToSceneCoords( { clientX: this.lastViewportPosition.x, clientY: this.lastViewportPosition.y, @@ -2913,7 +2919,10 @@ class App extends React.Component { id: element.id, canvas: this.canvas, getViewportCoords: (x, y) => { - const { x: viewportX, y: viewportY } = sceneCoordsToViewportCoords( + const { + x: viewportX, + y: viewportY, + } = sceneCoordsToViewportCoords( { sceneX: x, sceneY: y, @@ -3267,10 +3276,10 @@ class App extends React.Component { resetCursor(this.canvas); - let { x: sceneX, y: sceneY } = viewportCoordsToSceneCoords( - event, - this.state, - ); + let { + x: sceneX, + y: sceneY, + } = viewportCoordsToSceneCoords(event, this.state); const selectedGroupIds = getSelectedGroupIds(this.state); @@ -3619,22 +3628,26 @@ class App extends React.Component { this.state.gridSize, ); - const [lastCommittedX, lastCommittedY] = - multiElement?.lastCommittedPoint ?? [0, 0]; + const [ + lastCommittedX, + lastCommittedY, + ] = multiElement?.lastCommittedPoint ?? [0, 0]; let dxFromLastCommitted = gridX - rx - lastCommittedX; let dyFromLastCommitted = gridY - ry - lastCommittedY; if (shouldRotateWithDiscreteAngle(event)) { - ({ width: dxFromLastCommitted, height: dyFromLastCommitted } = - getLockedLinearCursorAlignSize( - // actual coordinate of the last committed point - lastCommittedX + rx, - lastCommittedY + ry, - // cursor-grid coordinate - gridX, - gridY, - )); + ({ + width: dxFromLastCommitted, + height: dyFromLastCommitted, + } = getLockedLinearCursorAlignSize( + // actual coordinate of the last committed point + lastCommittedX + rx, + lastCommittedY + ry, + // cursor-grid coordinate + gridX, + gridY, + )); } if (isPathALoop(points, this.state.zoom.value)) { @@ -4975,10 +4988,9 @@ class App extends React.Component { values from appState. */ const { currentItemStartArrowhead, currentItemEndArrowhead } = this.state; - const [startArrowhead, endArrowhead] = - elementType === "arrow" - ? [currentItemStartArrowhead, currentItemEndArrowhead] - : [null, null]; + const [startArrowhead, endArrowhead] = elementType === "arrow" + ? [currentItemStartArrowhead, currentItemEndArrowhead] + : [null, null]; const element = newLinearElement({ type: elementType, @@ -5473,7 +5485,10 @@ class App extends React.Component { let dy = gridY - draggingElement.y; if (shouldRotateWithDiscreteAngle(event) && points.length === 2) { - ({ width: dx, height: dy } = getLockedLinearCursorAlignSize( + ({ + width: dx, + height: dy, + } = getLockedLinearCursorAlignSize( draggingElement.x, draggingElement.y, pointerCoords.x, @@ -5700,8 +5715,10 @@ class App extends React.Component { this.state, ); - const { startBindingElement, endBindingElement } = - linearElementEditor; + const { + startBindingElement, + endBindingElement, + } = linearElementEditor; const element = this.scene.getElement(linearElementEditor.elementId); if (isBindingElement(element)) { bindOrUnbindLinearElement( @@ -6589,10 +6606,10 @@ class App extends React.Component { const clientX = this.state.width / 2 + this.state.offsetLeft; const clientY = this.state.height / 2 + this.state.offsetTop; - const { x, y } = viewportCoordsToSceneCoords( - { clientX, clientY }, - this.state, - ); + const { + x, + y, + } = viewportCoordsToSceneCoords({ clientX, clientY }, this.state); const imageFile = await fileOpen({ description: "Image", @@ -6708,7 +6725,10 @@ class App extends React.Component { elements: readonly InitializedExcalidrawImageElement[], files = this.files, ) => { - const { updatedFiles, erroredFiles } = await _updateImageCache({ + const { + updatedFiles, + erroredFiles, + } = await _updateImageCache({ imageCache: this.imageCache, fileIds: elements.map((element) => element.fileId), files, @@ -6911,10 +6931,10 @@ class App extends React.Component { // to importing as regular image // --------------------------------------------------------------------- - const { x: sceneX, y: sceneY } = viewportCoordsToSceneCoords( - event, - this.state, - ); + const { + x: sceneX, + y: sceneY, + } = viewportCoordsToSceneCoords(event, this.state); const imageElement = this.createImageElement({ sceneX, sceneY }); this.insertImageElement(imageElement, file); @@ -7025,8 +7045,10 @@ class App extends React.Component { const type = element || isHittignCommonBoundBox ? "element" : "canvas"; const container = this.excalidrawContainerRef.current!; - const { top: offsetTop, left: offsetLeft } = - container.getBoundingClientRect(); + const { + top: offsetTop, + left: offsetLeft, + } = container.getBoundingClientRect(); const left = event.clientX - offsetLeft; const top = event.clientY - offsetTop; @@ -7414,7 +7436,10 @@ class App extends React.Component { const isSnappedToCenter = distanceToCenter < TEXT_TO_CENTER_SNAP_THRESHOLD; if (isSnappedToCenter) { - const { x: viewportX, y: viewportY } = sceneCoordsToViewportCoords( + const { + x: viewportX, + y: viewportY, + } = sceneCoordsToViewportCoords( { sceneX: elementCenterX, sceneY: elementCenterY }, appState, ); diff --git ORI/excalidraw/src/components/LibraryMenuHeaderContent.tsx ALT/excalidraw/src/components/LibraryMenuHeaderContent.tsx index 56c8fe6..9afb631 100644 --- ORI/excalidraw/src/components/LibraryMenuHeaderContent.tsx +++ ALT/excalidraw/src/components/LibraryMenuHeaderContent.tsx @@ -95,8 +95,9 @@ export const LibraryDropdownMenuButton: React.FC<{ ? t("buttons.remove") : t("buttons.resetLibrary"); - const [showPublishLibraryDialog, setShowPublishLibraryDialog] = - useState(false); + const [showPublishLibraryDialog, setShowPublishLibraryDialog] = useState( + false, + ); const [publishLibSuccess, setPublishLibSuccess] = useState { - const { encryptedBuffer, iv } = await encryptData( - encryptionKey, - deflate(data), - ); + const { + encryptedBuffer, + iv, + } = await encryptData(encryptionKey, deflate(data)); return { iv, buffer: new Uint8Array(encryptedBuffer) }; }; @@ -322,7 +322,10 @@ export const compressData = async = never>( JSON.stringify(options.metadata || null), ); - const { iv, buffer } = await _encryptAndCompress( + const { + iv, + buffer, + } = await _encryptAndCompress( concatBuffers(contentsMetadataBuffer, dataBuffer), options.encryptionKey, ); diff --git ORI/excalidraw/src/distribute.ts ALT/excalidraw/src/distribute.ts index acad09b..6f30453 100644 --- ORI/excalidraw/src/distribute.ts +++ ALT/excalidraw/src/distribute.ts @@ -12,10 +12,9 @@ export const distributeElements = ( selectedElements: ExcalidrawElement[], distribution: Distribution, ): ExcalidrawElement[] => { - const [start, mid, end, extent] = - distribution.axis === "x" - ? (["minX", "midX", "maxX", "width"] as const) - : (["minY", "midY", "maxY", "height"] as const); + const [start, mid, end, extent] = distribution.axis === "x" + ? (["minX", "midX", "maxX", "width"] as const) + : (["minY", "midY", "maxY", "height"] as const); const bounds = getCommonBoundingBox(selectedElements); const groups = getMaximumGroups(selectedElements) diff --git ORI/excalidraw/src/element/Hyperlink.tsx ALT/excalidraw/src/element/Hyperlink.tsx index cf741ce..58aa2c7 100644 --- ORI/excalidraw/src/element/Hyperlink.tsx +++ ALT/excalidraw/src/element/Hyperlink.tsx @@ -229,7 +229,10 @@ const getCoordsForPopover = ( appState: AppState, ) => { const [x1, y1] = getElementAbsoluteCoords(element); - const { x: viewportX, y: viewportY } = sceneCoordsToViewportCoords( + const { + x: viewportX, + y: viewportY, + } = sceneCoordsToViewportCoords( { sceneX: x1 + element.width / 2, sceneY: y1 }, appState, ); @@ -425,10 +428,10 @@ export const shouldHideLinkPopup = ( appState: AppState, [clientX, clientY]: Point, ): Boolean => { - const { x: sceneX, y: sceneY } = viewportCoordsToSceneCoords( - { clientX, clientY }, - appState, - ); + const { + x: sceneX, + y: sceneY, + } = viewportCoordsToSceneCoords({ clientX, clientY }, appState); const threshold = 15 / appState.zoom.value; // hitbox to prevent hiding when hovered in element bounding box diff --git ORI/excalidraw/src/element/bounds.ts ALT/excalidraw/src/element/bounds.ts index a2a0443..35b5aa5 100644 --- ORI/excalidraw/src/element/bounds.ts +++ ALT/excalidraw/src/element/bounds.ts @@ -392,7 +392,12 @@ export const getMinMaxXYFromCurvePathOps = ( ): [number, number, number, number] => { let currentP: Point = [0, 0]; - const { minX, minY, maxX, maxY } = ops.reduce( + const { + minX, + minY, + maxX, + maxY, + } = ops.reduce( (limits, { op, data }) => { // There are only four operation types: // move, bcurveTo, lineTo, and curveTo @@ -530,10 +535,9 @@ export const getArrowheadPoints = ( if (arrowhead === "arrow") { // Length for -> arrows is based on the length of the last section const [cx, cy] = element.points[element.points.length - 1]; - const [px, py] = - element.points.length > 1 - ? element.points[element.points.length - 2] - : [0, 0]; + const [px, py] = element.points.length > 1 + ? element.points[element.points.length - 2] + : [0, 0]; length = Math.hypot(cx - px, cy - py); } else { diff --git ORI/excalidraw/src/element/dragElements.ts ALT/excalidraw/src/element/dragElements.ts index 4dc5322..8d9ff95 100644 --- ORI/excalidraw/src/element/dragElements.ts +++ ALT/excalidraw/src/element/dragElements.ts @@ -142,13 +142,19 @@ export const dragNewElement = ( // (originX, originY), we use ONLY width or height to control size increase. // This allows the cursor to always "stick" to one of the sides of the bounding box. if (Math.abs(y - originY) > Math.abs(x - originX)) { - ({ width, height } = getPerfectElementSize( + ({ + width, + height, + } = getPerfectElementSize( elementType, height, x < originX ? -width : width, )); } else { - ({ width, height } = getPerfectElementSize( + ({ + width, + height, + } = getPerfectElementSize( elementType, width, y < originY ? -height : height, diff --git ORI/excalidraw/src/element/linearElementEditor.ts ALT/excalidraw/src/element/linearElementEditor.ts index d39cecb..255a11a 100644 --- ORI/excalidraw/src/element/linearElementEditor.ts +++ ALT/excalidraw/src/element/linearElementEditor.ts @@ -143,8 +143,12 @@ export class LinearElementEditor { return false; } - const [selectionX1, selectionY1, selectionX2, selectionY2] = - getElementAbsoluteCoords(appState.draggingElement); + const [ + selectionX1, + selectionY1, + selectionX2, + selectionY2, + ] = getElementAbsoluteCoords(appState.draggingElement); const pointsSceneCoords = LinearElementEditor.getPointsGlobalCoordinates(element); @@ -316,8 +320,12 @@ export class LinearElementEditor { editingLinearElement: LinearElementEditor, appState: AppState, ): LinearElementEditor { - const { elementId, selectedPointsIndices, isDragging, pointerDownState } = - editingLinearElement; + const { + elementId, + selectedPointsIndices, + isDragging, + pointerDownState, + } = editingLinearElement; const element = LinearElementEditor.getElement(elementId); if (!element) { return editingLinearElement; @@ -1256,7 +1264,10 @@ export class LinearElementEditor { gridSize, ); - const { width, height } = getLockedLinearCursorAlignSize( + const { + width, + height, + } = getLockedLinearCursorAlignSize( referencePointCoords[0], referencePointCoords[1], gridX, @@ -1316,11 +1327,13 @@ export class LinearElementEditor { let [x1, y1, x2, y2] = elementBounds; const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; - const { x: boundTextX1, y: boundTextY1 } = - LinearElementEditor.getBoundTextElementPosition( - element, - boundTextElement, - ); + const { + x: boundTextX1, + y: boundTextY1, + } = LinearElementEditor.getBoundTextElementPosition( + element, + boundTextElement, + ); const boundTextX2 = boundTextX1 + boundTextElement.width; const boundTextY2 = boundTextY1 + boundTextElement.height; @@ -1420,7 +1433,12 @@ export class LinearElementEditor { let y2; if (element.points.length < 2 || !getShapeForElement(element)) { // XXX this is just a poor estimate and not very useful - const { minX, minY, maxX, maxY } = element.points.reduce( + const { + minX, + minY, + maxX, + maxY, + } = element.points.reduce( (limits, [x, y]) => { limits.minY = Math.min(limits.minY, y); limits.minX = Math.min(limits.minX, x); diff --git ORI/excalidraw/src/element/newElement.test.ts ALT/excalidraw/src/element/newElement.test.ts index ba7c63e..c8403ed 100644 --- ORI/excalidraw/src/element/newElement.test.ts +++ ALT/excalidraw/src/element/newElement.test.ts @@ -189,8 +189,13 @@ describe("duplicating multiple elements", () => { (e) => e.type === "arrow", ) as ExcalidrawLinearElement[]; - const [clonedRectangle, clonedText1, , clonedArrow2, clonedArrowLabel] = - clonedElements as any as typeof origElements; + const [ + clonedRectangle, + clonedText1, + , + clonedArrow2, + clonedArrowLabel, + ] = clonedElements as any as typeof origElements; expect(clonedText1.containerId).toBe(clonedRectangle.id); expect( @@ -339,8 +344,11 @@ describe("duplicating multiple elements", () => { const clonedElements = duplicateElements( origElements, ) as any as typeof origElements; - const [clonedRectangle1, clonedRectangle2, clonedRectangle3] = - clonedElements; + const [ + clonedRectangle1, + clonedRectangle2, + clonedRectangle3, + ] = clonedElements; expect(rectangle1.groupIds[0]).not.toBe(clonedRectangle1.groupIds[0]); expect(rectangle2.groupIds[0]).not.toBe(clonedRectangle2.groupIds[0]); diff --git ORI/excalidraw/src/element/resizeElements.ts ALT/excalidraw/src/element/resizeElements.ts index 4b6bc8d..7beba64 100644 --- ORI/excalidraw/src/element/resizeElements.ts +++ ALT/excalidraw/src/element/resizeElements.ts @@ -473,13 +473,17 @@ export const resizeSingleElement = ( } } - const [newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2] = - getResizedElementAbsoluteCoords( - stateAtResizeStart, - eleNewWidth, - eleNewHeight, - true, - ); + const [ + newBoundsX1, + newBoundsY1, + newBoundsX2, + newBoundsY2, + ] = getResizedElementAbsoluteCoords( + stateAtResizeStart, + eleNewWidth, + eleNewHeight, + true, + ); const newBoundsWidth = newBoundsX2 - newBoundsX1; const newBoundsHeight = newBoundsY2 - newBoundsY1; @@ -661,7 +665,14 @@ export const resizeMultipleElements = ( return [...acc, { ...text, ...xy }]; }, [] as ExcalidrawTextElementWithContainer[]); - const { minX, minY, maxX, maxY, midX, midY } = getCommonBoundingBox( + const { + minX, + minY, + maxX, + maxY, + midX, + midY, + } = getCommonBoundingBox( targetElements.map(({ orig }) => orig).concat(boundTextElements), ); const direction = transformHandleType; @@ -934,10 +945,9 @@ export const getResizeOffsetXY = ( x: number, y: number, ): [number, number] => { - const [x1, y1, x2, y2] = - selectedElements.length === 1 - ? getElementAbsoluteCoords(selectedElements[0]) - : getCommonBounds(selectedElements); + const [x1, y1, x2, y2] = selectedElements.length === 1 + ? getElementAbsoluteCoords(selectedElements[0]) + : getCommonBounds(selectedElements); const cx = (x1 + x2) / 2; const cy = (y1 + y2) / 2; const angle = selectedElements.length === 1 ? selectedElements[0].angle : 0; diff --git ORI/excalidraw/src/element/resizeTest.ts ALT/excalidraw/src/element/resizeTest.ts index 448e2bf..3dcfbc4 100644 --- ORI/excalidraw/src/element/resizeTest.ts +++ ALT/excalidraw/src/element/resizeTest.ts @@ -36,8 +36,10 @@ export const resizeTest = ( return false; } - const { rotation: rotationTransformHandle, ...transformHandles } = - getTransformHandles(element, zoom, pointerType); + const { + rotation: rotationTransformHandle, + ...transformHandles + } = getTransformHandles(element, zoom, pointerType); if ( rotationTransformHandle && diff --git ORI/excalidraw/src/excalidraw-app/collab/Collab.tsx ALT/excalidraw/src/excalidraw-app/collab/Collab.tsx index ec0c2a3..4edd2ea 100644 --- ORI/excalidraw/src/excalidraw-app/collab/Collab.tsx +++ ALT/excalidraw/src/excalidraw-app/collab/Collab.tsx @@ -511,8 +511,12 @@ class Collab extends PureComponent { ); break; case "MOUSE_LOCATION": { - const { pointer, button, username, selectedElementIds } = - decryptedData.payload; + const { + pointer, + button, + username, + selectedElementIds, + } = decryptedData.payload; const socketId: SocketUpdateDataSource["MOUSE_LOCATION"]["payload"]["socketId"] = decryptedData.payload.socketId || // @ts-ignore legacy, see #2094 (#2097) @@ -638,10 +642,12 @@ class Collab extends PureComponent { }; private loadImageFiles = throttle(async () => { - const { loadedFiles, erroredFiles } = - await this.fetchImageFilesFromFirebase({ - elements: this.excalidrawAPI.getSceneElementsIncludingDeleted(), - }); + const { + loadedFiles, + erroredFiles, + } = await this.fetchImageFilesFromFirebase({ + elements: this.excalidrawAPI.getSceneElementsIncludingDeleted(), + }); this.excalidrawAPI.addFiles(loadedFiles); diff --git ORI/excalidraw/src/excalidraw-app/data/FileManager.ts ALT/excalidraw/src/excalidraw-app/data/FileManager.ts index 419407a..a34b668 100644 --- ORI/excalidraw/src/excalidraw-app/data/FileManager.ts +++ ALT/excalidraw/src/excalidraw-app/data/FileManager.ts @@ -81,7 +81,10 @@ export class FileManager { } try { - const { savedFiles, erroredFiles } = await this._saveFiles({ + const { + savedFiles, + erroredFiles, + } = await this._saveFiles({ addedFiles, }); diff --git ORI/excalidraw/src/excalidraw-app/data/firebase.ts ALT/excalidraw/src/excalidraw-app/data/firebase.ts index 02e1446..a369ea0 100644 --- ORI/excalidraw/src/excalidraw-app/data/firebase.ts +++ ALT/excalidraw/src/excalidraw-app/data/firebase.ts @@ -317,7 +317,10 @@ export const loadFilesFromFirebase = async ( if (response.status < 400) { const arrayBuffer = await response.arrayBuffer(); - const { data, metadata } = await decompressData( + const { + data, + metadata, + } = await decompressData( new Uint8Array(arrayBuffer), { decryptionKey, diff --git ORI/excalidraw/src/excalidraw-app/index.tsx ALT/excalidraw/src/excalidraw-app/index.tsx index 860437f..89a2275 100644 --- ORI/excalidraw/src/excalidraw-app/index.tsx +++ ALT/excalidraw/src/excalidraw-app/index.tsx @@ -279,8 +279,10 @@ const ExcalidrawWrapper = () => { }, VERSION_TIMEOUT); }, []); - const [excalidrawAPI, excalidrawRefCallback] = - useCallbackRefState(); + const [ + excalidrawAPI, + excalidrawRefCallback, + ] = useCallbackRefState(); const [collabAPI] = useAtom(collabAPIAtom); const [, setCollabDialogShown] = useAtom(collabDialogShownAtom); @@ -589,7 +591,10 @@ const ExcalidrawWrapper = () => { } if (canvas) { try { - const { url, errorMessage } = await exportToBackend( + const { + url, + errorMessage, + } = await exportToBackend( exportedElements, { ...appState, diff --git ORI/excalidraw/src/frame.ts ALT/excalidraw/src/frame.ts index 1028f4c..b82718e 100644 --- ORI/excalidraw/src/frame.ts +++ ALT/excalidraw/src/frame.ts @@ -216,11 +216,16 @@ export const elementsAreInFrameBounds = ( elements: readonly ExcalidrawElement[], frame: ExcalidrawFrameElement, ) => { - const [selectionX1, selectionY1, selectionX2, selectionY2] = - getElementAbsoluteCoords(frame); - - const [elementX1, elementY1, elementX2, elementY2] = - getCommonBounds(elements); + const [ + selectionX1, + selectionY1, + selectionX2, + selectionY2, + ] = getElementAbsoluteCoords(frame); + + const [elementX1, elementY1, elementX2, elementY2] = getCommonBounds( + elements, + ); return ( selectionX1 <= elementX1 && diff --git ORI/excalidraw/src/packages/excalidraw/example/App.tsx ALT/excalidraw/src/packages/excalidraw/example/App.tsx index 7f17b29..ef8f27e 100644 --- ORI/excalidraw/src/packages/excalidraw/example/App.tsx +++ ALT/excalidraw/src/packages/excalidraw/example/App.tsx @@ -111,8 +111,10 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) { resolvablePromise(); } - const [excalidrawAPI, setExcalidrawAPI] = - useState(null); + const [ + excalidrawAPI, + setExcalidrawAPI, + ] = useState(null); useCustom(excalidrawAPI, customArgs); @@ -287,7 +289,10 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) { commentIconsElements.forEach((ele) => { const id = ele.id; const appstate = excalidrawAPI.getAppState(); - const { x, y } = sceneCoordsToViewportCoords( + const { + x, + y, + } = sceneCoordsToViewportCoords( { sceneX: commentIcons[id].x, sceneY: commentIcons[id].y }, appstate, ); @@ -307,7 +312,10 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) { if (!excalidrawAPI) { return false; } - const { x, y } = viewportCoordsToSceneCoords( + const { + x, + y, + } = viewportCoordsToSceneCoords( { clientX: event.clientX - pointerDownState.hitElementOffsets.x, clientY: event.clientY - pointerDownState.hitElementOffsets.y, @@ -358,7 +366,10 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) { return false; } const appState = excalidrawAPI.getAppState(); - const { x, y } = sceneCoordsToViewportCoords( + const { + x, + y, + } = sceneCoordsToViewportCoords( { sceneX: commentIcon.x, sceneY: commentIcon.y }, excalidrawAPI.getAppState(), ); @@ -439,7 +450,10 @@ export default function App({ appTitle, useCustom, customArgs }: AppProps) { return null; } const appState = excalidrawAPI?.getAppState()!; - const { x, y } = sceneCoordsToViewportCoords( + const { + x, + y, + } = sceneCoordsToViewportCoords( { sceneX: comment.x, sceneY: comment.y }, appState, ); diff --git ORI/excalidraw/src/packages/utils.ts ALT/excalidraw/src/packages/utils.ts index d936589..a6a7124 100644 --- ORI/excalidraw/src/packages/utils.ts +++ ALT/excalidraw/src/packages/utils.ts @@ -56,11 +56,10 @@ export const exportToCanvas = ({ }: ExportOpts & { exportPadding?: number; }) => { - const { elements: restoredElements, appState: restoredAppState } = restore( - { elements, appState }, - null, - null, - ); + const { + elements: restoredElements, + appState: restoredAppState, + } = restore({ elements, appState }, null, null); const { exportBackground, viewBackgroundColor } = restoredAppState; return _exportToCanvas( passElementsSafely(restoredElements), @@ -181,11 +180,10 @@ export const exportToSvg = async ({ }: Omit & { exportPadding?: number; }): Promise => { - const { elements: restoredElements, appState: restoredAppState } = restore( - { elements, appState }, - null, - null, - ); + const { + elements: restoredElements, + appState: restoredAppState, + } = restore({ elements, appState }, null, null); const exportAppState = { ...restoredAppState, diff --git ORI/excalidraw/src/renderer/renderElement.ts ALT/excalidraw/src/renderer/renderElement.ts index 3f12394..e98c43f 100644 --- ORI/excalidraw/src/renderer/renderElement.ts +++ ALT/excalidraw/src/renderer/renderElement.ts @@ -502,8 +502,16 @@ const generateElementShape = ( break; } case "diamond": { - const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] = - getDiamondPoints(element); + const [ + topX, + topY, + rightX, + rightY, + bottomX, + bottomY, + leftX, + leftY, + ] = getDiamondPoints(element); if (element.roundness) { const verticalRadius = getCornerRadius( Math.abs(topX - leftX), @@ -799,8 +807,9 @@ const drawElementFromCanvas = ( elementWithCanvas.canvas.height, ); - const [, , , , boundTextCx, boundTextCy] = - getElementAbsoluteCoords(boundTextElement); + const [, , , , boundTextCx, boundTextCy] = getElementAbsoluteCoords( + boundTextElement, + ); tempCanvasContext.rotate(-element.angle); @@ -1056,8 +1065,9 @@ export const renderElement = ( tempCanvasContext.rotate(-element.angle); // Shift the canvas to center of bound text - const [, , , , boundTextCx, boundTextCy] = - getElementAbsoluteCoords(boundTextElement); + const [, , , , boundTextCx, boundTextCy] = getElementAbsoluteCoords( + boundTextElement, + ); const boundTextShiftX = (x1 + x2) / 2 - boundTextCx; const boundTextShiftY = (y1 + y2) / 2 - boundTextCy; tempCanvasContext.translate(-boundTextShiftX, -boundTextShiftY); diff --git ORI/excalidraw/src/renderer/renderScene.ts ALT/excalidraw/src/renderer/renderScene.ts index f4f1b44..83a7f7c 100644 --- ORI/excalidraw/src/renderer/renderScene.ts +++ ALT/excalidraw/src/renderer/renderScene.ts @@ -627,8 +627,14 @@ export const _renderScene = ({ } if (selectionColors.length) { - const [elementX1, elementY1, elementX2, elementY2, cx, cy] = - getElementAbsoluteCoords(element, true); + const [ + elementX1, + elementY1, + elementX2, + elementY2, + cx, + cy, + ] = getElementAbsoluteCoords(element, true); acc.push({ angle: element.angle, elementX1, @@ -658,8 +664,9 @@ export const _renderScene = ({ const addSelectionForGroupId = (groupId: GroupId) => { const groupElements = getElementsInGroup(elements, groupId); - const [elementX1, elementY1, elementX2, elementY2] = - getCommonBounds(groupElements); + const [elementX1, elementY1, elementX2, elementY2] = getCommonBounds( + groupElements, + ); selections.push({ angle: 0, elementX1, @@ -1177,8 +1184,9 @@ const renderElementsBoxHighlight = ( ); const getSelectionFromElements = (elements: ExcalidrawElement[]) => { - const [elementX1, elementY1, elementX2, elementY2] = - getCommonBounds(elements); + const [elementX1, elementY1, elementX2, elementY2] = getCommonBounds( + elements, + ); return { angle: 0, elementX1, diff --git ORI/excalidraw/src/scene/scroll.ts ALT/excalidraw/src/scene/scroll.ts index 114d6db..8910404 100644 --- ORI/excalidraw/src/scene/scroll.ts +++ ALT/excalidraw/src/scene/scroll.ts @@ -17,14 +17,14 @@ const isOutsideViewPort = ( cords: Array, ) => { const [x1, y1, x2, y2] = cords; - const { x: viewportX1, y: viewportY1 } = sceneCoordsToViewportCoords( - { sceneX: x1, sceneY: y1 }, - appState, - ); - const { x: viewportX2, y: viewportY2 } = sceneCoordsToViewportCoords( - { sceneX: x2, sceneY: y2 }, - appState, - ); + const { + x: viewportX1, + y: viewportY1, + } = sceneCoordsToViewportCoords({ sceneX: x1, sceneY: y1 }, appState); + const { + x: viewportX2, + y: viewportY2, + } = sceneCoordsToViewportCoords({ sceneX: x2, sceneY: y2 }, appState); return ( viewportX2 - viewportX1 > appState.width || viewportY2 - viewportY1 > appState.height diff --git ORI/excalidraw/src/scene/scrollbars.ts ALT/excalidraw/src/scene/scrollbars.ts index 76a04d6..9cc26ec 100644 --- ORI/excalidraw/src/scene/scrollbars.ts +++ ALT/excalidraw/src/scene/scrollbars.ts @@ -30,8 +30,12 @@ export const getScrollBars = ( }; } // This is the bounding box of all the elements - const [elementsMinX, elementsMinY, elementsMaxX, elementsMaxY] = - getCommonBounds(elements); + const [ + elementsMinX, + elementsMinY, + elementsMaxX, + elementsMaxY, + ] = getCommonBounds(elements); // Apply zoom const viewportWidthWithZoom = viewportWidth / zoom.value; diff --git ORI/excalidraw/src/scene/selection.ts ALT/excalidraw/src/scene/selection.ts index 5b8cb35..6eb5a62 100644 --- ORI/excalidraw/src/scene/selection.ts +++ ALT/excalidraw/src/scene/selection.ts @@ -43,12 +43,17 @@ export const getElementsWithinSelection = ( selection: NonDeletedExcalidrawElement, excludeElementsInFrames: boolean = true, ) => { - const [selectionX1, selectionY1, selectionX2, selectionY2] = - getElementAbsoluteCoords(selection); + const [ + selectionX1, + selectionY1, + selectionX2, + selectionY2, + ] = getElementAbsoluteCoords(selection); let elementsInSelection = elements.filter((element) => { - let [elementX1, elementY1, elementX2, elementY2] = - getElementBounds(element); + let [elementX1, elementY1, elementX2, elementY2] = getElementBounds( + element, + ); const containingFrame = getContainingFrame(element); if (containingFrame) { diff --git ORI/excalidraw/src/tests/linearElementEditor.test.tsx ALT/excalidraw/src/tests/linearElementEditor.test.tsx index c71283a..3399a8f 100644 --- ORI/excalidraw/src/tests/linearElementEditor.test.tsx +++ ALT/excalidraw/src/tests/linearElementEditor.test.tsx @@ -759,10 +759,10 @@ describe("Test Linear Elements", () => { it("should return correct position for 2 pointer arrow", () => { createTwoPointerLinearElement("arrow"); const arrow = h.elements[0] as ExcalidrawLinearElement; - const { textElement, container } = createBoundTextElement( - DEFAULT_TEXT, - arrow, - ); + const { + textElement, + container, + } = createBoundTextElement(DEFAULT_TEXT, arrow); const position = LinearElementEditor.getBoundTextElementPosition( container, textElement, @@ -780,10 +780,10 @@ describe("Test Linear Elements", () => { type: ROUNDNESS.PROPORTIONAL_RADIUS, }); const arrow = h.elements[0] as ExcalidrawLinearElement; - const { textElement, container } = createBoundTextElement( - DEFAULT_TEXT, - arrow, - ); + const { + textElement, + container, + } = createBoundTextElement(DEFAULT_TEXT, arrow); const position = LinearElementEditor.getBoundTextElementPosition( container, @@ -802,10 +802,10 @@ describe("Test Linear Elements", () => { type: ROUNDNESS.PROPORTIONAL_RADIUS, }); const arrow = h.elements[0] as ExcalidrawLinearElement; - const { textElement, container } = createBoundTextElement( - DEFAULT_TEXT, - arrow, - ); + const { + textElement, + container, + } = createBoundTextElement(DEFAULT_TEXT, arrow); enterLineEditingMode(container); // This is the expected midpoint for line with round edge // hence hardcoding it so if later some bug is introduced @@ -930,10 +930,10 @@ describe("Test Linear Elements", () => { const arrow = h.elements[0] as ExcalidrawLinearElement; - const { textElement, container } = createBoundTextElement( - DEFAULT_TEXT, - arrow, - ); + const { + textElement, + container, + } = createBoundTextElement(DEFAULT_TEXT, arrow); expect(container.angle).toBe(0); expect(textElement.angle).toBe(0); @@ -996,10 +996,10 @@ describe("Test Linear Elements", () => { const arrow = h.elements[0] as ExcalidrawLinearElement; - const { textElement, container } = createBoundTextElement( - DEFAULT_TEXT, - arrow, - ); + const { + textElement, + container, + } = createBoundTextElement(DEFAULT_TEXT, arrow); expect(container.width).toBe(70); expect(container.height).toBe(50); expect(getBoundTextElementPosition(container, textElement)) @@ -1065,10 +1065,10 @@ describe("Test Linear Elements", () => { createTwoPointerLinearElement("arrow"); const arrow = h.elements[0] as ExcalidrawLinearElement; - const { textElement, container } = createBoundTextElement( - DEFAULT_TEXT, - arrow, - ); + const { + textElement, + container, + } = createBoundTextElement(DEFAULT_TEXT, arrow); expect(container.width).toBe(40); expect(getBoundTextElementPosition(container, textElement)) .toMatchInlineSnapshot(` diff --git ORI/excalidraw/src/tests/regressionTests.test.tsx ALT/excalidraw/src/tests/regressionTests.test.tsx index 2b90948..81c2bfe 100644 --- ORI/excalidraw/src/tests/regressionTests.test.tsx +++ ALT/excalidraw/src/tests/regressionTests.test.tsx @@ -928,10 +928,14 @@ describe("regression tests", () => { expect(API.getSelectedElements().length).toBe(2); - const { x: firstElementPrevX, y: firstElementPrevY } = - API.getSelectedElements()[0]; - const { x: secondElementPrevX, y: secondElementPrevY } = - API.getSelectedElements()[1]; + const { + x: firstElementPrevX, + y: firstElementPrevY, + } = API.getSelectedElements()[0]; + const { + x: secondElementPrevX, + y: secondElementPrevY, + } = API.getSelectedElements()[1]; // drag elements from point on common bounding box that doesn't hit any of the elements mouse.reset(); ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: prettier/prettier@2bd131fbd29e94e989e64904f1a628877d38ae3d

Diff (432 lines) ```diff diff --git ORI/prettier/scripts/benchmark/bench.js ALT/prettier/scripts/benchmark/bench.js index 59bc10c..455fbc9 100644 --- ORI/prettier/scripts/benchmark/bench.js +++ ALT/prettier/scripts/benchmark/bench.js @@ -1,7 +1,13 @@ import { readFileSync } from "node:fs"; -const [, , version, method, groupCountString = 100, groupSizeString = 10] = - process.argv; +const [ + , + , + version, + method, + groupCountString = 100, + groupSizeString = 10, +] = process.argv; const groupCount = Number(groupCountString); const groupSize = Number(groupSizeString); const { format } = await import(`./${version}/dist/index.mjs`); diff --git ORI/prettier/scripts/build/config.js ALT/prettier/scripts/build/config.js index 0d74ae4..fd95027 100644 --- ORI/prettier/scripts/build/config.js +++ ALT/prettier/scripts/build/config.js @@ -415,8 +415,13 @@ const nonPluginUniversalFiles = [ const universalFiles = [...nonPluginUniversalFiles, ...pluginFiles].flatMap( (file) => { - let { input, outputBaseName, umdVariableName, buildOptions, isPlugin } = - file; + let { + input, + outputBaseName, + umdVariableName, + buildOptions, + isPlugin, + } = file; outputBaseName ??= path.basename(input); diff --git ORI/prettier/scripts/build/esbuild-plugins/replace-module.js ALT/prettier/scripts/build/esbuild-plugins/replace-module.js index fa6da59..1b367b9 100644 --- ORI/prettier/scripts/build/esbuild-plugins/replace-module.js +++ ALT/prettier/scripts/build/esbuild-plugins/replace-module.js @@ -192,8 +192,11 @@ export default function esbuildPluginReplaceModule({ onResolveConcepts = DEFAULT_ON_RESOLVE_CONCEPTS, replacements, }) { - const { onResolveReplacements, onLoadReplacements, onLoadProcessors } = - processReplacements(replacements); + const { + onResolveReplacements, + onLoadReplacements, + onLoadProcessors, + } = processReplacements(replacements); const onResolveListenerOptions = { concepts: onResolveConcepts, replacements: onResolveReplacements, diff --git ORI/prettier/scripts/clean-cspell.js ALT/prettier/scripts/clean-cspell.js index 24752b3..6bcf7a6 100644 --- ORI/prettier/scripts/clean-cspell.js +++ ALT/prettier/scripts/clean-cspell.js @@ -7,7 +7,11 @@ const CSPELL_CONFIG_FILE = new URL("../cspell.json", import.meta.url); const updateConfig = (config) => fs.writeFile(CSPELL_CONFIG_FILE, JSON.stringify(config, undefined, 4) + "\n"); const runSpellcheck = (options) => { - const { yarnArgs, args, execaOptions } = { + const { + yarnArgs, + args, + execaOptions, + } = { yarnArgs: [], args: [], ...options, diff --git ORI/prettier/scripts/release/release.js ALT/prettier/scripts/release/release.js index 90e650a..18dc527 100644 --- ORI/prettier/scripts/release/release.js +++ ALT/prettier/scripts/release/release.js @@ -8,7 +8,10 @@ import path from "node:path"; const directory = path.dirname(fileURLToPath(import.meta.url)); function runCommand(command) { return new Promise((resolve, reject) => { - const { stdout, stderr } = exec(command, { cwd: directory }, (error) => { + const { + stdout, + stderr, + } = exec(command, { cwd: directory }, (error) => { if (error) { reject(error); } else { diff --git ORI/prettier/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-create-type-check-function.js ALT/prettier/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-create-type-check-function.js index 65eb0aa..b5df8c6 100644 --- ORI/prettier/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-create-type-check-function.js +++ ALT/prettier/scripts/tools/eslint-plugin-prettier-internal-rules/prefer-create-type-check-function.js @@ -164,7 +164,10 @@ module.exports = { fixable: "code", }, create(context) { - const { ignoreSingleType, onlyTopLevelFunctions } = { + const { + ignoreSingleType, + onlyTopLevelFunctions, + } = { ignoreSingleType: false, onlyTopLevelFunctions: false, ...context.options[0], diff --git ORI/prettier/src/config/resolve-config.js ALT/prettier/src/config/resolve-config.js index 0473e4a..a38c3e3 100644 --- ORI/prettier/src/config/resolve-config.js +++ ALT/prettier/src/config/resolve-config.js @@ -26,7 +26,10 @@ function loadEditorConfig(filePath, options) { function loadPrettierConfig(filePath, options) { const { useCache, config: configPath } = options; - const { load, search } = getPrettierConfigExplorer({ + const { + load, + search, + } = getPrettierConfigExplorer({ cache: Boolean(useCache), }); return configPath ? load(configPath) : search(filePath); diff --git ORI/prettier/src/language-html/parser-html.js ALT/prettier/src/language-html/parser-html.js index 7efb1e9..d8ddd19 100644 --- ORI/prettier/src/language-html/parser-html.js +++ ALT/prettier/src/language-html/parser-html.js @@ -54,7 +54,10 @@ function ngHtmlParser(input, parseOptions, options) { shouldParseAsRawText, } = parseOptions; - let { rootNodes, errors } = parseHtml(input, { + let { + rootNodes, + errors, + } = parseHtml(input, { canSelfClose, allowHtmComponentClosingTags, isTagNameCaseSensitive, @@ -278,7 +281,10 @@ function parse( options = {}, shouldParseFrontMatter = true, ) { - const { frontMatter, content } = shouldParseFrontMatter + const { + frontMatter, + content, + } = shouldParseFrontMatter ? parseFrontMatter(text) : { frontMatter: null, content: text }; diff --git ORI/prettier/src/language-html/print-preprocess.js ALT/prettier/src/language-html/print-preprocess.js index e19ce6c..b6d1666 100644 --- ORI/prettier/src/language-html/print-preprocess.js +++ ALT/prettier/src/language-html/print-preprocess.js @@ -278,8 +278,11 @@ function extractWhitespaces(ast /*, options*/) { continue; } - const { leadingWhitespace, text, trailingWhitespace } = - getLeadingAndTrailingHtmlWhitespace(child.value); + const { + leadingWhitespace, + text, + trailingWhitespace, + } = getLeadingAndTrailingHtmlWhitespace(child.value); const prevChild = child.prev; const nextChild = child.next; diff --git ORI/prettier/src/language-js/parse/postprocess/typescript.js ALT/prettier/src/language-js/parse/postprocess/typescript.js index 4c0735e..0f8a1b7 100644 --- ORI/prettier/src/language-js/parse/postprocess/typescript.js +++ ALT/prettier/src/language-js/parse/postprocess/typescript.js @@ -11,8 +11,10 @@ function getTsNodeLocation(nodeOrToken) { // @ts-expect-error -- internal? ts.rangeOfNode(nodeOrToken); const [start, end] = [position.pos, position.end].map((position) => { - const { line, character: column } = - sourceFile.getLineAndCharacterOfPosition(position); + const { + line, + character: column, + } = sourceFile.getLineAndCharacterOfPosition(position); return { line: line + 1, column }; }); diff --git ORI/prettier/src/language-markdown/mdx.js ALT/prettier/src/language-markdown/mdx.js index 632da38..43c6ca7 100644 --- ORI/prettier/src/language-markdown/mdx.js +++ ALT/prettier/src/language-markdown/mdx.js @@ -63,8 +63,12 @@ tokenizeEsComment.locator = (value, fromIndex) => value.indexOf("{", fromIndex); function esSyntax() { const { Parser } = this; - const { blockTokenizers, blockMethods, inlineTokenizers, inlineMethods } = - Parser.prototype; + const { + blockTokenizers, + blockMethods, + inlineTokenizers, + inlineMethods, + } = Parser.prototype; blockTokenizers.esSyntax = tokenizeEsSyntax; inlineTokenizers.esComment = tokenizeEsComment; diff --git ORI/prettier/src/language-markdown/printer-markdown.js ALT/prettier/src/language-markdown/printer-markdown.js index 9deaa3e..04850db 100644 --- ORI/prettier/src/language-markdown/printer-markdown.js +++ ALT/prettier/src/language-markdown/printer-markdown.js @@ -640,8 +640,10 @@ function printRoot(path, options, print) { } function printChildren(path, options, print, events = {}) { - const { postprocessor = (parts) => parts, processor = () => print() } = - events; + const { + postprocessor = (parts) => parts, + processor = () => print(), + } = events; const parts = []; diff --git ORI/prettier/src/main/comments/attach.js ALT/prettier/src/main/comments/attach.js index 6e22482..791b5a5 100644 --- ORI/prettier/src/main/comments/attach.js +++ ALT/prettier/src/main/comments/attach.js @@ -298,8 +298,10 @@ function isOwnLineComment(text, options, decoratedComments, commentIndex) { if (precedingNode) { // Find first comment on the same line for (let index = commentIndex - 1; index >= 0; index--) { - const { comment, precedingNode: currentCommentPrecedingNode } = - decoratedComments[index]; + const { + comment, + precedingNode: currentCommentPrecedingNode, + } = decoratedComments[index]; if ( currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment), start)) @@ -325,8 +327,10 @@ function isEndOfLineComment(text, options, decoratedComments, commentIndex) { index < decoratedComments.length; index++ ) { - const { comment, followingNode: currentCommentFollowingNode } = - decoratedComments[index]; + const { + comment, + followingNode: currentCommentFollowingNode, + } = decoratedComments[index]; if ( currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment))) diff --git ORI/prettier/src/main/core.js ALT/prettier/src/main/core.js index c3fc803..4a2af37 100644 --- ORI/prettier/src/main/core.js +++ ALT/prettier/src/main/core.js @@ -217,10 +217,12 @@ function normalizeIndexes(text, options) { } function normalizeInputAndOptions(text, options) { - let { cursorOffset, rangeStart, rangeEnd, endOfLine } = normalizeIndexes( - text, - options, - ); + let { + cursorOffset, + rangeStart, + rangeEnd, + endOfLine, + } = normalizeIndexes(text, options); const hasBOM = text.charAt(0) === BOM; @@ -266,7 +268,11 @@ async function hasPragma(text, options) { } async function formatWithCursor(originalText, originalOptions) { - let { hasBOM, text, options } = normalizeInputAndOptions( + let { + hasBOM, + text, + options, + } = normalizeInputAndOptions( originalText, await normalizeFormatOptions(originalOptions), ); @@ -310,7 +316,10 @@ async function formatWithCursor(originalText, originalOptions) { } async function parse(originalText, originalOptions, devOptions) { - const { text, options } = normalizeInputAndOptions( + const { + text, + options, + } = normalizeInputAndOptions( originalText, await normalizeFormatOptions(originalOptions), ); diff --git ORI/prettier/src/main/range-util.js ALT/prettier/src/main/range-util.js index 10a2e5e..8762e9c 100644 --- ORI/prettier/src/main/range-util.js +++ ALT/prettier/src/main/range-util.js @@ -242,11 +242,10 @@ function calculateRange(text, opts, ast) { startNode = commonAncestor; endNode = commonAncestor; } else { - ({ startNode, endNode } = findSiblingAncestors( - startNodeAndParents, - endNodeAndParents, - opts, - )); + ({ + startNode, + endNode, + } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts)); } return { diff --git ORI/prettier/src/plugins/builtin-plugins-proxy.js ALT/prettier/src/plugins/builtin-plugins-proxy.js index 7d5659e..e9515f2 100644 --- ORI/prettier/src/plugins/builtin-plugins-proxy.js +++ ALT/prettier/src/plugins/builtin-plugins-proxy.js @@ -71,7 +71,10 @@ export const languages = [ ]; // Lazy load the plugins -export const { parsers, printers } = createParsersAndPrinters([ +export const { + parsers, + printers, +} = createParsersAndPrinters([ { importPlugin: () => import("./acorn.js"), parsers: ["acorn", "espree"], diff --git ORI/prettier/tests/config/format-test.js ALT/prettier/tests/config/format-test.js index 98558a1..07d11d1 100644 --- ORI/prettier/tests/config/format-test.js +++ ALT/prettier/tests/config/format-test.js @@ -144,9 +144,10 @@ const ensurePromise = (value) => { }; function runSpec(fixtures, parsers, options) { - let { importMeta, snippets = [] } = fixtures.importMeta - ? fixtures - : { importMeta: fixtures }; + let { + importMeta, + snippets = [], + } = fixtures.importMeta ? fixtures : { importMeta: fixtures }; const dirname = path.dirname(url.fileURLToPath(importMeta.url)); // `IS_PARSER_INFERENCE_TESTS` mean to test `inferParser` on `standalone` @@ -502,16 +503,17 @@ const insertCursor = (text, cursorOffset) => text.slice(cursorOffset) : text; async function format(originalText, originalOptions) { - const { text: input, options } = replacePlaceholders( - originalText, - originalOptions, - ); + const { + text: input, + options, + } = replacePlaceholders(originalText, originalOptions); const inputWithCursor = insertCursor(input, options.cursorOffset); const prettier = await getPrettier(); - const { formatted: output, cursorOffset } = await ensurePromise( - prettier.formatWithCursor(input, options), - ); + const { + formatted: output, + cursorOffset, + } = await ensurePromise(prettier.formatWithCursor(input, options)); const outputWithCursor = insertCursor(output, cursorOffset); const eolVisualizedOutput = visualizeEndOfLine(outputWithCursor); diff --git ORI/prettier/tests/integration/__tests__/line-suffix-boundary.js ALT/prettier/tests/integration/__tests__/line-suffix-boundary.js index 15ba376..255dd28 100644 --- ORI/prettier/tests/integration/__tests__/line-suffix-boundary.js +++ ALT/prettier/tests/integration/__tests__/line-suffix-boundary.js @@ -3,8 +3,14 @@ import { outdent } from "outdent"; import prettier from "../../config/prettier-entry.js"; import printDoc from "../print-doc.js"; -const { group, indent, line, lineSuffix, lineSuffixBoundary, softline } = - prettier.doc.builders; +const { + group, + indent, + line, + lineSuffix, + lineSuffixBoundary, + softline, +} = prettier.doc.builders; describe("lineSuffixBoundary", () => { test("should be correctly treated as a potential line break in `fits`", async () => { diff --git ORI/prettier/tests/integration/__tests__/mockable.js ALT/prettier/tests/integration/__tests__/mockable.js index 2018bd1..e88aa55 100644 --- ORI/prettier/tests/integration/__tests__/mockable.js +++ ALT/prettier/tests/integration/__tests__/mockable.js @@ -45,8 +45,10 @@ describe("cosmiconfig", () => { for (const { title, dirname, file, value } of configs) { test(`async version ${title}`, async () => { - const { config, filepath } = - await cosmiconfig("prettier").search(dirname); + const { + config, + filepath, + } = await cosmiconfig("prettier").search(dirname); expect(config).toEqual(value); expect(filepath).toBe(file); }); diff --git ORI/prettier/tests/integration/__tests__/util-shared.js ALT/prettier/tests/integration/__tests__/util-shared.js index 16d1eb2..0e93eef 100644 --- ORI/prettier/tests/integration/__tests__/util-shared.js +++ ALT/prettier/tests/integration/__tests__/util-shared.js @@ -164,8 +164,11 @@ test("sharedUtil.getNextNonSpaceNonCommentCharacter and sharedUtil.getNextNonSpa }); test("sharedUtil.isPreviousLineEmpty, sharedUtil.isNextLineEmpty and sharedUtil.isNextLineEmptyAfterIndex", () => { - const { isPreviousLineEmpty, isNextLineEmpty, isNextLineEmptyAfterIndex } = - sharedUtil; + const { + isPreviousLineEmpty, + isNextLineEmpty, + isNextLineEmptyAfterIndex, + } = sharedUtil; const FAKE_NODE_A = { type: "Identifier", name: "a" }; const FAKE_NODE_B = { type: "Identifier", name: "b" }; ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: typescript-eslint/typescript-eslint@4bf2d7360eaf74c9ef87b196ff4c459b8f50800b

Diff (760 lines) ```diff diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts index 0c671d8..c942180 100644 --- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts +++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts @@ -51,8 +51,10 @@ export default createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); + const { + program, + esTreeNodeToTSNodeMap, + } = ESLintUtils.getParserServices(context); const checker = program.getTypeChecker(); return { diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index 313a32e..143c1e6 100644 --- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -148,8 +148,10 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); + const { + program, + esTreeNodeToTSNodeMap, + } = ESLintUtils.getParserServices(context); const checker = program.getTypeChecker(); const checkedObjects = new Set(); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 5436405..69bbaa9 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -270,8 +270,12 @@ function* fixSeparateNamedExports( sourceCode: Readonly, report: ReportValueExport, ): IterableIterator { - const { node, typeBasedSpecifiers, inlineTypeSpecifiers, valueSpecifiers } = - report; + const { + node, + typeBasedSpecifiers, + inlineTypeSpecifiers, + valueSpecifiers, + } = report; const typeSpecifiers = typeBasedSpecifiers.concat(inlineTypeSpecifiers); const source = getSourceFromExport(node); const specifierNames = typeSpecifiers.map(getSpecifierText).join(', '); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 4c5cf77..864570c 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -478,10 +478,10 @@ export default util.createRule({ namedSpecifierGroups.push(group); } for (const namedSpecifiers of namedSpecifierGroups) { - const { removeRange, textRange } = getNamedSpecifierRanges( - namedSpecifiers, - allNamedSpecifiers, - ); + const { + removeRange, + textRange, + } = getNamedSpecifierRanges(namedSpecifiers, allNamedSpecifiers); removeTypeNamedSpecifiers.push(fixer.removeRange(removeRange)); typeNamedSpecifiersTexts.push(sourceCode.text.slice(...textRange)); @@ -610,8 +610,11 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = - classifySpecifier(node); + const { + defaultSpecifier, + namespaceSpecifier, + namedSpecifiers, + } = classifySpecifier(node); if (namespaceSpecifier && !defaultSpecifier) { // import * as types from 'foo' @@ -854,8 +857,11 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = - classifySpecifier(node); + const { + defaultSpecifier, + namespaceSpecifier, + namedSpecifiers, + } = classifySpecifier(node); if (namespaceSpecifier) { // import type * as types from 'foo' diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts index 2b10c97..a80633a 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -201,8 +201,9 @@ export default util.createRule({ function findVariablesInScope(scope: TSESLint.Scope.Scope): void { for (const variable of scope.variables) { - const [declaration, ...extraDeclarations] = - iterateDeclarations(variable); + const [declaration, ...extraDeclarations] = iterateDeclarations( + variable, + ); if (extraDeclarations.length === 0) { continue; diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index 1415742..90f40ae 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -239,10 +239,9 @@ export default util.createRule({ { messageId: 'suggestNullish', fix(fixer: TSESLint.RuleFixer): TSESLint.RuleFix { - const [left, right] = - operator === '===' || operator === '==' - ? [node.alternate, node.consequent] - : [node.consequent, node.alternate]; + const [left, right] = operator === '===' || operator === '==' + ? [node.alternate, node.consequent] + : [node.consequent, node.alternate]; return fixer.replaceText( node, `${sourceCode.text.slice( diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index efccc2c..7b35f7b 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -157,7 +157,10 @@ export default util.createRule({ ) { break; } - const { rightText, shouldBreak } = breakIfInvalid({ + const { + rightText, + shouldBreak, + } = breakIfInvalid({ rightNode: current.right.argument, previousLeftText, }); @@ -241,7 +244,10 @@ export default util.createRule({ ) { break; } - const { rightText, shouldBreak } = breakIfInvalid({ + const { + rightText, + shouldBreak, + } = breakIfInvalid({ rightNode: current.right, previousLeftText, }); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts index 3a9e6cd..e43e2cd 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -191,8 +191,10 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); for (const violatingNode of finalizedClassScope.finalizeUnmodifiedPrivateNonReadonlys()) { - const { esNode, nameNode } = - getEsNodesFromViolatingNode(violatingNode); + const { + esNode, + nameNode, + } = getEsNodesFromViolatingNode(violatingNode); context.report({ data: { name: sourceCode.getText(nameNode), diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/unbound-method.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/unbound-method.ts index 6741f4d..1dfc03d 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/unbound-method.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/unbound-method.ts @@ -212,10 +212,10 @@ export default util.createRule({ 'VariableDeclarator, AssignmentExpression'( node: TSESTree.VariableDeclarator | TSESTree.AssignmentExpression, ): void { - const [idNode, initNode] = - node.type === AST_NODE_TYPES.VariableDeclarator - ? [node.id, node.init] - : [node.left, node.right]; + const [idNode, initNode] = node.type === + AST_NODE_TYPES.VariableDeclarator + ? [node.id, node.init] + : [node.left, node.right]; if (initNode && idNode.type === AST_NODE_TYPES.ObjectPattern) { const tsNode = parserServices.esTreeNodeToTSNodeMap.get(initNode); diff --git ORI/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts ALT/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts index 0b7da71..6fde9d6 100644 --- ORI/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts +++ ALT/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts @@ -95,8 +95,11 @@ async function main(): Promise { ['Rule', 'Status', 'Ext', 'R', 'RWT', 'Strict', 'Comment'], ...Object.entries(rules).map(([ruleName, { meta }]) => { const { deprecated } = meta; - const { extendsBaseRule, recommended, requiresTypeChecking } = - meta.docs!; + const { + extendsBaseRule, + recommended, + requiresTypeChecking, + } = meta.docs!; return [ `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, diff --git ORI/typescript-eslint/packages/scope-manager/tests/types/reference-type.test.ts ALT/typescript-eslint/packages/scope-manager/tests/types/reference-type.test.ts index 1ede048..13abad5 100644 --- ORI/typescript-eslint/packages/scope-manager/tests/types/reference-type.test.ts +++ ALT/typescript-eslint/packages/scope-manager/tests/types/reference-type.test.ts @@ -4,7 +4,10 @@ import { getSpecificNode, parseAndAnalyze } from '../util'; describe('referencing a type - positive', () => { it('records a reference when a type is referenced from a type', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type TypeDecl = string; type OtherType = TypeDecl; `); @@ -27,7 +30,10 @@ describe('referencing a type - positive', () => { }); it('records a reference when a dual value-type is referenced from a type', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` class Class {} type Type = Class; `); @@ -45,7 +51,10 @@ describe('referencing a type - positive', () => { }); it('records a reference when a generic type parameter is referenced from its type', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type TypeDecl = TypeParam; `); const node = getSpecificNode(ast, AST_NODE_TYPES.TSTypeParameter); @@ -60,7 +69,10 @@ describe('referencing a type - positive', () => { }); it('records references when a name has both a type and a variable definition', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` const dual = 1; type dual = number; @@ -103,7 +115,10 @@ describe('referencing a type - positive', () => { }); it('records value and type references to imported variables', () => { - const { ast, scopeManager } = parseAndAnalyze( + const { + ast, + scopeManager, + } = parseAndAnalyze( ` import { foo } from 'module'; const test = foo; @@ -126,7 +141,10 @@ describe('referencing a type - positive', () => { }); it('records a reference when a value is referenced from a typeof predicate', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` const value = 1; type Type = typeof value; `); @@ -149,7 +167,10 @@ describe('referencing a type - positive', () => { describe('referencing a type - negative', () => { it('does not record a reference when a value is referenced from a type without a typeof predicate', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` const value = 1; type Type = value; `); @@ -163,7 +184,10 @@ describe('referencing a type - negative', () => { }); it('does not record a reference when a type is referenced from a value', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type Type = 1; const value = Type; `); @@ -173,7 +197,10 @@ describe('referencing a type - negative', () => { }); it('does not record a reference when a type is referenced from outside its declaring type', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type TypeDecl = T; type Other = TypeParam; `); diff --git ORI/typescript-eslint/packages/scope-manager/tests/types/variable-definition.test.ts ALT/typescript-eslint/packages/scope-manager/tests/types/variable-definition.test.ts index 4ed9078..f59326f 100644 --- ORI/typescript-eslint/packages/scope-manager/tests/types/variable-definition.test.ts +++ ALT/typescript-eslint/packages/scope-manager/tests/types/variable-definition.test.ts @@ -4,7 +4,10 @@ import { getSpecificNode, parseAndAnalyze } from '../util'; describe('variable definition', () => { it('defines a variable for a type declaration', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type TypeDecl = string; `); const node = getSpecificNode(ast, AST_NODE_TYPES.TSTypeAliasDeclaration); @@ -27,7 +30,10 @@ describe('variable definition', () => { }); it('defines a variable for an interface definition', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` interface InterfaceDecl { prop: string; } @@ -52,7 +58,10 @@ describe('variable definition', () => { }); it('defines a variable for a generic type', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type TypeDecl = string; `); const node = getSpecificNode(ast, AST_NODE_TYPES.TSTypeParameter); @@ -75,7 +84,10 @@ describe('variable definition', () => { }); it('defines a variable for an inferred generic type', () => { - const { ast, scopeManager } = parseAndAnalyze(` + const { + ast, + scopeManager, + } = parseAndAnalyze(` type TypeDecl = TypeParam extends Foo ? Inferred : never; `); const node = getSpecificNode( diff --git ORI/typescript-eslint/packages/scope-manager/tools/generate-lib.ts ALT/typescript-eslint/packages/scope-manager/tools/generate-lib.ts index ffd6301..5c964d5 100644 --- ORI/typescript-eslint/packages/scope-manager/tools/generate-lib.ts +++ ALT/typescript-eslint/packages/scope-manager/tools/generate-lib.ts @@ -153,7 +153,10 @@ function main(): void { for (const [libName, filename] of libMap) { const libPath = path.join(TS_LIB_FOLDER, filename); - const { ast, scopeManager } = parseAndAnalyze( + const { + ast, + scopeManager, + } = parseAndAnalyze( fs.readFileSync(libPath, 'utf8'), { // we don't want any libs diff --git ORI/typescript-eslint/packages/type-utils/tests/isTypeReadonly.test.ts ALT/typescript-eslint/packages/type-utils/tests/isTypeReadonly.test.ts index 0b171dc..919a9c7 100644 --- ORI/typescript-eslint/packages/type-utils/tests/isTypeReadonly.test.ts +++ ALT/typescript-eslint/packages/type-utils/tests/isTypeReadonly.test.ts @@ -16,7 +16,10 @@ describe('isTypeReadonly', () => { type: ts.Type; checker: ts.TypeChecker; } { - const { ast, services } = parseForESLint(code, { + const { + ast, + services, + } = parseForESLint(code, { project: './tsconfig.json', filePath: path.join(rootDir, 'file.ts'), tsconfigRootDir: rootDir, diff --git ORI/typescript-eslint/packages/type-utils/tests/isUnsafeAssignment.test.ts ALT/typescript-eslint/packages/type-utils/tests/isUnsafeAssignment.test.ts index e49e25c..942e2a7 100644 --- ORI/typescript-eslint/packages/type-utils/tests/isUnsafeAssignment.test.ts +++ ALT/typescript-eslint/packages/type-utils/tests/isUnsafeAssignment.test.ts @@ -14,7 +14,10 @@ describe('isUnsafeAssignment', () => { receiver: ts.Type; checker: ts.TypeChecker; } { - const { ast, services } = parseForESLint(code, { + const { + ast, + services, + } = parseForESLint(code, { project: './tsconfig.json', filePath: path.join(rootDir, 'file.ts'), tsconfigRootDir: rootDir, @@ -51,9 +54,11 @@ describe('isUnsafeAssignment', () => { } it('any to a non-any', () => { - const { sender, receiver, checker } = getTypes( - 'const test: string = (1 as any);', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: string = (1 as any);'); expectTypesAre( isUnsafeAssignment(sender, receiver, checker, null), @@ -64,9 +69,11 @@ describe('isUnsafeAssignment', () => { }); it('any in a generic position to a non-any', () => { - const { sender, receiver, checker } = getTypes( - 'const test: Set = new Set();', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: Set = new Set();'); expectTypesAre( isUnsafeAssignment(sender, receiver, checker, null), @@ -77,9 +84,11 @@ describe('isUnsafeAssignment', () => { }); it('any in a generic position to a non-any (multiple generics)', () => { - const { sender, receiver, checker } = getTypes( - 'const test: Map = new Map();', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: Map = new Map();'); expectTypesAre( isUnsafeAssignment(sender, receiver, checker, null), @@ -90,9 +99,11 @@ describe('isUnsafeAssignment', () => { }); it('any[] in a generic position to a non-any[]', () => { - const { sender, receiver, checker } = getTypes( - 'const test: Set = new Set();', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: Set = new Set();'); expectTypesAre( isUnsafeAssignment(sender, receiver, checker, null), @@ -103,7 +114,11 @@ describe('isUnsafeAssignment', () => { }); it('any in a generic position to a non-any (nested)', () => { - const { sender, receiver, checker } = getTypes( + const { + sender, + receiver, + checker, + } = getTypes( 'const test: Set>> = new Set>>();', ); @@ -118,9 +133,11 @@ describe('isUnsafeAssignment', () => { describe('safe', () => { it('non-any to a non-any', () => { - const { sender, receiver, checker } = getTypes( - 'const test: string = "";', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: string = "";'); expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); @@ -132,15 +149,21 @@ describe('isUnsafeAssignment', () => { }); it('non-any in a generic position to a non-any', () => { - const { sender, receiver, checker } = getTypes( - 'const test: Set = new Set();', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: Set = new Set();'); expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any (multiple generics)', () => { - const { sender, receiver, checker } = getTypes( + const { + sender, + receiver, + checker, + } = getTypes( 'const test: Map = new Map();', ); @@ -148,15 +171,21 @@ describe('isUnsafeAssignment', () => { }); it('non-any[] in a generic position to a non-any[]', () => { - const { sender, receiver, checker } = getTypes( - 'const test: Set = new Set();', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: Set = new Set();'); expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('non-any in a generic position to a non-any (nested)', () => { - const { sender, receiver, checker } = getTypes( + const { + sender, + receiver, + checker, + } = getTypes( 'const test: Set>> = new Set>>();', ); @@ -164,7 +193,11 @@ describe('isUnsafeAssignment', () => { }); it('non-any in a generic position to a any (nested)', () => { - const { sender, receiver, checker } = getTypes( + const { + sender, + receiver, + checker, + } = getTypes( 'const test: Set>> = new Set>>();', ); @@ -172,23 +205,31 @@ describe('isUnsafeAssignment', () => { }); it('any to a unknown', () => { - const { sender, receiver, checker } = getTypes( - 'const test: unknown = [] as any;', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: unknown = [] as any;'); expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any[] in a generic position to a unknown[]', () => { - const { sender, receiver, checker } = getTypes( - 'const test: unknown[] = [] as any[]', - ); + const { + sender, + receiver, + checker, + } = getTypes('const test: unknown[] = [] as any[]'); expect(isUnsafeAssignment(sender, receiver, checker, null)).toBeFalsy(); }); it('any in a generic position to a unknown (nested)', () => { - const { sender, receiver, checker } = getTypes( + const { + sender, + receiver, + checker, + } = getTypes( 'const test: Set>> = new Set>>();', ); @@ -197,9 +238,12 @@ describe('isUnsafeAssignment', () => { // https://github.com/typescript-eslint/typescript-eslint/issues/2109 it('special cases the empty map constructor with no generics', () => { - const { sender, senderNode, receiver, checker } = getTypes( - 'const test: Map = new Map();', - ); + const { + sender, + senderNode, + receiver, + checker, + } = getTypes('const test: Map = new Map();'); expect( isUnsafeAssignment(sender, receiver, checker, senderNode), diff --git ORI/typescript-eslint/packages/typescript-estree/src/convert.ts ALT/typescript-eslint/packages/typescript-estree/src/convert.ts index 882f40a..8828e06 100644 --- ORI/typescript-eslint/packages/typescript-estree/src/convert.ts +++ ALT/typescript-eslint/packages/typescript-estree/src/convert.ts @@ -423,7 +423,10 @@ export class Converter { | ts.CallExpression | ts.NonNullExpression, ): TSESTree.ChainExpression | TSESTree.ChainElement { - const { child, isOptional } = ((): { + const { + child, + isOptional, + } = ((): { child: TSESTree.Node; isOptional: boolean; } => { diff --git ORI/typescript-eslint/packages/typescript-estree/src/create-program/createProjectProgram.ts ALT/typescript-eslint/packages/typescript-estree/src/create-program/createProjectProgram.ts index f60ae9c..34edf3b 100644 --- ORI/typescript-eslint/packages/typescript-estree/src/create-program/createProjectProgram.ts +++ ALT/typescript-eslint/packages/typescript-estree/src/create-program/createProjectProgram.ts @@ -92,10 +92,10 @@ function createProjectProgram( } if (!hasMatchedAnError) { - const [describedInclusions, describedSpecifiers] = - parseSettings.projects.length === 1 - ? ['that TSConfig does not', 'that TSConfig'] - : ['none of those TSConfigs', 'one of those TSConfigs']; + const [describedInclusions, describedSpecifiers] = parseSettings.projects + .length === 1 + ? ['that TSConfig does not', 'that TSConfig'] + : ['none of those TSConfigs', 'one of those TSConfigs']; errorLines.push( `However, ${describedInclusions} include this file. Either:`, `- Change ESLint's list of included files to not include this file`, diff --git ORI/typescript-eslint/packages/typescript-estree/src/parser.ts ALT/typescript-eslint/packages/typescript-estree/src/parser.ts index b7f8c06..cbdc53f 100644 --- ORI/typescript-eslint/packages/typescript-estree/src/parser.ts +++ ALT/typescript-eslint/packages/typescript-estree/src/parser.ts @@ -101,11 +101,10 @@ function parseWithNodeMapsInternal( /** * Convert the TypeScript AST to an ESTree-compatible one */ - const { estree, astMaps } = astConverter( - ast, - parseSettings, - shouldPreserveNodeMaps, - ); + const { + estree, + astMaps, + } = astConverter(ast, parseSettings, shouldPreserveNodeMaps); return { ast: estree as AST, @@ -195,12 +194,14 @@ function parseAndGenerateServices( (parseAndGenerateServicesCalls[options.filePath] || 0) + 1; } - const { ast, program } = - parseSettings.singleRun && - options.filePath && - parseAndGenerateServicesCalls[options.filePath] > 1 - ? createIsolatedProgram(parseSettings) - : getProgramAndAST(parseSettings, shouldProvideParserServices)!; + const { + ast, + program, + } = parseSettings.singleRun && + options.filePath && + parseAndGenerateServicesCalls[options.filePath] > 1 + ? createIsolatedProgram(parseSettings) + : getProgramAndAST(parseSettings, shouldProvideParserServices)!; /** * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve @@ -211,11 +212,10 @@ function parseAndGenerateServices( ? parseSettings.preserveNodeMaps : true; - const { estree, astMaps } = astConverter( - ast, - parseSettings, - shouldPreserveNodeMaps, - ); + const { + estree, + astMaps, + } = astConverter(ast, parseSettings, shouldPreserveNodeMaps); /** * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, diff --git ORI/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts ALT/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts index 623157e..5826594 100644 --- ORI/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts +++ ALT/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts @@ -88,8 +88,10 @@ class RuleTester extends BaseRuleTester.RuleTester { constructor(baseOptions: RuleTesterConfig) { // eslint will hard-error if you include non-standard top-level properties - const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = - baseOptions; + const { + dependencyConstraints: _, + ...baseOptionsSafeForESLint + } = baseOptions; super({ ...baseOptionsSafeForESLint, parserOptions: { diff --git ORI/typescript-eslint/packages/website/src/components/linter/WebLinter.ts ALT/typescript-eslint/packages/website/src/components/linter/WebLinter.ts index 2038e1a..34f202b 100644 --- ORI/typescript-eslint/packages/website/src/components/linter/WebLinter.ts +++ ALT/typescript-eslint/packages/website/src/components/linter/WebLinter.ts @@ -112,7 +112,10 @@ export class WebLinter { }); const tsAst = program.getSourceFile(fileName)!; - const { estree: ast, astMaps } = this.lintUtils.astConverter( + const { + estree: ast, + astMaps, + } = this.lintUtils.astConverter( tsAst, { ...parseSettings, code, jsx: isJsx }, true, ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: vega/vega-lite@c9659206602eda1d894702a2a1f5b526b9832f9f

Diff (150 lines) ```diff diff --git ORI/vega-lite/src/compile/axis/parse.ts ALT/vega-lite/src/compile/axis/parse.ts index 26524ad..e036ab8 100644 --- ORI/vega-lite/src/compile/axis/parse.ts +++ ALT/vega-lite/src/compile/axis/parse.ts @@ -276,10 +276,12 @@ function parseAxis(channel: PositionScaleChannel, model: UnitModel): AxisCompone if (hasValue && explicit) { axisComponent.set(property, value, explicit); } else { - const {configValue = undefined, configFrom = undefined} = - isAxisProperty(property) && property !== 'values' - ? getAxisConfig(property, config.style, axis.style, axisConfigs) - : {}; + const { + configValue = undefined, + configFrom = undefined + } = isAxisProperty(property) && property !== 'values' + ? getAxisConfig(property, config.style, axis.style, axisConfigs) + : {}; const hasConfigValue = configValue !== undefined; if (hasValue && !hasConfigValue) { diff --git ORI/vega-lite/src/compile/header/assemble.ts ALT/vega-lite/src/compile/header/assemble.ts index 1bc2959..a9d24f2 100644 --- ORI/vega-lite/src/compile/header/assemble.ts +++ ALT/vega-lite/src/compile/header/assemble.ts @@ -122,7 +122,14 @@ export function assembleLabelTitle( channel: FacetChannel, config: Config ) { - const {format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr} = getHeaderProperties( + const { + format, + formatType, + labelAngle, + labelAnchor, + labelOrient, + labelExpr + } = getHeaderProperties( ['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef.header, config, @@ -246,12 +253,10 @@ export function assembleLayoutTitleBand( for (const channel of FACET_CHANNELS) { const headerComponent = headerComponentIndex[channel]; if (headerComponent?.facetFieldDef) { - const {titleAnchor, titleOrient} = getHeaderProperties( - ['titleAnchor', 'titleOrient'], - headerComponent.facetFieldDef.header, - config, - channel - ); + const { + titleAnchor, + titleOrient + } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef.header, config, channel); const headerChannel = getHeaderChannel(channel, titleOrient); const band = getLayoutTitleBand(titleAnchor, headerChannel); diff --git ORI/vega-lite/src/compile/mark/encode/position-point.ts ALT/vega-lite/src/compile/mark/encode/position-point.ts index 1df089d..b494555 100644 --- ORI/vega-lite/src/compile/mark/encode/position-point.ts +++ ALT/vega-lite/src/compile/mark/encode/position-point.ts @@ -38,7 +38,10 @@ export function pointPosition( const scaleName = model.scaleName(channel); const scale = model.getScaleComponent(channel); - const {offset, offsetType} = positionOffset({ + const { + offset, + offsetType + } = positionOffset({ channel, markDef, encoding, diff --git ORI/vega-lite/src/compositemark/boxplot.ts ALT/vega-lite/src/compositemark/boxplot.ts index e047c2d..3f90d5f 100644 --- ORI/vega-lite/src/compositemark/boxplot.ts +++ ALT/vega-lite/src/compositemark/boxplot.ts @@ -398,9 +398,10 @@ function boxParams( ]; const {[continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis} = spec.encoding; - const {customTooltipWithoutAggregatedField, filteredEncoding} = filterTooltipWithAggregatedField( - oldEncodingWithoutContinuousAxis - ); + const { + customTooltipWithoutAggregatedField, + filteredEncoding + } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis); const { bins, diff --git ORI/vega-lite/src/compositemark/errorbar.ts ALT/vega-lite/src/compositemark/errorbar.ts index 527efd4..d1c0cb7 100644 --- ORI/vega-lite/src/compositemark/errorbar.ts +++ ALT/vega-lite/src/compositemark/errorbar.ts @@ -360,17 +360,21 @@ export function errorBarParams< continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark); - const {errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName} = - errorBarAggregationAndCalculation( - markDef, - continuousAxisChannelDef, - continuousAxisChannelDef2, - continuousAxisChannelDefError, - continuousAxisChannelDefError2, - inputType, - compositeMark, - config - ); + const { + errorBarSpecificAggregate, + postAggregateCalculates, + tooltipSummary, + tooltipTitleWithFieldName + } = errorBarAggregationAndCalculation( + markDef, + continuousAxisChannelDef, + continuousAxisChannelDef2, + continuousAxisChannelDefError, + continuousAxisChannelDefError2, + inputType, + compositeMark, + config + ); const { [continuousAxis]: oldContinuousAxisChannelDef, diff --git ORI/vega-lite/src/scale.ts ALT/vega-lite/src/scale.ts index c90e7b1..898da54 100644 --- ORI/vega-lite/src/scale.ts +++ ALT/vega-lite/src/scale.ts @@ -754,8 +754,15 @@ const SCALE_PROPERTY_INDEX: Flag> = { export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX); -const {type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX} = - SCALE_PROPERTY_INDEX; +const { + type, + domain, + range, + rangeMax, + rangeMin, + scheme, + ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX +} = SCALE_PROPERTY_INDEX; export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); ```
fisker commented 9 months ago

Run #15447

github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: babel/babel@134aa1723c6aa01a42713e379142088b30c6cc0d

Diff (281 lines) ```diff diff --git ORI/babel/packages/babel-generator/src/index.ts ALT/babel/packages/babel-generator/src/index.ts index 4807342a..0bf82f9b 100644 --- ORI/babel/packages/babel-generator/src/index.ts +++ ALT/babel/packages/babel-generator/src/index.ts @@ -110,8 +110,11 @@ function normalizeOptions( format.indent.adjustMultilineComment = false; } - const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } = - format; + const { + auxiliaryCommentBefore, + auxiliaryCommentAfter, + shouldPrintComment, + } = format; if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { format.auxiliaryCommentBefore = undefined; 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 795c0bd1..25936371 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 @@ -247,23 +247,12 @@ export function createClassFeaturePlugin({ )); } else { keysNodes = extractComputedKeys(path, computedPaths, file); - ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = - buildFieldsInitNodes( - ref, - path.node.superClass, - props, - privateNamesMap, - file, - setPublicClassFields ?? loose, - privateFieldsAsSymbolsOrProperties ?? loose, - constantSuper ?? loose, - innerBinding, - )); - } - } else { - keysNodes = extractComputedKeys(path, computedPaths, file); - ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = - buildFieldsInitNodes( + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( ref, path.node.superClass, props, @@ -274,6 +263,25 @@ export function createClassFeaturePlugin({ constantSuper ?? loose, innerBinding, )); + } + } else { + keysNodes = extractComputedKeys(path, computedPaths, file); + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( + ref, + path.node.superClass, + props, + privateNamesMap, + file, + setPublicClassFields ?? loose, + privateFieldsAsSymbolsOrProperties ?? loose, + constantSuper ?? loose, + innerBinding, + )); } if (instanceNodes.length > 0) { 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 fecc1ddf..a00a8aac 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 @@ -270,8 +270,13 @@ const buildImportThrow = (localName: string) => { const rewriteReferencesVisitor: Visitor = { ReferencedIdentifier(path) { - const { seen, buildImportReference, scope, imported, requeueInParent } = - this; + const { + seen, + buildImportReference, + scope, + imported, + requeueInParent, + } = this; if (seen.has(path.node)) return; seen.add(path.node); diff --git ORI/babel/packages/babel-parser/src/plugins/flow/index.ts ALT/babel/packages/babel-parser/src/plugins/flow/index.ts index 55cceae8..48ceed32 100644 --- ORI/babel/packages/babel-parser/src/plugins/flow/index.ts +++ ALT/babel/packages/babel-parser/src/plugins/flow/index.ts @@ -437,8 +437,10 @@ export default (superClass: typeof Parser) => typeNode.this = tmp._this; this.expect(tt.parenR); - [typeNode.returnType, node.predicate] = - this.flowParseTypeAndPredicateInitialiser(); + [ + typeNode.returnType, + node.predicate, + ] = this.flowParseTypeAndPredicateInitialiser(); typeContainer.typeAnnotation = this.finishNode( typeNode, diff --git ORI/babel/packages/babel-parser/src/tokenizer/index.ts ALT/babel/packages/babel-parser/src/tokenizer/index.ts index 8750a3cf..82ec1c56 100644 --- ORI/babel/packages/babel-parser/src/tokenizer/index.ts +++ ALT/babel/packages/babel-parser/src/tokenizer/index.ts @@ -1340,15 +1340,20 @@ export default abstract class Tokenizer extends CommentsParser { // Reads template string tokens. readTemplateToken(): void { const opening = this.input[this.state.pos]; - const { str, firstInvalidLoc, pos, curLine, lineStart } = - readStringContents( - "template", - this.input, - this.state.pos + 1, // skip '`' or `}` - this.state.lineStart, - this.state.curLine, - this.errorHandlers_readStringContents_template, - ); + const { + str, + firstInvalidLoc, + pos, + curLine, + lineStart, + } = readStringContents( + "template", + this.input, + this.state.pos + 1, // skip '`' or `}` + this.state.lineStart, + this.state.curLine, + this.errorHandlers_readStringContents_template, + ); this.state.pos = pos + 1; // skip '`' or `$` this.state.lineStart = lineStart; this.state.curLine = curLine; diff --git ORI/babel/packages/babel-parser/src/util/class-scope.ts ALT/babel/packages/babel-parser/src/util/class-scope.ts index a3c852ff..8c886985 100644 --- ORI/babel/packages/babel-parser/src/util/class-scope.ts +++ ALT/babel/packages/babel-parser/src/util/class-scope.ts @@ -64,8 +64,11 @@ export default class ClassScopeHandler { elementType: ClassElementTypes, loc: Position, ) { - const { privateNames, loneAccessors, undefinedPrivateNames } = - this.current(); + const { + privateNames, + loneAccessors, + undefinedPrivateNames, + } = this.current(); let redefined = privateNames.has(name); if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) { diff --git ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts index 5888fd1f..17d9a8cb 100644 --- ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts +++ ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts @@ -49,8 +49,10 @@ export default declare(function ({ assertVersion, assumption, types: t }) { ? -1 : params.findIndex(param => param.type === "AssignmentPattern"); const paramsAfterIndex = params.splice(firstPrivateIndex); - const { params: transformedParams, variableDeclaration } = - buildVariableDeclarationFromParams(paramsAfterIndex, scope); + const { + params: transformedParams, + variableDeclaration, + } = buildVariableDeclarationFromParams(paramsAfterIndex, scope); (path.get("body") as NodePath).unshiftContainer( "body", diff --git ORI/babel/packages/babel-plugin-transform-block-scoping/src/index.ts ALT/babel/packages/babel-plugin-transform-block-scoping/src/index.ts index 80195171..dc710a84 100644 --- ORI/babel/packages/babel-plugin-transform-block-scoping/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-block-scoping/src/index.ts @@ -81,8 +81,11 @@ export default declare((api, opts: Options) => { headScope.crawl(); binding = headScope.getOwnBinding(name); } - const { usages, capturedInClosure, hasConstantViolations } = - getUsageInBody(binding, path); + const { + usages, + capturedInClosure, + hasConstantViolations, + } = getUsageInBody(binding, path); if ( headScope.parent.hasBinding(name) || diff --git ORI/babel/packages/babel-plugin-transform-modules-amd/src/index.ts ALT/babel/packages/babel-plugin-transform-modules-amd/src/index.ts index b46dff0e..c3e33544 100644 --- ORI/babel/packages/babel-plugin-transform-modules-amd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-amd/src/index.ts @@ -63,8 +63,13 @@ type State = { export default declare((api, options: Options) => { api.assertVersion(7); - const { allowTopLevelThis, strict, strictMode, importInterop, noInterop } = - options; + const { + allowTopLevelThis, + strict, + strictMode, + importInterop, + noInterop, + } = options; const constantReexports = api.assumption("constantReexports") ?? options.loose; 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 b0169e30..dd3a05fc 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 @@ -435,12 +435,15 @@ export default declare((api, opts: Options) => { path => path.isObjectPattern(), ); - const [impureComputedPropertyDeclarators, argument, callExpression] = - createObjectRest( - objectPatternPath, - file, - ref as t.MemberExpression, - ); + const [ + impureComputedPropertyDeclarators, + argument, + callExpression, + ] = createObjectRest( + objectPatternPath, + file, + ref as t.MemberExpression, + ); if (pureGetters) { removeUnusedExcludedKeys(objectPatternPath); @@ -517,8 +520,11 @@ export default declare((api, opts: Options) => { ]), ); - const [impureComputedPropertyDeclarators, argument, callExpression] = - createObjectRest(leftPath, file, t.identifier(refName)); + const [ + impureComputedPropertyDeclarators, + argument, + callExpression, + ] = createObjectRest(leftPath, file, t.identifier(refName)); if (impureComputedPropertyDeclarators.length > 0) { nodes.push( diff --git ORI/babel/packages/babel-traverse/src/path/conversion.ts ALT/babel/packages/babel-traverse/src/path/conversion.ts index a87be3c2..9a9eed98 100644 --- ORI/babel/packages/babel-traverse/src/path/conversion.ts +++ ALT/babel/packages/babel-traverse/src/path/conversion.ts @@ -288,8 +288,13 @@ function hoistFunctionEnvironment( } } - const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } = - getScopeInformation(fnPath); + const { + thisPaths, + argumentsPaths, + newTargetPaths, + superProps, + superCalls, + } = getScopeInformation(fnPath); // Convert all super() calls in the constructor, if super is used in an arrow. if (inConstructor && superCalls.length > 0) { ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: mdn/content@c5dd9c3b9d503a56dc04b6b8f88e89194dc82d7f

The diff is empty.

github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: vuejs/eslint-plugin-vue@2aa9ac45a4ea66c293b3e7cbfd6ad076afa39bb5

Diff (63 lines) ```diff diff --git ORI/eslint-plugin-vue/lib/rules/attributes-order.js ALT/eslint-plugin-vue/lib/rules/attributes-order.js index e6915ae..8cad039 100644 --- ORI/eslint-plugin-vue/lib/rules/attributes-order.js +++ ALT/eslint-plugin-vue/lib/rules/attributes-order.js @@ -326,8 +326,10 @@ function create(context) { return } - let { attr: previousNode, position: previousPosition } = - attributeAndPositions[0] + let { + attr: previousNode, + position: previousPosition + } = attributeAndPositions[0] for (let index = 1; index < attributeAndPositions.length; index++) { const { attr, position } = attributeAndPositions[index] diff --git ORI/eslint-plugin-vue/lib/rules/v-on-handler-style.js ALT/eslint-plugin-vue/lib/rules/v-on-handler-style.js index aa1214e..a3ddf63 100644 --- ORI/eslint-plugin-vue/lib/rules/v-on-handler-style.js +++ ALT/eslint-plugin-vue/lib/rules/v-on-handler-style.js @@ -278,8 +278,10 @@ module.exports = { * @returns {boolean} Returns `true` if reported. */ function verifyCanUseMethodHandlerForInlineHandler(node) { - const { rangeWithoutQuotes, hasComment } = - getVExpressionContainerTokenInfo(node.parent) + const { + rangeWithoutQuotes, + hasComment + } = getVExpressionContainerTokenInfo(node.parent) if (ignoreIncludesComment && hasComment) { return false } @@ -326,10 +328,12 @@ module.exports = { * @returns {boolean} Returns `true` if reported. */ function verifyCanUseMethodHandlerForInlineFunction(node) { - const { rangeWithoutQuotes, hasComment } = - getVExpressionContainerTokenInfo( - /** @type {VExpressionContainer} */ (node.parent) - ) + const { + rangeWithoutQuotes, + hasComment + } = getVExpressionContainerTokenInfo( + /** @type {VExpressionContainer} */ (node.parent) + ) if (ignoreIncludesComment && hasComment) { return false } @@ -420,8 +424,10 @@ module.exports = { /* The statements contains $event and cannot be fixed. */ return } - const { rangeWithoutQuotes, hasQuote } = - getVExpressionContainerTokenInfo(node.parent) + const { + rangeWithoutQuotes, + hasQuote + } = getVExpressionContainerTokenInfo(node.parent) if (!hasQuote) { /* The statements is not enclosed in quotes and cannot be fixed. */ return ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: excalidraw/excalidraw@3ddcc48e4c192f525930e503b3e9214627f0043d

Diff (527 lines) ```diff diff --git ORI/excalidraw/src/actions/actionDeleteSelected.tsx ALT/excalidraw/src/actions/actionDeleteSelected.tsx index b0486e0..02d5128 100644 --- ORI/excalidraw/src/actions/actionDeleteSelected.tsx +++ ALT/excalidraw/src/actions/actionDeleteSelected.tsx @@ -143,8 +143,10 @@ export const actionDeleteSelected = register({ commitToHistory: true, }; } - let { elements: nextElements, appState: nextAppState } = - deleteSelectedElements(elements, appState); + let { + elements: nextElements, + appState: nextAppState, + } = deleteSelectedElements(elements, appState); fixBindingsAfterDeletion( nextElements, elements.filter(({ id }) => appState.selectedElementIds[id]), diff --git ORI/excalidraw/src/actions/actionFinalize.tsx ALT/excalidraw/src/actions/actionFinalize.tsx index d7147c5..e708229 100644 --- ORI/excalidraw/src/actions/actionFinalize.tsx +++ ALT/excalidraw/src/actions/actionFinalize.tsx @@ -21,8 +21,11 @@ export const actionFinalize = register({ trackEvent: false, perform: (elements, appState, _, { canvas, focusContainer, scene }) => { if (appState.editingLinearElement) { - const { elementId, startBindingElement, endBindingElement } = - appState.editingLinearElement; + const { + elementId, + startBindingElement, + endBindingElement, + } = appState.editingLinearElement; const element = LinearElementEditor.getElement(elementId); if (element) { diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx index b5abc44..102f398 100644 --- ORI/excalidraw/src/components/App.tsx +++ ALT/excalidraw/src/components/App.tsx @@ -3619,22 +3619,26 @@ class App extends React.Component { this.state.gridSize, ); - const [lastCommittedX, lastCommittedY] = - multiElement?.lastCommittedPoint ?? [0, 0]; + const [ + lastCommittedX, + lastCommittedY, + ] = multiElement?.lastCommittedPoint ?? [0, 0]; let dxFromLastCommitted = gridX - rx - lastCommittedX; let dyFromLastCommitted = gridY - ry - lastCommittedY; if (shouldRotateWithDiscreteAngle(event)) { - ({ width: dxFromLastCommitted, height: dyFromLastCommitted } = - getLockedLinearCursorAlignSize( - // actual coordinate of the last committed point - lastCommittedX + rx, - lastCommittedY + ry, - // cursor-grid coordinate - gridX, - gridY, - )); + ({ + width: dxFromLastCommitted, + height: dyFromLastCommitted, + } = getLockedLinearCursorAlignSize( + // actual coordinate of the last committed point + lastCommittedX + rx, + lastCommittedY + ry, + // cursor-grid coordinate + gridX, + gridY, + )); } if (isPathALoop(points, this.state.zoom.value)) { @@ -5700,8 +5704,10 @@ class App extends React.Component { this.state, ); - const { startBindingElement, endBindingElement } = - linearElementEditor; + const { + startBindingElement, + endBindingElement, + } = linearElementEditor; const element = this.scene.getElement(linearElementEditor.elementId); if (isBindingElement(element)) { bindOrUnbindLinearElement( @@ -7025,8 +7031,10 @@ class App extends React.Component { const type = element || isHittignCommonBoundBox ? "element" : "canvas"; const container = this.excalidrawContainerRef.current!; - const { top: offsetTop, left: offsetLeft } = - container.getBoundingClientRect(); + const { + top: offsetTop, + left: offsetLeft, + } = container.getBoundingClientRect(); const left = event.clientX - offsetLeft; const top = event.clientY - offsetTop; diff --git ORI/excalidraw/src/components/LibraryMenuHeaderContent.tsx ALT/excalidraw/src/components/LibraryMenuHeaderContent.tsx index 56c8fe6..9afb631 100644 --- ORI/excalidraw/src/components/LibraryMenuHeaderContent.tsx +++ ALT/excalidraw/src/components/LibraryMenuHeaderContent.tsx @@ -95,8 +95,9 @@ export const LibraryDropdownMenuButton: React.FC<{ ? t("buttons.remove") : t("buttons.resetLibrary"); - const [showPublishLibraryDialog, setShowPublishLibraryDialog] = - useState(false); + const [showPublishLibraryDialog, setShowPublishLibraryDialog] = useState( + false, + ); const [publishLibSuccess, setPublishLibSuccess] = useState { - const { - width = 512, - height = width, - mirror, - style, - ...rest - } = typeof opts === "number" ? ({ width: opts } as Opts) : opts; + const { width = 512, height = width, mirror, style, ...rest } = + typeof opts === "number" ? ({ width: opts } as Opts) : opts; return (
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: prettier/prettier@2bd131fbd29e94e989e64904f1a628877d38ae3d

Diff (228 lines) ```diff diff --git ORI/prettier/scripts/benchmark/bench.js ALT/prettier/scripts/benchmark/bench.js index 59bc10c..455fbc9 100644 --- ORI/prettier/scripts/benchmark/bench.js +++ ALT/prettier/scripts/benchmark/bench.js @@ -1,7 +1,13 @@ import { readFileSync } from "node:fs"; -const [, , version, method, groupCountString = 100, groupSizeString = 10] = - process.argv; +const [ + , + , + version, + method, + groupCountString = 100, + groupSizeString = 10, +] = process.argv; const groupCount = Number(groupCountString); const groupSize = Number(groupSizeString); const { format } = await import(`./${version}/dist/index.mjs`); diff --git ORI/prettier/scripts/build/config.js ALT/prettier/scripts/build/config.js index 0d74ae4..3fc693b 100644 --- ORI/prettier/scripts/build/config.js +++ ALT/prettier/scripts/build/config.js @@ -11,11 +11,9 @@ import buildTypes from "./build-types.js"; import modifyTypescriptModule from "./modify-typescript-module.js"; import { getPackageFile } from "./utils.js"; -const { - require, - dirname, - resolve: importMetaResolve, -} = createEsmUtils(import.meta); +const { require, dirname, resolve: importMetaResolve } = createEsmUtils( + import.meta, +); const resolveEsmModulePath = async (specifier) => url.fileURLToPath(await importMetaResolve(specifier)); const copyFileBuilder = ({ file }) => @@ -415,8 +413,13 @@ const nonPluginUniversalFiles = [ const universalFiles = [...nonPluginUniversalFiles, ...pluginFiles].flatMap( (file) => { - let { input, outputBaseName, umdVariableName, buildOptions, isPlugin } = - file; + let { + input, + outputBaseName, + umdVariableName, + buildOptions, + isPlugin, + } = file; outputBaseName ??= path.basename(input); diff --git ORI/prettier/scripts/build/esbuild-plugins/replace-module.js ALT/prettier/scripts/build/esbuild-plugins/replace-module.js index fa6da59..1b367b9 100644 --- ORI/prettier/scripts/build/esbuild-plugins/replace-module.js +++ ALT/prettier/scripts/build/esbuild-plugins/replace-module.js @@ -192,8 +192,11 @@ export default function esbuildPluginReplaceModule({ onResolveConcepts = DEFAULT_ON_RESOLVE_CONCEPTS, replacements, }) { - const { onResolveReplacements, onLoadReplacements, onLoadProcessors } = - processReplacements(replacements); + const { + onResolveReplacements, + onLoadReplacements, + onLoadProcessors, + } = processReplacements(replacements); const onResolveListenerOptions = { concepts: onResolveConcepts, replacements: onResolveReplacements, diff --git ORI/prettier/src/language-html/print-preprocess.js ALT/prettier/src/language-html/print-preprocess.js index e19ce6c..b6d1666 100644 --- ORI/prettier/src/language-html/print-preprocess.js +++ ALT/prettier/src/language-html/print-preprocess.js @@ -278,8 +278,11 @@ function extractWhitespaces(ast /*, options*/) { continue; } - const { leadingWhitespace, text, trailingWhitespace } = - getLeadingAndTrailingHtmlWhitespace(child.value); + const { + leadingWhitespace, + text, + trailingWhitespace, + } = getLeadingAndTrailingHtmlWhitespace(child.value); const prevChild = child.prev; const nextChild = child.next; diff --git ORI/prettier/src/language-js/parse/postprocess/typescript.js ALT/prettier/src/language-js/parse/postprocess/typescript.js index 4c0735e..0f8a1b7 100644 --- ORI/prettier/src/language-js/parse/postprocess/typescript.js +++ ALT/prettier/src/language-js/parse/postprocess/typescript.js @@ -11,8 +11,10 @@ function getTsNodeLocation(nodeOrToken) { // @ts-expect-error -- internal? ts.rangeOfNode(nodeOrToken); const [start, end] = [position.pos, position.end].map((position) => { - const { line, character: column } = - sourceFile.getLineAndCharacterOfPosition(position); + const { + line, + character: column, + } = sourceFile.getLineAndCharacterOfPosition(position); return { line: line + 1, column }; }); diff --git ORI/prettier/src/language-markdown/mdx.js ALT/prettier/src/language-markdown/mdx.js index 632da38..43c6ca7 100644 --- ORI/prettier/src/language-markdown/mdx.js +++ ALT/prettier/src/language-markdown/mdx.js @@ -63,8 +63,12 @@ tokenizeEsComment.locator = (value, fromIndex) => value.indexOf("{", fromIndex); function esSyntax() { const { Parser } = this; - const { blockTokenizers, blockMethods, inlineTokenizers, inlineMethods } = - Parser.prototype; + const { + blockTokenizers, + blockMethods, + inlineTokenizers, + inlineMethods, + } = Parser.prototype; blockTokenizers.esSyntax = tokenizeEsSyntax; inlineTokenizers.esComment = tokenizeEsComment; diff --git ORI/prettier/src/language-markdown/printer-markdown.js ALT/prettier/src/language-markdown/printer-markdown.js index 9deaa3e..04850db 100644 --- ORI/prettier/src/language-markdown/printer-markdown.js +++ ALT/prettier/src/language-markdown/printer-markdown.js @@ -640,8 +640,10 @@ function printRoot(path, options, print) { } function printChildren(path, options, print, events = {}) { - const { postprocessor = (parts) => parts, processor = () => print() } = - events; + const { + postprocessor = (parts) => parts, + processor = () => print(), + } = events; const parts = []; diff --git ORI/prettier/src/main/comments/attach.js ALT/prettier/src/main/comments/attach.js index 6e22482..791b5a5 100644 --- ORI/prettier/src/main/comments/attach.js +++ ALT/prettier/src/main/comments/attach.js @@ -298,8 +298,10 @@ function isOwnLineComment(text, options, decoratedComments, commentIndex) { if (precedingNode) { // Find first comment on the same line for (let index = commentIndex - 1; index >= 0; index--) { - const { comment, precedingNode: currentCommentPrecedingNode } = - decoratedComments[index]; + const { + comment, + precedingNode: currentCommentPrecedingNode, + } = decoratedComments[index]; if ( currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment), start)) @@ -325,8 +327,10 @@ function isEndOfLineComment(text, options, decoratedComments, commentIndex) { index < decoratedComments.length; index++ ) { - const { comment, followingNode: currentCommentFollowingNode } = - decoratedComments[index]; + const { + comment, + followingNode: currentCommentFollowingNode, + } = decoratedComments[index]; if ( currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment))) diff --git ORI/prettier/tests/integration/__tests__/line-suffix-boundary.js ALT/prettier/tests/integration/__tests__/line-suffix-boundary.js index 15ba376..255dd28 100644 --- ORI/prettier/tests/integration/__tests__/line-suffix-boundary.js +++ ALT/prettier/tests/integration/__tests__/line-suffix-boundary.js @@ -3,8 +3,14 @@ import { outdent } from "outdent"; import prettier from "../../config/prettier-entry.js"; import printDoc from "../print-doc.js"; -const { group, indent, line, lineSuffix, lineSuffixBoundary, softline } = - prettier.doc.builders; +const { + group, + indent, + line, + lineSuffix, + lineSuffixBoundary, + softline, +} = prettier.doc.builders; describe("lineSuffixBoundary", () => { test("should be correctly treated as a potential line break in `fits`", async () => { diff --git ORI/prettier/tests/integration/__tests__/mockable.js ALT/prettier/tests/integration/__tests__/mockable.js index 2018bd1..42b9c3a 100644 --- ORI/prettier/tests/integration/__tests__/mockable.js +++ ALT/prettier/tests/integration/__tests__/mockable.js @@ -45,8 +45,9 @@ describe("cosmiconfig", () => { for (const { title, dirname, file, value } of configs) { test(`async version ${title}`, async () => { - const { config, filepath } = - await cosmiconfig("prettier").search(dirname); + const { config, filepath } = await cosmiconfig("prettier").search( + dirname, + ); expect(config).toEqual(value); expect(filepath).toBe(file); }); diff --git ORI/prettier/tests/integration/__tests__/util-shared.js ALT/prettier/tests/integration/__tests__/util-shared.js index 16d1eb2..0e93eef 100644 --- ORI/prettier/tests/integration/__tests__/util-shared.js +++ ALT/prettier/tests/integration/__tests__/util-shared.js @@ -164,8 +164,11 @@ test("sharedUtil.getNextNonSpaceNonCommentCharacter and sharedUtil.getNextNonSpa }); test("sharedUtil.isPreviousLineEmpty, sharedUtil.isNextLineEmpty and sharedUtil.isNextLineEmptyAfterIndex", () => { - const { isPreviousLineEmpty, isNextLineEmpty, isNextLineEmptyAfterIndex } = - sharedUtil; + const { + isPreviousLineEmpty, + isNextLineEmpty, + isNextLineEmptyAfterIndex, + } = sharedUtil; const FAKE_NODE_A = { type: "Identifier", name: "a" }; const FAKE_NODE_B = { type: "Identifier", name: "b" }; ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: marmelab/react-admin@fbf280286c715d6ef0c38d7111eab249aa929dc1

Diff (1243 lines) ```diff diff --git ORI/react-admin/examples/crm/src/dashboard/LatestNotes.tsx ALT/react-admin/examples/crm/src/dashboard/LatestNotes.tsx index 53cc3ba..0c9058d 100644 --- ORI/react-admin/examples/crm/src/dashboard/LatestNotes.tsx +++ ALT/react-admin/examples/crm/src/dashboard/LatestNotes.tsx @@ -14,16 +14,18 @@ import { Contact as ContactType } from '../types'; export const LatestNotes = () => { const { identity } = useGetIdentity(); - const { data: contactNotesData, isLoading: contactNotesLoading } = - useGetList( - 'contactNotes', - { - pagination: { page: 1, perPage: 5 }, - sort: { field: 'date', order: 'DESC' }, - filter: { sales_id: identity?.id }, - }, - { enabled: Number.isInteger(identity?.id) } - ); + const { + data: contactNotesData, + isLoading: contactNotesLoading, + } = useGetList( + 'contactNotes', + { + pagination: { page: 1, perPage: 5 }, + sort: { field: 'date', order: 'DESC' }, + filter: { sales_id: identity?.id }, + }, + { enabled: Number.isInteger(identity?.id) } + ); const { data: dealNotesData, isLoading: dealNotesLoading } = useGetList( 'dealNotes', { diff --git ORI/react-admin/examples/crm/src/deals/DealListContent.tsx ALT/react-admin/examples/crm/src/deals/DealListContent.tsx index 71d5ecc..0efe011 100644 --- ORI/react-admin/examples/crm/src/deals/DealListContent.tsx +++ ALT/react-admin/examples/crm/src/deals/DealListContent.tsx @@ -192,19 +192,21 @@ export const DealListContent = () => { // update backend // Fetch all the deals in both stages (because the list may be filtered, but we need to update even non-filtered deals) - const [{ data: sourceDeals }, { data: destinationDeals }] = - await Promise.all([ - dataProvider.getList('deals', { - sort: { field: 'index', order: 'ASC' }, - pagination: { page: 1, perPage: 100 }, - filter: { stage: source.droppableId }, - }), - dataProvider.getList('deals', { - sort: { field: 'index', order: 'ASC' }, - pagination: { page: 1, perPage: 100 }, - filter: { stage: destination.droppableId }, - }), - ]); + const [ + { data: sourceDeals }, + { data: destinationDeals }, + ] = await Promise.all([ + dataProvider.getList('deals', { + sort: { field: 'index', order: 'ASC' }, + pagination: { page: 1, perPage: 100 }, + filter: { stage: source.droppableId }, + }), + dataProvider.getList('deals', { + sort: { field: 'index', order: 'ASC' }, + pagination: { page: 1, perPage: 100 }, + filter: { stage: destination.droppableId }, + }), + ]); await Promise.all([ // decrease index on the deals after the source index in the source columns diff --git ORI/react-admin/examples/crm/src/deals/OnlyMineInput.tsx ALT/react-admin/examples/crm/src/deals/OnlyMineInput.tsx index 9dd2ed9..bc98769 100644 --- ORI/react-admin/examples/crm/src/deals/OnlyMineInput.tsx +++ ALT/react-admin/examples/crm/src/deals/OnlyMineInput.tsx @@ -3,8 +3,11 @@ import { useListFilterContext, useGetIdentity } from 'react-admin'; import { Box, Switch, FormControlLabel } from '@mui/material'; export const OnlyMineInput = (_: { alwaysOn: boolean }) => { - const { filterValues, displayedFilters, setFilters } = - useListFilterContext(); + const { + filterValues, + displayedFilters, + setFilters, + } = useListFilterContext(); const { identity } = useGetIdentity(); const handleChange = () => { diff --git ORI/react-admin/examples/demo/src/dashboard/PendingReviews.tsx ALT/react-admin/examples/demo/src/dashboard/PendingReviews.tsx index 23eee09..f51a82c 100644 --- ORI/react-admin/examples/demo/src/dashboard/PendingReviews.tsx +++ ALT/react-admin/examples/demo/src/dashboard/PendingReviews.tsx @@ -27,11 +27,7 @@ import { Customer, Review } from '../types'; const PendingReviews = () => { const translate = useTranslate(); - const { - data: reviews, - total, - isLoading, - } = useGetList('reviews', { + const { data: reviews, total, isLoading } = useGetList('reviews', { filter: { status: 'pending' }, sort: { field: 'date', order: 'DESC' }, pagination: { page: 1, perPage: 100 }, diff --git ORI/react-admin/packages/ra-core/src/auth/WithPermissions.tsx ALT/react-admin/packages/ra-core/src/auth/WithPermissions.tsx index 8ec2c8e..a19cb38 100644 --- ORI/react-admin/packages/ra-core/src/auth/WithPermissions.tsx +++ ALT/react-admin/packages/ra-core/src/auth/WithPermissions.tsx @@ -60,8 +60,14 @@ const isEmptyChildren = children => Children.count(children) === 0; * ); */ const WithPermissions = (props: WithPermissionsProps) => { - const { authParams, children, render, component, staticContext, ...rest } = - props; + const { + authParams, + children, + render, + component, + staticContext, + ...rest + } = props; warning( (render && children && !isEmptyChildren(children)) || (render && component) || diff --git ORI/react-admin/packages/ra-core/src/controller/create/useCreateController.ts ALT/react-admin/packages/ra-core/src/controller/create/useCreateController.ts index 690e686..6b8deb7 100644 --- ORI/react-admin/packages/ra-core/src/controller/create/useCreateController.ts +++ ALT/react-admin/packages/ra-core/src/controller/create/useCreateController.ts @@ -68,8 +68,12 @@ export const useCreateController = < const notify = useNotify(); const redirect = useRedirect(); const recordToUse = record ?? getRecordFromLocation(location) ?? undefined; - const { onSuccess, onError, meta, ...otherMutationOptions } = - mutationOptions; + const { + onSuccess, + onError, + meta, + ...otherMutationOptions + } = mutationOptions; const { registerMutationMiddleware, getMutateWithMiddlewares, diff --git ORI/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts ALT/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts index fa25351..0cc0a1b 100644 --- ORI/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts +++ ALT/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts @@ -69,30 +69,35 @@ export const useReferenceArrayFieldController = < return emptyArray; }, [value, source]); - const { data, error, isLoading, isFetching, refetch } = - useGetManyAggregate( - reference, - { ids }, - { - onError: error => - notify( - typeof error === 'string' - ? error - : error.message || 'ra.notification.http_error', - { - type: 'error', - messageArgs: { - _: - typeof error === 'string' - ? error - : error && error.message - ? error.message - : undefined, - }, - } - ), - } - ); + const { + data, + error, + isLoading, + isFetching, + refetch, + } = useGetManyAggregate( + reference, + { ids }, + { + onError: error => + notify( + typeof error === 'string' + ? error + : error.message || 'ra.notification.http_error', + { + type: 'error', + messageArgs: { + _: + typeof error === 'string' + ? error + : error && error.message + ? error.message + : undefined, + }, + } + ), + } + ); const listProps = useList({ data, diff --git ORI/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts ALT/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts index 04de0d2..a44cd47 100644 --- ORI/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts +++ ALT/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts @@ -144,37 +144,44 @@ export const useReferenceManyFieldController = < } }); - const { data, total, pageInfo, error, isFetching, isLoading, refetch } = - useGetManyReference( - reference, - { - target, - id: get(record, source) as Identifier, - pagination: { page, perPage }, - sort, - filter: filterValues, - }, - { - keepPreviousData: true, - onError: error => - notify( - typeof error === 'string' - ? error - : error.message || 'ra.notification.http_error', - { - type: 'error', - messageArgs: { - _: - typeof error === 'string' - ? error - : error && error.message - ? error.message - : undefined, - }, - } - ), - } - ); + const { + data, + total, + pageInfo, + error, + isFetching, + isLoading, + refetch, + } = useGetManyReference( + reference, + { + target, + id: get(record, source) as Identifier, + pagination: { page, perPage }, + sort, + filter: filterValues, + }, + { + keepPreviousData: true, + onError: error => + notify( + typeof error === 'string' + ? error + : error.message || 'ra.notification.http_error', + { + type: 'error', + messageArgs: { + _: + typeof error === 'string' + ? error + : error && error.message + ? error.message + : undefined, + }, + } + ), + } + ); return { sort, diff --git ORI/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx ALT/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx index 889d34e..8e297ba 100644 --- ORI/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx +++ ALT/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx @@ -61,39 +61,44 @@ export const useReferenceOneFieldController = < const notify = useNotify(); const { meta, ...otherQueryOptions } = queryOptions; - const { data, error, isFetching, isLoading, refetch } = - useGetManyReference( - reference, - { - target, - id: get(record, source), - pagination: { page: 1, perPage: 1 }, - sort, - filter, - meta, - }, - { - enabled: !!record, - onError: error => - notify( - typeof error === 'string' - ? error - : error.message || 'ra.notification.http_error', - { - type: 'error', - messageArgs: { - _: - typeof error === 'string' - ? error - : error && error.message - ? error.message - : undefined, - }, - } - ), - ...otherQueryOptions, - } - ); + const { + data, + error, + isFetching, + isLoading, + refetch, + } = useGetManyReference( + reference, + { + target, + id: get(record, source), + pagination: { page: 1, perPage: 1 }, + sort, + filter, + meta, + }, + { + enabled: !!record, + onError: error => + notify( + typeof error === 'string' + ? error + : error.message || 'ra.notification.http_error', + { + type: 'error', + messageArgs: { + _: + typeof error === 'string' + ? error + : error && error.message + ? error.message + : undefined, + }, + } + ), + ...otherQueryOptions, + } + ); return { referenceRecord: data ? data[0] : undefined, diff --git ORI/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx ALT/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx index 942f54b..becbde5 100644 --- ORI/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx +++ ALT/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx @@ -57,8 +57,14 @@ const dataProvider = new Proxy(baseDataProvider, { }); const BookListView = () => { - const { data, isLoading, sort, setSort, filterValues, setFilters } = - useListContext(); + const { + data, + isLoading, + sort, + setSort, + filterValues, + setFilters, + } = useListContext(); if (isLoading) { return
Loading...
; } 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 a640c04..76d90fd 100644 --- ORI/react-admin/packages/ra-core/src/controller/list/useListController.ts +++ ALT/react-admin/packages/ra-core/src/controller/list/useListController.ts @@ -74,31 +74,38 @@ export const useListController = ( const [selectedIds, selectionModifiers] = useRecordSelection(resource); - const { data, pageInfo, total, error, isLoading, isFetching, refetch } = - useGetList( - resource, - { - pagination: { - page: query.page, - perPage: query.perPage, - }, - sort: { field: query.sort, order: query.order }, - filter: { ...query.filter, ...filter }, - meta, + const { + data, + pageInfo, + total, + error, + isLoading, + isFetching, + refetch, + } = useGetList( + resource, + { + pagination: { + page: query.page, + perPage: query.perPage, }, - { - keepPreviousData: true, - retry: false, - onError: error => - notify(error?.message || 'ra.notification.http_error', { - type: 'error', - messageArgs: { - _: error?.message, - }, - }), - ...otherQueryOptions, - } - ); + sort: { field: query.sort, order: query.order }, + filter: { ...query.filter, ...filter }, + meta, + }, + { + keepPreviousData: true, + retry: false, + onError: error => + notify(error?.message || 'ra.notification.http_error', { + type: 'error', + messageArgs: { + _: error?.message, + }, + }), + ...otherQueryOptions, + } + ); // change page if there is no data useEffect(() => { diff --git ORI/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts ALT/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts index 8e90697..58ccdab 100644 --- ORI/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts +++ ALT/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts @@ -11,8 +11,10 @@ export const useRegisterMutationMiddleware = < >( callback: Middleware ) => { - const { registerMutationMiddleware, unregisterMutationMiddleware } = - useSaveContext(); + const { + registerMutationMiddleware, + unregisterMutationMiddleware, + } = useSaveContext(); useEffect(() => { registerMutationMiddleware(callback); diff --git ORI/react-admin/packages/ra-core/src/controller/useReference.ts ALT/react-admin/packages/ra-core/src/controller/useReference.ts index b622ef9..a92bd83 100644 --- ORI/react-admin/packages/ra-core/src/controller/useReference.ts +++ ALT/react-admin/packages/ra-core/src/controller/useReference.ts @@ -50,12 +50,17 @@ export const useReference = ({ options = {}, }: UseReferenceProps): UseReferenceResult => { const { meta, ...otherQueryOptions } = options; - const { data, error, isLoading, isFetching, refetch } = - useGetManyAggregate( - reference, - { ids: [id], meta }, - otherQueryOptions - ); + const { + data, + error, + isLoading, + isFetching, + refetch, + } = useGetManyAggregate( + reference, + { ids: [id], meta }, + otherQueryOptions + ); return { referenceRecord: error ? undefined : data ? data[0] : undefined, refetch, diff --git ORI/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx ALT/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx index 1162c9b..ad2bcdb 100644 --- ORI/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx +++ ALT/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx @@ -48,8 +48,9 @@ export const ResourceDefinitionContextProvider = ({ definitions?: ResourceDefinitions; children: React.ReactNode; }) => { - const [definitions, setState] = - useState(defaultDefinitions); + const [definitions, setState] = useState( + defaultDefinitions + ); const register = useCallback((config: ResourceDefinition) => { setState(prev => diff --git ORI/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx ALT/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx index c6eadca..71c3c06 100644 --- ORI/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx +++ ALT/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx @@ -79,8 +79,11 @@ const useRoutesAndResourcesFromChildren = ( // We need to know right away whether some resources were declared to correctly // initialize the status at the next stop const doLogout = useLogout(); - const [routesAndResources, setRoutesAndResources, mergeRoutesAndResources] = - useRoutesAndResourcesState(getRoutesAndResourceFromNodes(children)); + const [ + routesAndResources, + setRoutesAndResources, + mergeRoutesAndResources, + ] = useRoutesAndResourcesState(getRoutesAndResourceFromNodes(children)); const [status, setStatus] = useSafeSetState(() => getStatus({ diff --git ORI/react-admin/packages/ra-core/src/core/useResourceDefinition.ts ALT/react-admin/packages/ra-core/src/core/useResourceDefinition.ts index 424d538..b7f16b6 100644 --- ORI/react-admin/packages/ra-core/src/core/useResourceDefinition.ts +++ ALT/react-admin/packages/ra-core/src/core/useResourceDefinition.ts @@ -33,8 +33,13 @@ export const useResourceDefinition = < ): ResourceDefinition => { const resource = useResourceContext(props); const resourceDefinitions = useResourceDefinitions(); - const { hasCreate, hasEdit, hasList, hasShow, recordRepresentation } = - props || {}; + const { + hasCreate, + hasEdit, + hasList, + hasShow, + recordRepresentation, + } = props || {}; const definition = useMemo(() => { return defaults( diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useCreate.ts ALT/react-admin/packages/ra-core/src/dataProvider/useCreate.ts index fa9a8e9..ad53d07 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useCreate.ts +++ ALT/react-admin/packages/ra-core/src/dataProvider/useCreate.ts @@ -130,8 +130,10 @@ export const useCreate = < unknown > & { returnPromise?: boolean } = {} ) => { - const { returnPromise = options.returnPromise, ...reactCreateOptions } = - createOptions; + const { + returnPromise = options.returnPromise, + ...reactCreateOptions + } = createOptions; if (returnPromise) { return mutation.mutateAsync( { resource: callTimeResource, ...callTimeParams }, diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts ALT/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts index 354688a..7fea7e7 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts +++ ALT/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts @@ -234,8 +234,12 @@ const callGetManyQueries = batch((calls: GetManyCallArgs[]) => { // There is only one call (no aggregation), or one of the calls has the same ids as the sum of all calls. // Either way, we can't trigger a new fetchQuery with the same signature, as it's already pending. // Therefore, we reply with the dataProvider - const { dataProvider, resource, ids, meta } = - callThatHasAllAggregatedIds; + const { + dataProvider, + resource, + ids, + meta, + } = callThatHasAllAggregatedIds; dataProvider .getMany(resource, { ids, meta }) diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx ALT/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx index 18ece81..934902f 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx +++ ALT/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx @@ -56,12 +56,16 @@ const UseInfiniteComponent = ({ options = {}, meta = undefined, }) => { - const { data, fetchNextPage, hasNextPage, isFetchingNextPage } = - useInfiniteGetList( - resource, - { pagination, sort, filter, meta }, - options - ); + const { + data, + fetchNextPage, + hasNextPage, + isFetchingNextPage, + } = useInfiniteGetList( + resource, + { pagination, sort, filter, meta }, + options + ); return (
@@ -168,11 +172,15 @@ export const InfiniteScroll = () => { }; const UseInfiniteComponentWithIntersectionObserver = () => { - const { data, fetchNextPage, hasNextPage, isFetchingNextPage } = - useInfiniteGetList('countries', { - pagination: { page: 1, perPage: 20 }, - sort: { field: 'id', order: 'DESC' }, - }); + const { + data, + fetchNextPage, + hasNextPage, + isFetchingNextPage, + } = useInfiniteGetList('countries', { + pagination: { page: 1, perPage: 20 }, + sort: { field: 'id', order: 'DESC' }, + }); const observerElem = useRef(null); const handleObserver = useCallback( diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts ALT/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts index f8e13ff..85eb593 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts +++ ALT/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts @@ -302,8 +302,13 @@ export const useUpdateMany = < unknown > & { mutationMode?: MutationMode; returnPromise?: boolean } = {} ) => { - const { mutationMode, returnPromise, onSuccess, onSettled, onError } = - updateOptions; + const { + mutationMode, + returnPromise, + onSuccess, + onSettled, + onError, + } = updateOptions; // store the hook time params *at the moment of the call* // because they may change afterwards, which would break the undoable mode diff --git ORI/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts ALT/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts index d6e93bb..89bf013 100644 --- ORI/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts +++ ALT/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts @@ -33,8 +33,13 @@ export const useApplyInputDefaultValues = ({ }: Props) => { const { defaultValue, source } = inputProps; const record = useRecordContext(inputProps); - const { getValues, resetField, getFieldState, formState, reset } = - useFormContext(); + const { + getValues, + resetField, + getFieldState, + formState, + reset, + } = useFormContext(); const recordValue = get(record, source); const formValue = get(getValues(), source); const { isDirty } = getFieldState(source, formState); diff --git ORI/react-admin/packages/ra-core/src/form/useInput.ts ALT/react-admin/packages/ra-core/src/form/useInput.ts index b4a330f..eb50397 100644 --- ORI/react-admin/packages/ra-core/src/form/useInput.ts +++ ALT/react-admin/packages/ra-core/src/form/useInput.ts @@ -65,11 +65,7 @@ export const useInput = ( // This ensures dynamically added inputs have their value set correctly (ArrayInput for example). // We don't do this for the form level defaultValues so that it works as it should in react-hook-form // (i.e. field level defaultValue override form level defaultValues for this field). - const { - field: controllerField, - fieldState, - formState, - } = useController({ + const { field: controllerField, fieldState, formState } = useController({ name: finalName, defaultValue: get(record, source, defaultValue), rules: { diff --git ORI/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts ALT/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts index 22fb03f..a31fbcc 100644 --- ORI/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts +++ ALT/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts @@ -43,8 +43,11 @@ export const resolveBrowserLocale = ( ): string => { // from http://blog.ksol.fr/user-locale-detection-browser-javascript/ // Rely on the window.navigator object to determine user locale - const { language, browserLanguage, userLanguage } = - window.navigator as AllNavigatorLanguage; + const { + language, + browserLanguage, + userLanguage, + } = window.navigator as AllNavigatorLanguage; const locale = language || diff --git ORI/react-admin/packages/ra-core/src/notification/useNotify.ts ALT/react-admin/packages/ra-core/src/notification/useNotify.ts index ca7d399..15b56f6 100644 --- ORI/react-admin/packages/ra-core/src/notification/useNotify.ts +++ ALT/react-admin/packages/ra-core/src/notification/useNotify.ts @@ -25,8 +25,10 @@ export const useNotify = () => { message: string | ReactNode, options: NotificationOptions & { type?: NotificationType } = {} ) => { - const { type: messageType = 'info', ...notificationOptions } = - options; + const { + type: messageType = 'info', + ...notificationOptions + } = options; addNotification({ message, type: messageType, diff --git ORI/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx ALT/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx index 25913c6..de202d4 100644 --- ORI/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx +++ ALT/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx @@ -29,8 +29,10 @@ enum ColorType { export const ColorButtons = (props: Omit) => { const translate = useTranslate(); const editor = useTiptapEditor(); - const [showColorChoiceDialog, setShowColorChoiceDialog] = - React.useState(false); + const [ + showColorChoiceDialog, + setShowColorChoiceDialog, + ] = React.useState(false); const [colorType, setColorType] = React.useState(ColorType.FONT); const colorLabel = translate('ra.tiptap.color', { _: 'Color' }); diff --git ORI/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx ALT/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx index 1a4121d..76b2d12 100644 --- ORI/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx +++ ALT/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx @@ -13,10 +13,12 @@ export const ResourceConfigurationProvider = ({ dataProvider, storageKey = STORAGE_KEY, }: ResourceConfigurationProviderProps) => { - const [resources, setInternalResources] = - useState(() => - loadConfigurationsFromLocalStorage(storageKey) - ); + const [ + resources, + setInternalResources, + ] = useState(() => + loadConfigurationsFromLocalStorage(storageKey) + ); const setResources = useCallback( ( diff --git ORI/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx ALT/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx index 106cb92..31856e7 100644 --- ORI/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx +++ ALT/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx @@ -35,8 +35,9 @@ export const NewResourceMenuItem = ( props: MenuItemProps<'li', { button?: true } & { sidebarIsOpen: boolean }> ) => { const { sidebarIsOpen, ...rest } = props; - const [showImportResourceDialog, setShowImportResourceDialog] = - useState(false); + const [showImportResourceDialog, setShowImportResourceDialog] = useState( + false + ); const handleClick = () => { setShowImportResourceDialog(true); diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx index d12aaf1..c3ca43b 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx @@ -46,19 +46,22 @@ export const ReferenceManyCount = ( const oneSecondHasPassed = useTimeout(timeout); const createPath = useCreatePath(); - const { isLoading, error, total } = - useReferenceManyFieldController({ - filter, - sort, - page: 1, - perPage: 1, - record, - reference, - // @ts-ignore remove when #8491 is released - resource, - source, - target, - }); + const { + isLoading, + error, + total, + } = useReferenceManyFieldController({ + filter, + sort, + page: 1, + perPage: 1, + record, + reference, + // @ts-ignore remove when #8491 is released + resource, + source, + target, + }); const body = isLoading ? ( oneSecondHasPassed ? ( diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx index 2c0f9ad..67ffd75 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx @@ -47,16 +47,21 @@ export const ReferenceOneField = < const createPath = useCreatePath(); const translate = useTranslate(); - const { isLoading, isFetching, referenceRecord, error, refetch } = - useReferenceOneFieldController({ - record, - reference, - source, - target, - sort, - filter, - queryOptions, - }); + const { + isLoading, + isFetching, + referenceRecord, + error, + refetch, + } = useReferenceOneFieldController({ + record, + reference, + source, + target, + sort, + filter, + queryOptions, + }); const resourceLinkPath = link === false diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx index 98436b0..53794f5 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx @@ -64,8 +64,11 @@ describe('', () => { it('should allow to customize the locale selector', () => { const Selector = () => { - const { locales, selectLocale, selectedLocale } = - useTranslatableContext(); + const { + locales, + selectLocale, + selectedLocale, + } = useTranslatableContext(); const handleChange = (event): void => { selectLocale(event.target.value); diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx index 5fbd079..c925c1a 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx @@ -95,8 +95,13 @@ export const ArrayInput = (props: ArrayInputProps) => { : validate; const getValidationErrorMessage = useGetValidationErrorMessage(); - const { getFieldState, formState, getValues, register, unregister } = - useFormContext(); + const { + getFieldState, + formState, + getValues, + register, + unregister, + } = useFormContext(); const fieldProps = useFieldArray({ name: source, diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx index b746ee1..de27f58 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx @@ -261,8 +261,13 @@ export const Sx = () => ( ); const FormStateInspector = () => { - const { touchedFields, isDirty, dirtyFields, isValid, errors } = - useFormState(); + const { + touchedFields, + isDirty, + dirtyFields, + isValid, + errors, + } = useFormState(); return (
form state:  diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx index 0680271..a06a1c0 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx @@ -62,8 +62,8 @@ export const ResettableTextField = forwardRef( visibleClearIcon, } = ResettableTextFieldClasses; - const { endAdornment, ...InputPropsWithoutEndAdornment } = - InputProps || {}; + const { endAdornment, ...InputPropsWithoutEndAdornment } = InputProps || + {}; if (clearAlwaysVisible && endAdornment) { throw new Error( diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx index 5449df2..45b1925 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx @@ -214,8 +214,13 @@ export const ExtraProps = () => ( ); const FormStateInspector = () => { - const { touchedFields, isDirty, dirtyFields, isValid, errors } = - useFormState(); + const { + touchedFields, + isDirty, + dirtyFields, + isValid, + errors, + } = useFormState(); return (
form state:  diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx index 34d20d1..758023c 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx @@ -77,8 +77,11 @@ describe('', () => { const handleSubmit = jest.fn(); const Selector = () => { - const { locales, selectLocale, selectedLocale } = - useTranslatableContext(); + const { + locales, + selectLocale, + selectedLocale, + } = useTranslatableContext(); const handleChange = (event, newLocale): void => { selectLocale(newLocale); @@ -194,8 +197,11 @@ describe('', () => { it('should allow to customize the locale selector', () => { const Selector = () => { - const { locales, selectLocale, selectedLocale } = - useTranslatableContext(); + const { + locales, + selectLocale, + selectedLocale, + } = useTranslatableContext(); const handleChange = (event): void => { selectLocale(event.target.value); diff --git ORI/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx ALT/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx index 2051f8c..dfe7a41 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx @@ -197,8 +197,11 @@ export const PaginationInfinite = () => ( ); const LoadMore = () => { - const { hasNextPage, fetchNextPage, isFetchingNextPage } = - useInfinitePaginationContext(); + const { + hasNextPage, + fetchNextPage, + isFetchingNextPage, + } = useInfinitePaginationContext(); return hasNextPage ? (
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: typescript-eslint/typescript-eslint@4bf2d7360eaf74c9ef87b196ff4c459b8f50800b

Diff (149 lines) ```diff diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts index 0c671d8..9746d15 100644 --- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts +++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts @@ -51,8 +51,9 @@ export default createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); + const { program, esTreeNodeToTSNodeMap } = ESLintUtils.getParserServices( + context, + ); const checker = program.getTypeChecker(); return { diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index 313a32e..aeb4595 100644 --- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -148,8 +148,9 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); + const { program, esTreeNodeToTSNodeMap } = ESLintUtils.getParserServices( + context, + ); const checker = program.getTypeChecker(); const checkedObjects = new Set(); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 5436405..69bbaa9 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -270,8 +270,12 @@ function* fixSeparateNamedExports( sourceCode: Readonly, report: ReportValueExport, ): IterableIterator { - const { node, typeBasedSpecifiers, inlineTypeSpecifiers, valueSpecifiers } = - report; + const { + node, + typeBasedSpecifiers, + inlineTypeSpecifiers, + valueSpecifiers, + } = report; const typeSpecifiers = typeBasedSpecifiers.concat(inlineTypeSpecifiers); const source = getSourceFromExport(node); const specifierNames = typeSpecifiers.map(getSpecifierText).join(', '); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 4c5cf77..ce74e7c 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -610,8 +610,11 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = - classifySpecifier(node); + const { + defaultSpecifier, + namespaceSpecifier, + namedSpecifiers, + } = classifySpecifier(node); if (namespaceSpecifier && !defaultSpecifier) { // import * as types from 'foo' @@ -854,8 +857,11 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = - classifySpecifier(node); + const { + defaultSpecifier, + namespaceSpecifier, + namedSpecifiers, + } = classifySpecifier(node); if (namespaceSpecifier) { // import type * as types from 'foo' diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts index 2b10c97..a80633a 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -201,8 +201,9 @@ export default util.createRule({ function findVariablesInScope(scope: TSESLint.Scope.Scope): void { for (const variable of scope.variables) { - const [declaration, ...extraDeclarations] = - iterateDeclarations(variable); + const [declaration, ...extraDeclarations] = iterateDeclarations( + variable, + ); if (extraDeclarations.length === 0) { continue; diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts index 3a9e6cd..d1ad20c 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -191,8 +191,9 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); for (const violatingNode of finalizedClassScope.finalizeUnmodifiedPrivateNonReadonlys()) { - const { esNode, nameNode } = - getEsNodesFromViolatingNode(violatingNode); + const { esNode, nameNode } = getEsNodesFromViolatingNode( + violatingNode, + ); context.report({ data: { name: sourceCode.getText(nameNode), diff --git ORI/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts ALT/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts index 0b7da71..6fde9d6 100644 --- ORI/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts +++ ALT/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts @@ -95,8 +95,11 @@ async function main(): Promise { ['Rule', 'Status', 'Ext', 'R', 'RWT', 'Strict', 'Comment'], ...Object.entries(rules).map(([ruleName, { meta }]) => { const { deprecated } = meta; - const { extendsBaseRule, recommended, requiresTypeChecking } = - meta.docs!; + const { + extendsBaseRule, + recommended, + requiresTypeChecking, + } = meta.docs!; return [ `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, diff --git ORI/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts ALT/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts index 623157e..5826594 100644 --- ORI/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts +++ ALT/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts @@ -88,8 +88,10 @@ class RuleTester extends BaseRuleTester.RuleTester { constructor(baseOptions: RuleTesterConfig) { // eslint will hard-error if you include non-standard top-level properties - const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = - baseOptions; + const { + dependencyConstraints: _, + ...baseOptionsSafeForESLint + } = baseOptions; super({ ...baseOptionsSafeForESLint, parserOptions: { ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: vega/vega-lite@c9659206602eda1d894702a2a1f5b526b9832f9f

Diff (102 lines) ```diff diff --git ORI/vega-lite/src/compile/header/assemble.ts ALT/vega-lite/src/compile/header/assemble.ts index 1bc2959..1f54fda 100644 --- ORI/vega-lite/src/compile/header/assemble.ts +++ ALT/vega-lite/src/compile/header/assemble.ts @@ -40,11 +40,12 @@ export function assembleTitleGroup(model: Model, channel: FacetChannel) { ? model.component.layoutHeaders[channel].facetFieldDef : undefined; - const { - titleAnchor, - titleAngle: ta, - titleOrient - } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel); + const {titleAnchor, titleAngle: ta, titleOrient} = getHeaderProperties( + ['titleAnchor', 'titleAngle', 'titleOrient'], + facetFieldDef.header, + config, + channel + ); const headerChannel = getHeaderChannel(channel, titleOrient); const titleAngle = normalizeAngle(ta); diff --git ORI/vega-lite/src/compositemark/boxplot.ts ALT/vega-lite/src/compositemark/boxplot.ts index e047c2d..67b9cef 100644 --- ORI/vega-lite/src/compositemark/boxplot.ts +++ ALT/vega-lite/src/compositemark/boxplot.ts @@ -402,13 +402,10 @@ function boxParams( oldEncodingWithoutContinuousAxis ); - const { - bins, - timeUnits, - aggregate, - groupby, - encoding: encodingWithoutContinuousAxis - } = extractTransformsFromEncoding(filteredEncoding, config); + const {bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis} = extractTransformsFromEncoding( + filteredEncoding, + config + ); const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical'; const boxOrient: Orientation = orient; diff --git ORI/vega-lite/src/compositemark/errorbar.ts ALT/vega-lite/src/compositemark/errorbar.ts index 527efd4..d1c0cb7 100644 --- ORI/vega-lite/src/compositemark/errorbar.ts +++ ALT/vega-lite/src/compositemark/errorbar.ts @@ -360,17 +360,21 @@ export function errorBarParams< continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark); - const {errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName} = - errorBarAggregationAndCalculation( - markDef, - continuousAxisChannelDef, - continuousAxisChannelDef2, - continuousAxisChannelDefError, - continuousAxisChannelDefError2, - inputType, - compositeMark, - config - ); + const { + errorBarSpecificAggregate, + postAggregateCalculates, + tooltipSummary, + tooltipTitleWithFieldName + } = errorBarAggregationAndCalculation( + markDef, + continuousAxisChannelDef, + continuousAxisChannelDef2, + continuousAxisChannelDefError, + continuousAxisChannelDefError2, + inputType, + compositeMark, + config + ); const { [continuousAxis]: oldContinuousAxisChannelDef, diff --git ORI/vega-lite/src/scale.ts ALT/vega-lite/src/scale.ts index c90e7b1..898da54 100644 --- ORI/vega-lite/src/scale.ts +++ ALT/vega-lite/src/scale.ts @@ -754,8 +754,15 @@ const SCALE_PROPERTY_INDEX: Flag> = { export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX); -const {type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX} = - SCALE_PROPERTY_INDEX; +const { + type, + domain, + range, + rangeMax, + rangeMin, + scheme, + ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX +} = SCALE_PROPERTY_INDEX; export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); ```
fisker commented 9 months ago

Run #15447

github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: babel/babel@134aa1723c6aa01a42713e379142088b30c6cc0d

Diff (281 lines) ```diff diff --git ORI/babel/packages/babel-generator/src/index.ts ALT/babel/packages/babel-generator/src/index.ts index 4807342a..0bf82f9b 100644 --- ORI/babel/packages/babel-generator/src/index.ts +++ ALT/babel/packages/babel-generator/src/index.ts @@ -110,8 +110,11 @@ function normalizeOptions( format.indent.adjustMultilineComment = false; } - const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } = - format; + const { + auxiliaryCommentBefore, + auxiliaryCommentAfter, + shouldPrintComment, + } = format; if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { format.auxiliaryCommentBefore = undefined; 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 795c0bd1..25936371 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 @@ -247,23 +247,12 @@ export function createClassFeaturePlugin({ )); } else { keysNodes = extractComputedKeys(path, computedPaths, file); - ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = - buildFieldsInitNodes( - ref, - path.node.superClass, - props, - privateNamesMap, - file, - setPublicClassFields ?? loose, - privateFieldsAsSymbolsOrProperties ?? loose, - constantSuper ?? loose, - innerBinding, - )); - } - } else { - keysNodes = extractComputedKeys(path, computedPaths, file); - ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } = - buildFieldsInitNodes( + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( ref, path.node.superClass, props, @@ -274,6 +263,25 @@ export function createClassFeaturePlugin({ constantSuper ?? loose, innerBinding, )); + } + } else { + keysNodes = extractComputedKeys(path, computedPaths, file); + ({ + staticNodes, + pureStaticNodes, + instanceNodes, + wrapClass, + } = buildFieldsInitNodes( + ref, + path.node.superClass, + props, + privateNamesMap, + file, + setPublicClassFields ?? loose, + privateFieldsAsSymbolsOrProperties ?? loose, + constantSuper ?? loose, + innerBinding, + )); } if (instanceNodes.length > 0) { 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 fecc1ddf..a00a8aac 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 @@ -270,8 +270,13 @@ const buildImportThrow = (localName: string) => { const rewriteReferencesVisitor: Visitor = { ReferencedIdentifier(path) { - const { seen, buildImportReference, scope, imported, requeueInParent } = - this; + const { + seen, + buildImportReference, + scope, + imported, + requeueInParent, + } = this; if (seen.has(path.node)) return; seen.add(path.node); diff --git ORI/babel/packages/babel-parser/src/plugins/flow/index.ts ALT/babel/packages/babel-parser/src/plugins/flow/index.ts index 55cceae8..48ceed32 100644 --- ORI/babel/packages/babel-parser/src/plugins/flow/index.ts +++ ALT/babel/packages/babel-parser/src/plugins/flow/index.ts @@ -437,8 +437,10 @@ export default (superClass: typeof Parser) => typeNode.this = tmp._this; this.expect(tt.parenR); - [typeNode.returnType, node.predicate] = - this.flowParseTypeAndPredicateInitialiser(); + [ + typeNode.returnType, + node.predicate, + ] = this.flowParseTypeAndPredicateInitialiser(); typeContainer.typeAnnotation = this.finishNode( typeNode, diff --git ORI/babel/packages/babel-parser/src/tokenizer/index.ts ALT/babel/packages/babel-parser/src/tokenizer/index.ts index 8750a3cf..82ec1c56 100644 --- ORI/babel/packages/babel-parser/src/tokenizer/index.ts +++ ALT/babel/packages/babel-parser/src/tokenizer/index.ts @@ -1340,15 +1340,20 @@ export default abstract class Tokenizer extends CommentsParser { // Reads template string tokens. readTemplateToken(): void { const opening = this.input[this.state.pos]; - const { str, firstInvalidLoc, pos, curLine, lineStart } = - readStringContents( - "template", - this.input, - this.state.pos + 1, // skip '`' or `}` - this.state.lineStart, - this.state.curLine, - this.errorHandlers_readStringContents_template, - ); + const { + str, + firstInvalidLoc, + pos, + curLine, + lineStart, + } = readStringContents( + "template", + this.input, + this.state.pos + 1, // skip '`' or `}` + this.state.lineStart, + this.state.curLine, + this.errorHandlers_readStringContents_template, + ); this.state.pos = pos + 1; // skip '`' or `$` this.state.lineStart = lineStart; this.state.curLine = curLine; diff --git ORI/babel/packages/babel-parser/src/util/class-scope.ts ALT/babel/packages/babel-parser/src/util/class-scope.ts index a3c852ff..8c886985 100644 --- ORI/babel/packages/babel-parser/src/util/class-scope.ts +++ ALT/babel/packages/babel-parser/src/util/class-scope.ts @@ -64,8 +64,11 @@ export default class ClassScopeHandler { elementType: ClassElementTypes, loc: Position, ) { - const { privateNames, loneAccessors, undefinedPrivateNames } = - this.current(); + const { + privateNames, + loneAccessors, + undefinedPrivateNames, + } = this.current(); let redefined = privateNames.has(name); if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) { diff --git ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts index 5888fd1f..17d9a8cb 100644 --- ORI/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts +++ ALT/babel/packages/babel-plugin-proposal-destructuring-private/src/index.ts @@ -49,8 +49,10 @@ export default declare(function ({ assertVersion, assumption, types: t }) { ? -1 : params.findIndex(param => param.type === "AssignmentPattern"); const paramsAfterIndex = params.splice(firstPrivateIndex); - const { params: transformedParams, variableDeclaration } = - buildVariableDeclarationFromParams(paramsAfterIndex, scope); + const { + params: transformedParams, + variableDeclaration, + } = buildVariableDeclarationFromParams(paramsAfterIndex, scope); (path.get("body") as NodePath).unshiftContainer( "body", diff --git ORI/babel/packages/babel-plugin-transform-block-scoping/src/index.ts ALT/babel/packages/babel-plugin-transform-block-scoping/src/index.ts index 80195171..dc710a84 100644 --- ORI/babel/packages/babel-plugin-transform-block-scoping/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-block-scoping/src/index.ts @@ -81,8 +81,11 @@ export default declare((api, opts: Options) => { headScope.crawl(); binding = headScope.getOwnBinding(name); } - const { usages, capturedInClosure, hasConstantViolations } = - getUsageInBody(binding, path); + const { + usages, + capturedInClosure, + hasConstantViolations, + } = getUsageInBody(binding, path); if ( headScope.parent.hasBinding(name) || diff --git ORI/babel/packages/babel-plugin-transform-modules-amd/src/index.ts ALT/babel/packages/babel-plugin-transform-modules-amd/src/index.ts index b46dff0e..c3e33544 100644 --- ORI/babel/packages/babel-plugin-transform-modules-amd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-amd/src/index.ts @@ -63,8 +63,13 @@ type State = { export default declare((api, options: Options) => { api.assertVersion(7); - const { allowTopLevelThis, strict, strictMode, importInterop, noInterop } = - options; + const { + allowTopLevelThis, + strict, + strictMode, + importInterop, + noInterop, + } = options; const constantReexports = api.assumption("constantReexports") ?? options.loose; 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 b0169e30..dd3a05fc 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 @@ -435,12 +435,15 @@ export default declare((api, opts: Options) => { path => path.isObjectPattern(), ); - const [impureComputedPropertyDeclarators, argument, callExpression] = - createObjectRest( - objectPatternPath, - file, - ref as t.MemberExpression, - ); + const [ + impureComputedPropertyDeclarators, + argument, + callExpression, + ] = createObjectRest( + objectPatternPath, + file, + ref as t.MemberExpression, + ); if (pureGetters) { removeUnusedExcludedKeys(objectPatternPath); @@ -517,8 +520,11 @@ export default declare((api, opts: Options) => { ]), ); - const [impureComputedPropertyDeclarators, argument, callExpression] = - createObjectRest(leftPath, file, t.identifier(refName)); + const [ + impureComputedPropertyDeclarators, + argument, + callExpression, + ] = createObjectRest(leftPath, file, t.identifier(refName)); if (impureComputedPropertyDeclarators.length > 0) { nodes.push( diff --git ORI/babel/packages/babel-traverse/src/path/conversion.ts ALT/babel/packages/babel-traverse/src/path/conversion.ts index a87be3c2..9a9eed98 100644 --- ORI/babel/packages/babel-traverse/src/path/conversion.ts +++ ALT/babel/packages/babel-traverse/src/path/conversion.ts @@ -288,8 +288,13 @@ function hoistFunctionEnvironment( } } - const { thisPaths, argumentsPaths, newTargetPaths, superProps, superCalls } = - getScopeInformation(fnPath); + const { + thisPaths, + argumentsPaths, + newTargetPaths, + superProps, + superCalls, + } = getScopeInformation(fnPath); // Convert all super() calls in the constructor, if super is used in an arrow. if (inConstructor && superCalls.length > 0) { ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: mdn/content@c5dd9c3b9d503a56dc04b6b8f88e89194dc82d7f

The diff is empty.

github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: vuejs/eslint-plugin-vue@2aa9ac45a4ea66c293b3e7cbfd6ad076afa39bb5

Diff (63 lines) ```diff diff --git ORI/eslint-plugin-vue/lib/rules/attributes-order.js ALT/eslint-plugin-vue/lib/rules/attributes-order.js index e6915ae..8cad039 100644 --- ORI/eslint-plugin-vue/lib/rules/attributes-order.js +++ ALT/eslint-plugin-vue/lib/rules/attributes-order.js @@ -326,8 +326,10 @@ function create(context) { return } - let { attr: previousNode, position: previousPosition } = - attributeAndPositions[0] + let { + attr: previousNode, + position: previousPosition + } = attributeAndPositions[0] for (let index = 1; index < attributeAndPositions.length; index++) { const { attr, position } = attributeAndPositions[index] diff --git ORI/eslint-plugin-vue/lib/rules/v-on-handler-style.js ALT/eslint-plugin-vue/lib/rules/v-on-handler-style.js index aa1214e..a3ddf63 100644 --- ORI/eslint-plugin-vue/lib/rules/v-on-handler-style.js +++ ALT/eslint-plugin-vue/lib/rules/v-on-handler-style.js @@ -278,8 +278,10 @@ module.exports = { * @returns {boolean} Returns `true` if reported. */ function verifyCanUseMethodHandlerForInlineHandler(node) { - const { rangeWithoutQuotes, hasComment } = - getVExpressionContainerTokenInfo(node.parent) + const { + rangeWithoutQuotes, + hasComment + } = getVExpressionContainerTokenInfo(node.parent) if (ignoreIncludesComment && hasComment) { return false } @@ -326,10 +328,12 @@ module.exports = { * @returns {boolean} Returns `true` if reported. */ function verifyCanUseMethodHandlerForInlineFunction(node) { - const { rangeWithoutQuotes, hasComment } = - getVExpressionContainerTokenInfo( - /** @type {VExpressionContainer} */ (node.parent) - ) + const { + rangeWithoutQuotes, + hasComment + } = getVExpressionContainerTokenInfo( + /** @type {VExpressionContainer} */ (node.parent) + ) if (ignoreIncludesComment && hasComment) { return false } @@ -420,8 +424,10 @@ module.exports = { /* The statements contains $event and cannot be fixed. */ return } - const { rangeWithoutQuotes, hasQuote } = - getVExpressionContainerTokenInfo(node.parent) + const { + rangeWithoutQuotes, + hasQuote + } = getVExpressionContainerTokenInfo(node.parent) if (!hasQuote) { /* The statements is not enclosed in quotes and cannot be fixed. */ return ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: excalidraw/excalidraw@3ddcc48e4c192f525930e503b3e9214627f0043d

Diff (527 lines) ```diff diff --git ORI/excalidraw/src/actions/actionDeleteSelected.tsx ALT/excalidraw/src/actions/actionDeleteSelected.tsx index b0486e0..02d5128 100644 --- ORI/excalidraw/src/actions/actionDeleteSelected.tsx +++ ALT/excalidraw/src/actions/actionDeleteSelected.tsx @@ -143,8 +143,10 @@ export const actionDeleteSelected = register({ commitToHistory: true, }; } - let { elements: nextElements, appState: nextAppState } = - deleteSelectedElements(elements, appState); + let { + elements: nextElements, + appState: nextAppState, + } = deleteSelectedElements(elements, appState); fixBindingsAfterDeletion( nextElements, elements.filter(({ id }) => appState.selectedElementIds[id]), diff --git ORI/excalidraw/src/actions/actionFinalize.tsx ALT/excalidraw/src/actions/actionFinalize.tsx index d7147c5..e708229 100644 --- ORI/excalidraw/src/actions/actionFinalize.tsx +++ ALT/excalidraw/src/actions/actionFinalize.tsx @@ -21,8 +21,11 @@ export const actionFinalize = register({ trackEvent: false, perform: (elements, appState, _, { canvas, focusContainer, scene }) => { if (appState.editingLinearElement) { - const { elementId, startBindingElement, endBindingElement } = - appState.editingLinearElement; + const { + elementId, + startBindingElement, + endBindingElement, + } = appState.editingLinearElement; const element = LinearElementEditor.getElement(elementId); if (element) { diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx index b5abc44..102f398 100644 --- ORI/excalidraw/src/components/App.tsx +++ ALT/excalidraw/src/components/App.tsx @@ -3619,22 +3619,26 @@ class App extends React.Component { this.state.gridSize, ); - const [lastCommittedX, lastCommittedY] = - multiElement?.lastCommittedPoint ?? [0, 0]; + const [ + lastCommittedX, + lastCommittedY, + ] = multiElement?.lastCommittedPoint ?? [0, 0]; let dxFromLastCommitted = gridX - rx - lastCommittedX; let dyFromLastCommitted = gridY - ry - lastCommittedY; if (shouldRotateWithDiscreteAngle(event)) { - ({ width: dxFromLastCommitted, height: dyFromLastCommitted } = - getLockedLinearCursorAlignSize( - // actual coordinate of the last committed point - lastCommittedX + rx, - lastCommittedY + ry, - // cursor-grid coordinate - gridX, - gridY, - )); + ({ + width: dxFromLastCommitted, + height: dyFromLastCommitted, + } = getLockedLinearCursorAlignSize( + // actual coordinate of the last committed point + lastCommittedX + rx, + lastCommittedY + ry, + // cursor-grid coordinate + gridX, + gridY, + )); } if (isPathALoop(points, this.state.zoom.value)) { @@ -5700,8 +5704,10 @@ class App extends React.Component { this.state, ); - const { startBindingElement, endBindingElement } = - linearElementEditor; + const { + startBindingElement, + endBindingElement, + } = linearElementEditor; const element = this.scene.getElement(linearElementEditor.elementId); if (isBindingElement(element)) { bindOrUnbindLinearElement( @@ -7025,8 +7031,10 @@ class App extends React.Component { const type = element || isHittignCommonBoundBox ? "element" : "canvas"; const container = this.excalidrawContainerRef.current!; - const { top: offsetTop, left: offsetLeft } = - container.getBoundingClientRect(); + const { + top: offsetTop, + left: offsetLeft, + } = container.getBoundingClientRect(); const left = event.clientX - offsetLeft; const top = event.clientY - offsetTop; diff --git ORI/excalidraw/src/components/LibraryMenuHeaderContent.tsx ALT/excalidraw/src/components/LibraryMenuHeaderContent.tsx index 56c8fe6..9afb631 100644 --- ORI/excalidraw/src/components/LibraryMenuHeaderContent.tsx +++ ALT/excalidraw/src/components/LibraryMenuHeaderContent.tsx @@ -95,8 +95,9 @@ export const LibraryDropdownMenuButton: React.FC<{ ? t("buttons.remove") : t("buttons.resetLibrary"); - const [showPublishLibraryDialog, setShowPublishLibraryDialog] = - useState(false); + const [showPublishLibraryDialog, setShowPublishLibraryDialog] = useState( + false, + ); const [publishLibSuccess, setPublishLibSuccess] = useState { - const { - width = 512, - height = width, - mirror, - style, - ...rest - } = typeof opts === "number" ? ({ width: opts } as Opts) : opts; + const { width = 512, height = width, mirror, style, ...rest } = + typeof opts === "number" ? ({ width: opts } as Opts) : opts; return (
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: prettier/prettier@2bd131fbd29e94e989e64904f1a628877d38ae3d

Diff (228 lines) ```diff diff --git ORI/prettier/scripts/benchmark/bench.js ALT/prettier/scripts/benchmark/bench.js index 59bc10c..455fbc9 100644 --- ORI/prettier/scripts/benchmark/bench.js +++ ALT/prettier/scripts/benchmark/bench.js @@ -1,7 +1,13 @@ import { readFileSync } from "node:fs"; -const [, , version, method, groupCountString = 100, groupSizeString = 10] = - process.argv; +const [ + , + , + version, + method, + groupCountString = 100, + groupSizeString = 10, +] = process.argv; const groupCount = Number(groupCountString); const groupSize = Number(groupSizeString); const { format } = await import(`./${version}/dist/index.mjs`); diff --git ORI/prettier/scripts/build/config.js ALT/prettier/scripts/build/config.js index 0d74ae4..3fc693b 100644 --- ORI/prettier/scripts/build/config.js +++ ALT/prettier/scripts/build/config.js @@ -11,11 +11,9 @@ import buildTypes from "./build-types.js"; import modifyTypescriptModule from "./modify-typescript-module.js"; import { getPackageFile } from "./utils.js"; -const { - require, - dirname, - resolve: importMetaResolve, -} = createEsmUtils(import.meta); +const { require, dirname, resolve: importMetaResolve } = createEsmUtils( + import.meta, +); const resolveEsmModulePath = async (specifier) => url.fileURLToPath(await importMetaResolve(specifier)); const copyFileBuilder = ({ file }) => @@ -415,8 +413,13 @@ const nonPluginUniversalFiles = [ const universalFiles = [...nonPluginUniversalFiles, ...pluginFiles].flatMap( (file) => { - let { input, outputBaseName, umdVariableName, buildOptions, isPlugin } = - file; + let { + input, + outputBaseName, + umdVariableName, + buildOptions, + isPlugin, + } = file; outputBaseName ??= path.basename(input); diff --git ORI/prettier/scripts/build/esbuild-plugins/replace-module.js ALT/prettier/scripts/build/esbuild-plugins/replace-module.js index fa6da59..1b367b9 100644 --- ORI/prettier/scripts/build/esbuild-plugins/replace-module.js +++ ALT/prettier/scripts/build/esbuild-plugins/replace-module.js @@ -192,8 +192,11 @@ export default function esbuildPluginReplaceModule({ onResolveConcepts = DEFAULT_ON_RESOLVE_CONCEPTS, replacements, }) { - const { onResolveReplacements, onLoadReplacements, onLoadProcessors } = - processReplacements(replacements); + const { + onResolveReplacements, + onLoadReplacements, + onLoadProcessors, + } = processReplacements(replacements); const onResolveListenerOptions = { concepts: onResolveConcepts, replacements: onResolveReplacements, diff --git ORI/prettier/src/language-html/print-preprocess.js ALT/prettier/src/language-html/print-preprocess.js index e19ce6c..b6d1666 100644 --- ORI/prettier/src/language-html/print-preprocess.js +++ ALT/prettier/src/language-html/print-preprocess.js @@ -278,8 +278,11 @@ function extractWhitespaces(ast /*, options*/) { continue; } - const { leadingWhitespace, text, trailingWhitespace } = - getLeadingAndTrailingHtmlWhitespace(child.value); + const { + leadingWhitespace, + text, + trailingWhitespace, + } = getLeadingAndTrailingHtmlWhitespace(child.value); const prevChild = child.prev; const nextChild = child.next; diff --git ORI/prettier/src/language-js/parse/postprocess/typescript.js ALT/prettier/src/language-js/parse/postprocess/typescript.js index 4c0735e..0f8a1b7 100644 --- ORI/prettier/src/language-js/parse/postprocess/typescript.js +++ ALT/prettier/src/language-js/parse/postprocess/typescript.js @@ -11,8 +11,10 @@ function getTsNodeLocation(nodeOrToken) { // @ts-expect-error -- internal? ts.rangeOfNode(nodeOrToken); const [start, end] = [position.pos, position.end].map((position) => { - const { line, character: column } = - sourceFile.getLineAndCharacterOfPosition(position); + const { + line, + character: column, + } = sourceFile.getLineAndCharacterOfPosition(position); return { line: line + 1, column }; }); diff --git ORI/prettier/src/language-markdown/mdx.js ALT/prettier/src/language-markdown/mdx.js index 632da38..43c6ca7 100644 --- ORI/prettier/src/language-markdown/mdx.js +++ ALT/prettier/src/language-markdown/mdx.js @@ -63,8 +63,12 @@ tokenizeEsComment.locator = (value, fromIndex) => value.indexOf("{", fromIndex); function esSyntax() { const { Parser } = this; - const { blockTokenizers, blockMethods, inlineTokenizers, inlineMethods } = - Parser.prototype; + const { + blockTokenizers, + blockMethods, + inlineTokenizers, + inlineMethods, + } = Parser.prototype; blockTokenizers.esSyntax = tokenizeEsSyntax; inlineTokenizers.esComment = tokenizeEsComment; diff --git ORI/prettier/src/language-markdown/printer-markdown.js ALT/prettier/src/language-markdown/printer-markdown.js index 9deaa3e..04850db 100644 --- ORI/prettier/src/language-markdown/printer-markdown.js +++ ALT/prettier/src/language-markdown/printer-markdown.js @@ -640,8 +640,10 @@ function printRoot(path, options, print) { } function printChildren(path, options, print, events = {}) { - const { postprocessor = (parts) => parts, processor = () => print() } = - events; + const { + postprocessor = (parts) => parts, + processor = () => print(), + } = events; const parts = []; diff --git ORI/prettier/src/main/comments/attach.js ALT/prettier/src/main/comments/attach.js index 6e22482..791b5a5 100644 --- ORI/prettier/src/main/comments/attach.js +++ ALT/prettier/src/main/comments/attach.js @@ -298,8 +298,10 @@ function isOwnLineComment(text, options, decoratedComments, commentIndex) { if (precedingNode) { // Find first comment on the same line for (let index = commentIndex - 1; index >= 0; index--) { - const { comment, precedingNode: currentCommentPrecedingNode } = - decoratedComments[index]; + const { + comment, + precedingNode: currentCommentPrecedingNode, + } = decoratedComments[index]; if ( currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment), start)) @@ -325,8 +327,10 @@ function isEndOfLineComment(text, options, decoratedComments, commentIndex) { index < decoratedComments.length; index++ ) { - const { comment, followingNode: currentCommentFollowingNode } = - decoratedComments[index]; + const { + comment, + followingNode: currentCommentFollowingNode, + } = decoratedComments[index]; if ( currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment))) diff --git ORI/prettier/tests/integration/__tests__/line-suffix-boundary.js ALT/prettier/tests/integration/__tests__/line-suffix-boundary.js index 15ba376..255dd28 100644 --- ORI/prettier/tests/integration/__tests__/line-suffix-boundary.js +++ ALT/prettier/tests/integration/__tests__/line-suffix-boundary.js @@ -3,8 +3,14 @@ import { outdent } from "outdent"; import prettier from "../../config/prettier-entry.js"; import printDoc from "../print-doc.js"; -const { group, indent, line, lineSuffix, lineSuffixBoundary, softline } = - prettier.doc.builders; +const { + group, + indent, + line, + lineSuffix, + lineSuffixBoundary, + softline, +} = prettier.doc.builders; describe("lineSuffixBoundary", () => { test("should be correctly treated as a potential line break in `fits`", async () => { diff --git ORI/prettier/tests/integration/__tests__/mockable.js ALT/prettier/tests/integration/__tests__/mockable.js index 2018bd1..42b9c3a 100644 --- ORI/prettier/tests/integration/__tests__/mockable.js +++ ALT/prettier/tests/integration/__tests__/mockable.js @@ -45,8 +45,9 @@ describe("cosmiconfig", () => { for (const { title, dirname, file, value } of configs) { test(`async version ${title}`, async () => { - const { config, filepath } = - await cosmiconfig("prettier").search(dirname); + const { config, filepath } = await cosmiconfig("prettier").search( + dirname, + ); expect(config).toEqual(value); expect(filepath).toBe(file); }); diff --git ORI/prettier/tests/integration/__tests__/util-shared.js ALT/prettier/tests/integration/__tests__/util-shared.js index 16d1eb2..0e93eef 100644 --- ORI/prettier/tests/integration/__tests__/util-shared.js +++ ALT/prettier/tests/integration/__tests__/util-shared.js @@ -164,8 +164,11 @@ test("sharedUtil.getNextNonSpaceNonCommentCharacter and sharedUtil.getNextNonSpa }); test("sharedUtil.isPreviousLineEmpty, sharedUtil.isNextLineEmpty and sharedUtil.isNextLineEmptyAfterIndex", () => { - const { isPreviousLineEmpty, isNextLineEmpty, isNextLineEmptyAfterIndex } = - sharedUtil; + const { + isPreviousLineEmpty, + isNextLineEmpty, + isNextLineEmptyAfterIndex, + } = sharedUtil; const FAKE_NODE_A = { type: "Identifier", name: "a" }; const FAKE_NODE_B = { type: "Identifier", name: "b" }; ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: marmelab/react-admin@fbf280286c715d6ef0c38d7111eab249aa929dc1

Diff (1245 lines) ```diff diff --git ORI/react-admin/examples/crm/src/dashboard/LatestNotes.tsx ALT/react-admin/examples/crm/src/dashboard/LatestNotes.tsx index 53cc3ba..0c9058d 100644 --- ORI/react-admin/examples/crm/src/dashboard/LatestNotes.tsx +++ ALT/react-admin/examples/crm/src/dashboard/LatestNotes.tsx @@ -14,16 +14,18 @@ import { Contact as ContactType } from '../types'; export const LatestNotes = () => { const { identity } = useGetIdentity(); - const { data: contactNotesData, isLoading: contactNotesLoading } = - useGetList( - 'contactNotes', - { - pagination: { page: 1, perPage: 5 }, - sort: { field: 'date', order: 'DESC' }, - filter: { sales_id: identity?.id }, - }, - { enabled: Number.isInteger(identity?.id) } - ); + const { + data: contactNotesData, + isLoading: contactNotesLoading, + } = useGetList( + 'contactNotes', + { + pagination: { page: 1, perPage: 5 }, + sort: { field: 'date', order: 'DESC' }, + filter: { sales_id: identity?.id }, + }, + { enabled: Number.isInteger(identity?.id) } + ); const { data: dealNotesData, isLoading: dealNotesLoading } = useGetList( 'dealNotes', { diff --git ORI/react-admin/examples/crm/src/deals/DealListContent.tsx ALT/react-admin/examples/crm/src/deals/DealListContent.tsx index 71d5ecc..0efe011 100644 --- ORI/react-admin/examples/crm/src/deals/DealListContent.tsx +++ ALT/react-admin/examples/crm/src/deals/DealListContent.tsx @@ -192,19 +192,21 @@ export const DealListContent = () => { // update backend // Fetch all the deals in both stages (because the list may be filtered, but we need to update even non-filtered deals) - const [{ data: sourceDeals }, { data: destinationDeals }] = - await Promise.all([ - dataProvider.getList('deals', { - sort: { field: 'index', order: 'ASC' }, - pagination: { page: 1, perPage: 100 }, - filter: { stage: source.droppableId }, - }), - dataProvider.getList('deals', { - sort: { field: 'index', order: 'ASC' }, - pagination: { page: 1, perPage: 100 }, - filter: { stage: destination.droppableId }, - }), - ]); + const [ + { data: sourceDeals }, + { data: destinationDeals }, + ] = await Promise.all([ + dataProvider.getList('deals', { + sort: { field: 'index', order: 'ASC' }, + pagination: { page: 1, perPage: 100 }, + filter: { stage: source.droppableId }, + }), + dataProvider.getList('deals', { + sort: { field: 'index', order: 'ASC' }, + pagination: { page: 1, perPage: 100 }, + filter: { stage: destination.droppableId }, + }), + ]); await Promise.all([ // decrease index on the deals after the source index in the source columns diff --git ORI/react-admin/examples/crm/src/deals/OnlyMineInput.tsx ALT/react-admin/examples/crm/src/deals/OnlyMineInput.tsx index 9dd2ed9..bc98769 100644 --- ORI/react-admin/examples/crm/src/deals/OnlyMineInput.tsx +++ ALT/react-admin/examples/crm/src/deals/OnlyMineInput.tsx @@ -3,8 +3,11 @@ import { useListFilterContext, useGetIdentity } from 'react-admin'; import { Box, Switch, FormControlLabel } from '@mui/material'; export const OnlyMineInput = (_: { alwaysOn: boolean }) => { - const { filterValues, displayedFilters, setFilters } = - useListFilterContext(); + const { + filterValues, + displayedFilters, + setFilters, + } = useListFilterContext(); const { identity } = useGetIdentity(); const handleChange = () => { diff --git ORI/react-admin/examples/demo/src/dashboard/PendingReviews.tsx ALT/react-admin/examples/demo/src/dashboard/PendingReviews.tsx index 23eee09..f51a82c 100644 --- ORI/react-admin/examples/demo/src/dashboard/PendingReviews.tsx +++ ALT/react-admin/examples/demo/src/dashboard/PendingReviews.tsx @@ -27,11 +27,7 @@ import { Customer, Review } from '../types'; const PendingReviews = () => { const translate = useTranslate(); - const { - data: reviews, - total, - isLoading, - } = useGetList('reviews', { + const { data: reviews, total, isLoading } = useGetList('reviews', { filter: { status: 'pending' }, sort: { field: 'date', order: 'DESC' }, pagination: { page: 1, perPage: 100 }, diff --git ORI/react-admin/packages/ra-core/src/auth/WithPermissions.tsx ALT/react-admin/packages/ra-core/src/auth/WithPermissions.tsx index 8ec2c8e..a19cb38 100644 --- ORI/react-admin/packages/ra-core/src/auth/WithPermissions.tsx +++ ALT/react-admin/packages/ra-core/src/auth/WithPermissions.tsx @@ -60,8 +60,14 @@ const isEmptyChildren = children => Children.count(children) === 0; * ); */ const WithPermissions = (props: WithPermissionsProps) => { - const { authParams, children, render, component, staticContext, ...rest } = - props; + const { + authParams, + children, + render, + component, + staticContext, + ...rest + } = props; warning( (render && children && !isEmptyChildren(children)) || (render && component) || diff --git ORI/react-admin/packages/ra-core/src/controller/create/useCreateController.ts ALT/react-admin/packages/ra-core/src/controller/create/useCreateController.ts index 690e686..6b8deb7 100644 --- ORI/react-admin/packages/ra-core/src/controller/create/useCreateController.ts +++ ALT/react-admin/packages/ra-core/src/controller/create/useCreateController.ts @@ -68,8 +68,12 @@ export const useCreateController = < const notify = useNotify(); const redirect = useRedirect(); const recordToUse = record ?? getRecordFromLocation(location) ?? undefined; - const { onSuccess, onError, meta, ...otherMutationOptions } = - mutationOptions; + const { + onSuccess, + onError, + meta, + ...otherMutationOptions + } = mutationOptions; const { registerMutationMiddleware, getMutateWithMiddlewares, diff --git ORI/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts ALT/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts index fa25351..0cc0a1b 100644 --- ORI/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts +++ ALT/react-admin/packages/ra-core/src/controller/field/useReferenceArrayFieldController.ts @@ -69,30 +69,35 @@ export const useReferenceArrayFieldController = < return emptyArray; }, [value, source]); - const { data, error, isLoading, isFetching, refetch } = - useGetManyAggregate( - reference, - { ids }, - { - onError: error => - notify( - typeof error === 'string' - ? error - : error.message || 'ra.notification.http_error', - { - type: 'error', - messageArgs: { - _: - typeof error === 'string' - ? error - : error && error.message - ? error.message - : undefined, - }, - } - ), - } - ); + const { + data, + error, + isLoading, + isFetching, + refetch, + } = useGetManyAggregate( + reference, + { ids }, + { + onError: error => + notify( + typeof error === 'string' + ? error + : error.message || 'ra.notification.http_error', + { + type: 'error', + messageArgs: { + _: + typeof error === 'string' + ? error + : error && error.message + ? error.message + : undefined, + }, + } + ), + } + ); const listProps = useList({ data, diff --git ORI/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts ALT/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts index 04de0d2..a44cd47 100644 --- ORI/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts +++ ALT/react-admin/packages/ra-core/src/controller/field/useReferenceManyFieldController.ts @@ -144,37 +144,44 @@ export const useReferenceManyFieldController = < } }); - const { data, total, pageInfo, error, isFetching, isLoading, refetch } = - useGetManyReference( - reference, - { - target, - id: get(record, source) as Identifier, - pagination: { page, perPage }, - sort, - filter: filterValues, - }, - { - keepPreviousData: true, - onError: error => - notify( - typeof error === 'string' - ? error - : error.message || 'ra.notification.http_error', - { - type: 'error', - messageArgs: { - _: - typeof error === 'string' - ? error - : error && error.message - ? error.message - : undefined, - }, - } - ), - } - ); + const { + data, + total, + pageInfo, + error, + isFetching, + isLoading, + refetch, + } = useGetManyReference( + reference, + { + target, + id: get(record, source) as Identifier, + pagination: { page, perPage }, + sort, + filter: filterValues, + }, + { + keepPreviousData: true, + onError: error => + notify( + typeof error === 'string' + ? error + : error.message || 'ra.notification.http_error', + { + type: 'error', + messageArgs: { + _: + typeof error === 'string' + ? error + : error && error.message + ? error.message + : undefined, + }, + } + ), + } + ); return { sort, diff --git ORI/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx ALT/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx index 889d34e..8e297ba 100644 --- ORI/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx +++ ALT/react-admin/packages/ra-core/src/controller/field/useReferenceOneFieldController.tsx @@ -61,39 +61,44 @@ export const useReferenceOneFieldController = < const notify = useNotify(); const { meta, ...otherQueryOptions } = queryOptions; - const { data, error, isFetching, isLoading, refetch } = - useGetManyReference( - reference, - { - target, - id: get(record, source), - pagination: { page: 1, perPage: 1 }, - sort, - filter, - meta, - }, - { - enabled: !!record, - onError: error => - notify( - typeof error === 'string' - ? error - : error.message || 'ra.notification.http_error', - { - type: 'error', - messageArgs: { - _: - typeof error === 'string' - ? error - : error && error.message - ? error.message - : undefined, - }, - } - ), - ...otherQueryOptions, - } - ); + const { + data, + error, + isFetching, + isLoading, + refetch, + } = useGetManyReference( + reference, + { + target, + id: get(record, source), + pagination: { page: 1, perPage: 1 }, + sort, + filter, + meta, + }, + { + enabled: !!record, + onError: error => + notify( + typeof error === 'string' + ? error + : error.message || 'ra.notification.http_error', + { + type: 'error', + messageArgs: { + _: + typeof error === 'string' + ? error + : error && error.message + ? error.message + : undefined, + }, + } + ), + ...otherQueryOptions, + } + ); return { referenceRecord: data ? data[0] : undefined, diff --git ORI/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx ALT/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx index 942f54b..becbde5 100644 --- ORI/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx +++ ALT/react-admin/packages/ra-core/src/controller/list/InfiniteListBase.stories.tsx @@ -57,8 +57,14 @@ const dataProvider = new Proxy(baseDataProvider, { }); const BookListView = () => { - const { data, isLoading, sort, setSort, filterValues, setFilters } = - useListContext(); + const { + data, + isLoading, + sort, + setSort, + filterValues, + setFilters, + } = useListContext(); if (isLoading) { return
Loading...
; } 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 a640c04..76d90fd 100644 --- ORI/react-admin/packages/ra-core/src/controller/list/useListController.ts +++ ALT/react-admin/packages/ra-core/src/controller/list/useListController.ts @@ -74,31 +74,38 @@ export const useListController = ( const [selectedIds, selectionModifiers] = useRecordSelection(resource); - const { data, pageInfo, total, error, isLoading, isFetching, refetch } = - useGetList( - resource, - { - pagination: { - page: query.page, - perPage: query.perPage, - }, - sort: { field: query.sort, order: query.order }, - filter: { ...query.filter, ...filter }, - meta, + const { + data, + pageInfo, + total, + error, + isLoading, + isFetching, + refetch, + } = useGetList( + resource, + { + pagination: { + page: query.page, + perPage: query.perPage, }, - { - keepPreviousData: true, - retry: false, - onError: error => - notify(error?.message || 'ra.notification.http_error', { - type: 'error', - messageArgs: { - _: error?.message, - }, - }), - ...otherQueryOptions, - } - ); + sort: { field: query.sort, order: query.order }, + filter: { ...query.filter, ...filter }, + meta, + }, + { + keepPreviousData: true, + retry: false, + onError: error => + notify(error?.message || 'ra.notification.http_error', { + type: 'error', + messageArgs: { + _: error?.message, + }, + }), + ...otherQueryOptions, + } + ); // change page if there is no data useEffect(() => { diff --git ORI/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts ALT/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts index 8e90697..58ccdab 100644 --- ORI/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts +++ ALT/react-admin/packages/ra-core/src/controller/saveContext/useRegisterMutationMiddleware.ts @@ -11,8 +11,10 @@ export const useRegisterMutationMiddleware = < >( callback: Middleware ) => { - const { registerMutationMiddleware, unregisterMutationMiddleware } = - useSaveContext(); + const { + registerMutationMiddleware, + unregisterMutationMiddleware, + } = useSaveContext(); useEffect(() => { registerMutationMiddleware(callback); diff --git ORI/react-admin/packages/ra-core/src/controller/useReference.ts ALT/react-admin/packages/ra-core/src/controller/useReference.ts index b622ef9..a92bd83 100644 --- ORI/react-admin/packages/ra-core/src/controller/useReference.ts +++ ALT/react-admin/packages/ra-core/src/controller/useReference.ts @@ -50,12 +50,17 @@ export const useReference = ({ options = {}, }: UseReferenceProps): UseReferenceResult => { const { meta, ...otherQueryOptions } = options; - const { data, error, isLoading, isFetching, refetch } = - useGetManyAggregate( - reference, - { ids: [id], meta }, - otherQueryOptions - ); + const { + data, + error, + isLoading, + isFetching, + refetch, + } = useGetManyAggregate( + reference, + { ids: [id], meta }, + otherQueryOptions + ); return { referenceRecord: error ? undefined : data ? data[0] : undefined, refetch, diff --git ORI/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx ALT/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx index 1162c9b..ad2bcdb 100644 --- ORI/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx +++ ALT/react-admin/packages/ra-core/src/core/ResourceDefinitionContext.tsx @@ -48,8 +48,9 @@ export const ResourceDefinitionContextProvider = ({ definitions?: ResourceDefinitions; children: React.ReactNode; }) => { - const [definitions, setState] = - useState(defaultDefinitions); + const [definitions, setState] = useState( + defaultDefinitions + ); const register = useCallback((config: ResourceDefinition) => { setState(prev => diff --git ORI/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx ALT/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx index c6eadca..71c3c06 100644 --- ORI/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx +++ ALT/react-admin/packages/ra-core/src/core/useConfigureAdminRouterFromChildren.tsx @@ -79,8 +79,11 @@ const useRoutesAndResourcesFromChildren = ( // We need to know right away whether some resources were declared to correctly // initialize the status at the next stop const doLogout = useLogout(); - const [routesAndResources, setRoutesAndResources, mergeRoutesAndResources] = - useRoutesAndResourcesState(getRoutesAndResourceFromNodes(children)); + const [ + routesAndResources, + setRoutesAndResources, + mergeRoutesAndResources, + ] = useRoutesAndResourcesState(getRoutesAndResourceFromNodes(children)); const [status, setStatus] = useSafeSetState(() => getStatus({ diff --git ORI/react-admin/packages/ra-core/src/core/useResourceDefinition.ts ALT/react-admin/packages/ra-core/src/core/useResourceDefinition.ts index 424d538..b7f16b6 100644 --- ORI/react-admin/packages/ra-core/src/core/useResourceDefinition.ts +++ ALT/react-admin/packages/ra-core/src/core/useResourceDefinition.ts @@ -33,8 +33,13 @@ export const useResourceDefinition = < ): ResourceDefinition => { const resource = useResourceContext(props); const resourceDefinitions = useResourceDefinitions(); - const { hasCreate, hasEdit, hasList, hasShow, recordRepresentation } = - props || {}; + const { + hasCreate, + hasEdit, + hasList, + hasShow, + recordRepresentation, + } = props || {}; const definition = useMemo(() => { return defaults( diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useCreate.ts ALT/react-admin/packages/ra-core/src/dataProvider/useCreate.ts index fa9a8e9..ad53d07 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useCreate.ts +++ ALT/react-admin/packages/ra-core/src/dataProvider/useCreate.ts @@ -130,8 +130,10 @@ export const useCreate = < unknown > & { returnPromise?: boolean } = {} ) => { - const { returnPromise = options.returnPromise, ...reactCreateOptions } = - createOptions; + const { + returnPromise = options.returnPromise, + ...reactCreateOptions + } = createOptions; if (returnPromise) { return mutation.mutateAsync( { resource: callTimeResource, ...callTimeParams }, diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts ALT/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts index 354688a..7fea7e7 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts +++ ALT/react-admin/packages/ra-core/src/dataProvider/useGetManyAggregate.ts @@ -234,8 +234,12 @@ const callGetManyQueries = batch((calls: GetManyCallArgs[]) => { // There is only one call (no aggregation), or one of the calls has the same ids as the sum of all calls. // Either way, we can't trigger a new fetchQuery with the same signature, as it's already pending. // Therefore, we reply with the dataProvider - const { dataProvider, resource, ids, meta } = - callThatHasAllAggregatedIds; + const { + dataProvider, + resource, + ids, + meta, + } = callThatHasAllAggregatedIds; dataProvider .getMany(resource, { ids, meta }) diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx ALT/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx index 18ece81..934902f 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx +++ ALT/react-admin/packages/ra-core/src/dataProvider/useInfiniteGetList.stories.tsx @@ -56,12 +56,16 @@ const UseInfiniteComponent = ({ options = {}, meta = undefined, }) => { - const { data, fetchNextPage, hasNextPage, isFetchingNextPage } = - useInfiniteGetList( - resource, - { pagination, sort, filter, meta }, - options - ); + const { + data, + fetchNextPage, + hasNextPage, + isFetchingNextPage, + } = useInfiniteGetList( + resource, + { pagination, sort, filter, meta }, + options + ); return (
@@ -168,11 +172,15 @@ export const InfiniteScroll = () => { }; const UseInfiniteComponentWithIntersectionObserver = () => { - const { data, fetchNextPage, hasNextPage, isFetchingNextPage } = - useInfiniteGetList('countries', { - pagination: { page: 1, perPage: 20 }, - sort: { field: 'id', order: 'DESC' }, - }); + const { + data, + fetchNextPage, + hasNextPage, + isFetchingNextPage, + } = useInfiniteGetList('countries', { + pagination: { page: 1, perPage: 20 }, + sort: { field: 'id', order: 'DESC' }, + }); const observerElem = useRef(null); const handleObserver = useCallback( diff --git ORI/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts ALT/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts index f8e13ff..85eb593 100644 --- ORI/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts +++ ALT/react-admin/packages/ra-core/src/dataProvider/useUpdateMany.ts @@ -302,8 +302,13 @@ export const useUpdateMany = < unknown > & { mutationMode?: MutationMode; returnPromise?: boolean } = {} ) => { - const { mutationMode, returnPromise, onSuccess, onSettled, onError } = - updateOptions; + const { + mutationMode, + returnPromise, + onSuccess, + onSettled, + onError, + } = updateOptions; // store the hook time params *at the moment of the call* // because they may change afterwards, which would break the undoable mode diff --git ORI/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts ALT/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts index d6e93bb..89bf013 100644 --- ORI/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts +++ ALT/react-admin/packages/ra-core/src/form/useApplyInputDefaultValues.ts @@ -33,8 +33,13 @@ export const useApplyInputDefaultValues = ({ }: Props) => { const { defaultValue, source } = inputProps; const record = useRecordContext(inputProps); - const { getValues, resetField, getFieldState, formState, reset } = - useFormContext(); + const { + getValues, + resetField, + getFieldState, + formState, + reset, + } = useFormContext(); const recordValue = get(record, source); const formValue = get(getValues(), source); const { isDirty } = getFieldState(source, formState); diff --git ORI/react-admin/packages/ra-core/src/form/useInput.ts ALT/react-admin/packages/ra-core/src/form/useInput.ts index b4a330f..eb50397 100644 --- ORI/react-admin/packages/ra-core/src/form/useInput.ts +++ ALT/react-admin/packages/ra-core/src/form/useInput.ts @@ -65,11 +65,7 @@ export const useInput = ( // This ensures dynamically added inputs have their value set correctly (ArrayInput for example). // We don't do this for the form level defaultValues so that it works as it should in react-hook-form // (i.e. field level defaultValue override form level defaultValues for this field). - const { - field: controllerField, - fieldState, - formState, - } = useController({ + const { field: controllerField, fieldState, formState } = useController({ name: finalName, defaultValue: get(record, source, defaultValue), rules: { diff --git ORI/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts ALT/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts index 22fb03f..a31fbcc 100644 --- ORI/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts +++ ALT/react-admin/packages/ra-core/src/i18n/TranslationUtils.ts @@ -43,8 +43,11 @@ export const resolveBrowserLocale = ( ): string => { // from http://blog.ksol.fr/user-locale-detection-browser-javascript/ // Rely on the window.navigator object to determine user locale - const { language, browserLanguage, userLanguage } = - window.navigator as AllNavigatorLanguage; + const { + language, + browserLanguage, + userLanguage, + } = window.navigator as AllNavigatorLanguage; const locale = language || diff --git ORI/react-admin/packages/ra-core/src/notification/useNotify.ts ALT/react-admin/packages/ra-core/src/notification/useNotify.ts index ca7d399..15b56f6 100644 --- ORI/react-admin/packages/ra-core/src/notification/useNotify.ts +++ ALT/react-admin/packages/ra-core/src/notification/useNotify.ts @@ -25,8 +25,10 @@ export const useNotify = () => { message: string | ReactNode, options: NotificationOptions & { type?: NotificationType } = {} ) => { - const { type: messageType = 'info', ...notificationOptions } = - options; + const { + type: messageType = 'info', + ...notificationOptions + } = options; addNotification({ message, type: messageType, diff --git ORI/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx ALT/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx index 25913c6..de202d4 100644 --- ORI/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx +++ ALT/react-admin/packages/ra-input-rich-text/src/buttons/ColorButtons.tsx @@ -29,8 +29,10 @@ enum ColorType { export const ColorButtons = (props: Omit) => { const translate = useTranslate(); const editor = useTiptapEditor(); - const [showColorChoiceDialog, setShowColorChoiceDialog] = - React.useState(false); + const [ + showColorChoiceDialog, + setShowColorChoiceDialog, + ] = React.useState(false); const [colorType, setColorType] = React.useState(ColorType.FONT); const colorLabel = translate('ra.tiptap.color', { _: 'Color' }); diff --git ORI/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx ALT/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx index 1a4121d..76b2d12 100644 --- ORI/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx +++ ALT/react-admin/packages/ra-no-code/src/ResourceConfiguration/ResourceConfigurationProvider.tsx @@ -13,10 +13,12 @@ export const ResourceConfigurationProvider = ({ dataProvider, storageKey = STORAGE_KEY, }: ResourceConfigurationProviderProps) => { - const [resources, setInternalResources] = - useState(() => - loadConfigurationsFromLocalStorage(storageKey) - ); + const [ + resources, + setInternalResources, + ] = useState(() => + loadConfigurationsFromLocalStorage(storageKey) + ); const setResources = useCallback( ( diff --git ORI/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx ALT/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx index 106cb92..31856e7 100644 --- ORI/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx +++ ALT/react-admin/packages/ra-no-code/src/ui/NewResourceMenuItem.tsx @@ -35,8 +35,9 @@ export const NewResourceMenuItem = ( props: MenuItemProps<'li', { button?: true } & { sidebarIsOpen: boolean }> ) => { const { sidebarIsOpen, ...rest } = props; - const [showImportResourceDialog, setShowImportResourceDialog] = - useState(false); + const [showImportResourceDialog, setShowImportResourceDialog] = useState( + false + ); const handleClick = () => { setShowImportResourceDialog(true); diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx index d12aaf1..c3ca43b 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceManyCount.tsx @@ -46,19 +46,22 @@ export const ReferenceManyCount = ( const oneSecondHasPassed = useTimeout(timeout); const createPath = useCreatePath(); - const { isLoading, error, total } = - useReferenceManyFieldController({ - filter, - sort, - page: 1, - perPage: 1, - record, - reference, - // @ts-ignore remove when #8491 is released - resource, - source, - target, - }); + const { + isLoading, + error, + total, + } = useReferenceManyFieldController({ + filter, + sort, + page: 1, + perPage: 1, + record, + reference, + // @ts-ignore remove when #8491 is released + resource, + source, + target, + }); const body = isLoading ? ( oneSecondHasPassed ? ( diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx index 2c0f9ad..67ffd75 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/field/ReferenceOneField.tsx @@ -47,16 +47,21 @@ export const ReferenceOneField = < const createPath = useCreatePath(); const translate = useTranslate(); - const { isLoading, isFetching, referenceRecord, error, refetch } = - useReferenceOneFieldController({ - record, - reference, - source, - target, - sort, - filter, - queryOptions, - }); + const { + isLoading, + isFetching, + referenceRecord, + error, + refetch, + } = useReferenceOneFieldController({ + record, + reference, + source, + target, + sort, + filter, + queryOptions, + }); const resourceLinkPath = link === false diff --git ORI/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx ALT/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx index 98436b0..53794f5 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/field/TranslatableFields.spec.tsx @@ -64,8 +64,11 @@ describe('', () => { it('should allow to customize the locale selector', () => { const Selector = () => { - const { locales, selectLocale, selectedLocale } = - useTranslatableContext(); + const { + locales, + selectLocale, + selectedLocale, + } = useTranslatableContext(); const handleChange = (event): void => { selectLocale(event.target.value); diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx index 5fbd079..c925c1a 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/ArrayInput/ArrayInput.tsx @@ -95,8 +95,13 @@ export const ArrayInput = (props: ArrayInputProps) => { : validate; const getValidationErrorMessage = useGetValidationErrorMessage(); - const { getFieldState, formState, getValues, register, unregister } = - useFormContext(); + const { + getFieldState, + formState, + getValues, + register, + unregister, + } = useFormContext(); const fieldProps = useFieldArray({ name: source, diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx index b746ee1..de27f58 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/NumberInput.stories.tsx @@ -261,8 +261,13 @@ export const Sx = () => ( ); const FormStateInspector = () => { - const { touchedFields, isDirty, dirtyFields, isValid, errors } = - useFormState(); + const { + touchedFields, + isDirty, + dirtyFields, + isValid, + errors, + } = useFormState(); return (
form state:  diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx index 0680271..4c94cfc 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/ResettableTextField.tsx @@ -62,8 +62,10 @@ export const ResettableTextField = forwardRef( visibleClearIcon, } = ResettableTextFieldClasses; - const { endAdornment, ...InputPropsWithoutEndAdornment } = - InputProps || {}; + const { + endAdornment, + ...InputPropsWithoutEndAdornment + } = InputProps || {}; if (clearAlwaysVisible && endAdornment) { throw new Error( diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx index 5449df2..45b1925 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/TextInput.stories.tsx @@ -214,8 +214,13 @@ export const ExtraProps = () => ( ); const FormStateInspector = () => { - const { touchedFields, isDirty, dirtyFields, isValid, errors } = - useFormState(); + const { + touchedFields, + isDirty, + dirtyFields, + isValid, + errors, + } = useFormState(); return (
form state:  diff --git ORI/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx ALT/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx index 34d20d1..758023c 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/input/TranslatableInputs.spec.tsx @@ -77,8 +77,11 @@ describe('', () => { const handleSubmit = jest.fn(); const Selector = () => { - const { locales, selectLocale, selectedLocale } = - useTranslatableContext(); + const { + locales, + selectLocale, + selectedLocale, + } = useTranslatableContext(); const handleChange = (event, newLocale): void => { selectLocale(newLocale); @@ -194,8 +197,11 @@ describe('', () => { it('should allow to customize the locale selector', () => { const Selector = () => { - const { locales, selectLocale, selectedLocale } = - useTranslatableContext(); + const { + locales, + selectLocale, + selectedLocale, + } = useTranslatableContext(); const handleChange = (event): void => { selectLocale(event.target.value); diff --git ORI/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx ALT/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx index 2051f8c..dfe7a41 100644 --- ORI/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx +++ ALT/react-admin/packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx @@ -197,8 +197,11 @@ export const PaginationInfinite = () => ( ); const LoadMore = () => { - const { hasNextPage, fetchNextPage, isFetchingNextPage } = - useInfinitePaginationContext(); + const { + hasNextPage, + fetchNextPage, + isFetchingNextPage, + } = useInfinitePaginationContext(); return hasNextPage ? (
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: typescript-eslint/typescript-eslint@4bf2d7360eaf74c9ef87b196ff4c459b8f50800b

Diff (149 lines) ```diff diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts index 0c671d8..9746d15 100644 --- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts +++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts @@ -51,8 +51,9 @@ export default createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); + const { program, esTreeNodeToTSNodeMap } = ESLintUtils.getParserServices( + context, + ); const checker = program.getTypeChecker(); return { diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index 313a32e..aeb4595 100644 --- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -148,8 +148,9 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); + const { program, esTreeNodeToTSNodeMap } = ESLintUtils.getParserServices( + context, + ); const checker = program.getTypeChecker(); const checkedObjects = new Set(); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 5436405..69bbaa9 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -270,8 +270,12 @@ function* fixSeparateNamedExports( sourceCode: Readonly, report: ReportValueExport, ): IterableIterator { - const { node, typeBasedSpecifiers, inlineTypeSpecifiers, valueSpecifiers } = - report; + const { + node, + typeBasedSpecifiers, + inlineTypeSpecifiers, + valueSpecifiers, + } = report; const typeSpecifiers = typeBasedSpecifiers.concat(inlineTypeSpecifiers); const source = getSourceFromExport(node); const specifierNames = typeSpecifiers.map(getSpecifierText).join(', '); diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 4c5cf77..ce74e7c 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -610,8 +610,11 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = - classifySpecifier(node); + const { + defaultSpecifier, + namespaceSpecifier, + namedSpecifiers, + } = classifySpecifier(node); if (namespaceSpecifier && !defaultSpecifier) { // import * as types from 'foo' @@ -854,8 +857,11 @@ export default util.createRule({ ): IterableIterator { const { node } = report; - const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = - classifySpecifier(node); + const { + defaultSpecifier, + namespaceSpecifier, + namedSpecifiers, + } = classifySpecifier(node); if (namespaceSpecifier) { // import type * as types from 'foo' diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts index 2b10c97..a80633a 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -201,8 +201,9 @@ export default util.createRule({ function findVariablesInScope(scope: TSESLint.Scope.Scope): void { for (const variable of scope.variables) { - const [declaration, ...extraDeclarations] = - iterateDeclarations(variable); + const [declaration, ...extraDeclarations] = iterateDeclarations( + variable, + ); if (extraDeclarations.length === 0) { continue; diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts index 3a9e6cd..d1ad20c 100644 --- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -191,8 +191,9 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); for (const violatingNode of finalizedClassScope.finalizeUnmodifiedPrivateNonReadonlys()) { - const { esNode, nameNode } = - getEsNodesFromViolatingNode(violatingNode); + const { esNode, nameNode } = getEsNodesFromViolatingNode( + violatingNode, + ); context.report({ data: { name: sourceCode.getText(nameNode), diff --git ORI/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts ALT/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts index 0b7da71..6fde9d6 100644 --- ORI/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts +++ ALT/typescript-eslint/packages/eslint-plugin/tools/generate-breaking-changes.ts @@ -95,8 +95,11 @@ async function main(): Promise { ['Rule', 'Status', 'Ext', 'R', 'RWT', 'Strict', 'Comment'], ...Object.entries(rules).map(([ruleName, { meta }]) => { const { deprecated } = meta; - const { extendsBaseRule, recommended, requiresTypeChecking } = - meta.docs!; + const { + extendsBaseRule, + recommended, + requiresTypeChecking, + } = meta.docs!; return [ `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, diff --git ORI/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts ALT/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts index 623157e..5826594 100644 --- ORI/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts +++ ALT/typescript-eslint/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts @@ -88,8 +88,10 @@ class RuleTester extends BaseRuleTester.RuleTester { constructor(baseOptions: RuleTesterConfig) { // eslint will hard-error if you include non-standard top-level properties - const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = - baseOptions; + const { + dependencyConstraints: _, + ...baseOptionsSafeForESLint + } = baseOptions; super({ ...baseOptionsSafeForESLint, parserOptions: { ```
github-actions[bot] commented 9 months ago

prettier/prettier#15447 VS prettier/prettier@main :: vega/vega-lite@c9659206602eda1d894702a2a1f5b526b9832f9f

Diff (102 lines) ```diff diff --git ORI/vega-lite/src/compile/header/assemble.ts ALT/vega-lite/src/compile/header/assemble.ts index 1bc2959..1f54fda 100644 --- ORI/vega-lite/src/compile/header/assemble.ts +++ ALT/vega-lite/src/compile/header/assemble.ts @@ -40,11 +40,12 @@ export function assembleTitleGroup(model: Model, channel: FacetChannel) { ? model.component.layoutHeaders[channel].facetFieldDef : undefined; - const { - titleAnchor, - titleAngle: ta, - titleOrient - } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel); + const {titleAnchor, titleAngle: ta, titleOrient} = getHeaderProperties( + ['titleAnchor', 'titleAngle', 'titleOrient'], + facetFieldDef.header, + config, + channel + ); const headerChannel = getHeaderChannel(channel, titleOrient); const titleAngle = normalizeAngle(ta); diff --git ORI/vega-lite/src/compositemark/boxplot.ts ALT/vega-lite/src/compositemark/boxplot.ts index e047c2d..67b9cef 100644 --- ORI/vega-lite/src/compositemark/boxplot.ts +++ ALT/vega-lite/src/compositemark/boxplot.ts @@ -402,13 +402,10 @@ function boxParams( oldEncodingWithoutContinuousAxis ); - const { - bins, - timeUnits, - aggregate, - groupby, - encoding: encodingWithoutContinuousAxis - } = extractTransformsFromEncoding(filteredEncoding, config); + const {bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis} = extractTransformsFromEncoding( + filteredEncoding, + config + ); const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical'; const boxOrient: Orientation = orient; diff --git ORI/vega-lite/src/compositemark/errorbar.ts ALT/vega-lite/src/compositemark/errorbar.ts index 527efd4..d1c0cb7 100644 --- ORI/vega-lite/src/compositemark/errorbar.ts +++ ALT/vega-lite/src/compositemark/errorbar.ts @@ -360,17 +360,21 @@ export function errorBarParams< continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark); - const {errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName} = - errorBarAggregationAndCalculation( - markDef, - continuousAxisChannelDef, - continuousAxisChannelDef2, - continuousAxisChannelDefError, - continuousAxisChannelDefError2, - inputType, - compositeMark, - config - ); + const { + errorBarSpecificAggregate, + postAggregateCalculates, + tooltipSummary, + tooltipTitleWithFieldName + } = errorBarAggregationAndCalculation( + markDef, + continuousAxisChannelDef, + continuousAxisChannelDef2, + continuousAxisChannelDefError, + continuousAxisChannelDefError2, + inputType, + compositeMark, + config + ); const { [continuousAxis]: oldContinuousAxisChannelDef, diff --git ORI/vega-lite/src/scale.ts ALT/vega-lite/src/scale.ts index c90e7b1..898da54 100644 --- ORI/vega-lite/src/scale.ts +++ ALT/vega-lite/src/scale.ts @@ -754,8 +754,15 @@ const SCALE_PROPERTY_INDEX: Flag> = { export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX); -const {type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX} = - SCALE_PROPERTY_INDEX; +const { + type, + domain, + range, + rangeMax, + rangeMin, + scheme, + ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX +} = SCALE_PROPERTY_INDEX; export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); ```