prettier / prettier-regression-testing

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

v3 #348

Closed sosukesuzuki closed 1 year ago

sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

github-actions[bot] commented 1 year ago

[Error]

HttpError: Validation Failed: {"resource":"IssueComment","code":"unprocessable","field":"data","message":"Body is too long (maximum is 65536 characters)"}
sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: babel/babel@134aa1723c6aa01a42713e379142088b30c6cc0d

Diff (292 lines) ```diff diff --git ORI/babel/packages/babel-cli/test/index.js ALT/babel/packages/babel-cli/test/index.js index 9f7cc422..ad1fd5f0 100644 --- ORI/babel/packages/babel-cli/test/index.js +++ ALT/babel/packages/babel-cli/test/index.js @@ -320,9 +320,11 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) { parseInt(process.versions.node, 10) < opts.minNodeVersion; // eslint-disable-next-line jest/valid-title - (skip - ? it.skip - : it)(testName, buildTest(binName, testName, opts), 20000); + (skip ? it.skip : it)( + testName, + buildTest(binName, testName, opts), + 20000, + ); }); }); }); diff --git ORI/babel/packages/babel-core/test/api.js ALT/babel/packages/babel-core/test/api.js index 54b8ead5..2e409d29 100644 --- ORI/babel/packages/babel-core/test/api.js +++ ALT/babel/packages/babel-core/test/api.js @@ -667,19 +667,19 @@ describe("api", function () { }); it("code option false", function () { - return transformAsync("foo('bar');", { code: false }).then(function ( - result, - ) { - expect(result.code).toBeFalsy(); - }); + return transformAsync("foo('bar');", { code: false }).then( + function (result) { + expect(result.code).toBeFalsy(); + }, + ); }); it("ast option false", function () { - return transformAsync("foo('bar');", { ast: false }).then(function ( - result, - ) { - expect(result.ast).toBeFalsy(); - }); + return transformAsync("foo('bar');", { ast: false }).then( + function (result) { + expect(result.ast).toBeFalsy(); + }, + ); }); it("ast option true", function () { diff --git ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts index 7a7aa2c5..1a8aa6f5 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts @@ -14,25 +14,28 @@ export function getInclusionReasons( ) { const minVersions = list[item] || {}; - return (Object.keys(targetVersions) as Target[]).reduce((result, env) => { - const minVersion = getLowestImplementedVersion(minVersions, env); - const targetVersion = targetVersions[env]; + return (Object.keys(targetVersions) as Target[]).reduce( + (result, env) => { + const minVersion = getLowestImplementedVersion(minVersions, env); + const targetVersion = targetVersions[env]; - if (!minVersion) { - result[env] = prettifyVersion(targetVersion); - } else { - const minIsUnreleased = isUnreleasedVersion(minVersion, env); - const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); - - if ( - !targetIsUnreleased && - (minIsUnreleased || - semver.lt(targetVersion.toString(), semverify(minVersion))) - ) { + if (!minVersion) { result[env] = prettifyVersion(targetVersion); + } else { + const minIsUnreleased = isUnreleasedVersion(minVersion, env); + const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); + + if ( + !targetIsUnreleased && + (minIsUnreleased || + semver.lt(targetVersion.toString(), semverify(minVersion))) + ) { + result[env] = prettifyVersion(targetVersion); + } } - } - return result; - }, {} as Partial>); + return result; + }, + {} as Partial>, + ); } diff --git ORI/babel/packages/babel-helper-compilation-targets/src/index.ts ALT/babel/packages/babel-helper-compilation-targets/src/index.ts index 346eee9c..3ec58830 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/index.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/index.ts @@ -65,45 +65,48 @@ function validateBrowsers(browsers: Browsers | undefined) { } function getLowestVersions(browsers: Array): Targets { - return browsers.reduce((all, browser) => { - const [browserName, browserVersion] = browser.split(" ") as [ - BrowserslistBrowserName, - string, - ]; - const target = browserNameMap[browserName]; - - if (!target) { - return all; - } - - try { - // Browser version can return as "10.0-10.2" - const splitVersion = browserVersion.split("-")[0].toLowerCase(); - const isSplitUnreleased = isUnreleasedVersion(splitVersion, target); - - if (!all[target]) { - all[target] = isSplitUnreleased - ? splitVersion - : semverify(splitVersion); + return browsers.reduce( + (all, browser) => { + const [browserName, browserVersion] = browser.split(" ") as [ + BrowserslistBrowserName, + string, + ]; + const target = browserNameMap[browserName]; + + if (!target) { return all; } - const version = all[target]; - const isUnreleased = isUnreleasedVersion(version, target); + try { + // Browser version can return as "10.0-10.2" + const splitVersion = browserVersion.split("-")[0].toLowerCase(); + const isSplitUnreleased = isUnreleasedVersion(splitVersion, target); - if (isUnreleased && isSplitUnreleased) { - all[target] = getLowestUnreleased(version, splitVersion, target); - } else if (isUnreleased) { - all[target] = semverify(splitVersion); - } else if (!isUnreleased && !isSplitUnreleased) { - const parsedBrowserVersion = semverify(splitVersion); + if (!all[target]) { + all[target] = isSplitUnreleased + ? splitVersion + : semverify(splitVersion); + return all; + } - all[target] = semverMin(version, parsedBrowserVersion); - } - } catch (e) {} + const version = all[target]; + const isUnreleased = isUnreleasedVersion(version, target); - return all; - }, {} as Record); + if (isUnreleased && isSplitUnreleased) { + all[target] = getLowestUnreleased(version, splitVersion, target); + } else if (isUnreleased) { + all[target] = semverify(splitVersion); + } else if (!isUnreleased && !isSplitUnreleased) { + const parsedBrowserVersion = semverify(splitVersion); + + all[target] = semverMin(version, parsedBrowserVersion); + } + } catch (e) {} + + return all; + }, + {} as Record, + ); } function outputDecimalWarning( diff --git ORI/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js ALT/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js index 6e436302..5be420f8 100644 --- ORI/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js +++ ALT/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js @@ -35,12 +35,12 @@ const toAdjustedSyntaxError = (adjust, error) => line: parseInt(line, 10), column: parseInt(column, 10), }; - return `(${adjust( + return `(${adjust(adjust, loc.line, "line", loc)}:${adjust( adjust, - loc.line, - "line", + loc.column, + "column", loc, - )}:${adjust(adjust, loc.column, "column", loc)})`; + )})`; }), ) : error; 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 183eedb4..c7d4c80b 100644 --- ORI/babel/packages/babel-plugin-transform-modules-umd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-umd/src/index.ts @@ -95,14 +95,17 @@ export default declare((api, options: Options) => { initAssignments = []; const members = globalName.split("."); - globalToAssign = members.slice(1).reduce((accum, curr) => { - initAssignments.push( - buildPrerequisiteAssignment({ - GLOBAL_REFERENCE: t.cloneNode(accum), - }), - ); - return t.memberExpression(accum, t.identifier(curr)); - }, t.memberExpression(t.identifier("global"), t.identifier(members[0]))); + globalToAssign = members.slice(1).reduce( + (accum, curr) => { + initAssignments.push( + buildPrerequisiteAssignment({ + GLOBAL_REFERENCE: t.cloneNode(accum), + }), + ); + return t.memberExpression(accum, t.identifier(curr)); + }, + t.memberExpression(t.identifier("global"), t.identifier(members[0])), + ); } } diff --git ORI/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts ALT/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts index 53657a52..902e87f9 100644 --- ORI/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts @@ -161,9 +161,9 @@ export default declare((api, opt: Options) => { path.replaceWith( template.expression.ast` ${t.cloneNode(outerClass.node.id)} === ${buildCheckInRHS( - node.right, - file, - )} + node.right, + file, + )} `, ); } else { diff --git ORI/babel/packages/babel-template/src/builder.ts ALT/babel/packages/babel-template/src/builder.ts index e3acc387..faa7ee71 100644 --- ORI/babel/packages/babel-template/src/builder.ts +++ ALT/babel/packages/babel-template/src/builder.ts @@ -13,9 +13,10 @@ export type TemplateBuilder = { (tpl: string, opts?: PublicOpts): (replacements?: PublicReplacements) => T; // Building from a template literal produces an AST builder function by default. - (tpl: TemplateStringsArray, ...args: Array): ( - replacements?: PublicReplacements, - ) => T; + ( + tpl: TemplateStringsArray, + ...args: Array + ): (replacements?: PublicReplacements) => T; // Allow users to explicitly create templates that produce ASTs, skipping // the need for an intermediate function. diff --git ORI/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts ALT/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts index f47eee43..935ed613 100644 --- ORI/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts +++ ALT/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts @@ -4,9 +4,10 @@ import type * as t from ".."; export default getOuterBindingIdentifiers as { (node: t.Node, duplicates: true): Record>; (node: t.Node, duplicates?: false): Record; - (node: t.Node, duplicates?: boolean): - | Record - | Record>; + ( + node: t.Node, + duplicates?: boolean, + ): Record | Record>; }; function getOuterBindingIdentifiers( ```
github-actions[bot] commented 1 year ago

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

The diff is empty.

github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: excalidraw/excalidraw@3ddcc48e4c192f525930e503b3e9214627f0043d

Diff (458 lines) ```diff diff --git ORI/excalidraw/public/index.html ALT/excalidraw/public/index.html index 5509ded..62293a1 100644 --- ORI/excalidraw/public/index.html +++ ALT/excalidraw/public/index.html @@ -1,4 +1,4 @@ - + diff --git ORI/excalidraw/src/actions/actionFrame.ts ALT/excalidraw/src/actions/actionFrame.ts index 980d0f7..c93f0a6 100644 --- ORI/excalidraw/src/actions/actionFrame.ts +++ ALT/excalidraw/src/actions/actionFrame.ts @@ -39,10 +39,13 @@ export const actionSelectAllElementsInFrame = register({ elements, appState: { ...appState, - selectedElementIds: elementsInFrame.reduce((acc, element) => { - acc[element.id] = true; - return acc; - }, {} as Record), + selectedElementIds: elementsInFrame.reduce( + (acc, element) => { + acc[element.id] = true; + return acc; + }, + {} as Record, + ), }, commitToHistory: false, }; diff --git ORI/excalidraw/src/colors.ts ALT/excalidraw/src/colors.ts index 7da1283..b460899 100644 --- ORI/excalidraw/src/colors.ts +++ ALT/excalidraw/src/colors.ts @@ -6,12 +6,15 @@ const pick = , K extends readonly (keyof R)[]>( source: R, keys: K, ) => { - return keys.reduce((acc, key: K[number]) => { - if (key in source) { - acc[key] = source[key]; - } - return acc; - }, {} as Pick) as Pick; + return keys.reduce( + (acc, key: K[number]) => { + if (key in source) { + acc[key] = source[key]; + } + return acc; + }, + {} as Pick, + ) as Pick; }; export type ColorPickerColor = diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx index f9dc353..4960990 100644 --- ORI/excalidraw/src/components/App.tsx +++ ALT/excalidraw/src/components/App.tsx @@ -4386,12 +4386,13 @@ class App extends React.Component { ), // we need to duplicate because we'll be updating this state lastCoords: { ...origin }, - originalElements: this.scene - .getNonDeletedElements() - .reduce((acc, element) => { + originalElements: this.scene.getNonDeletedElements().reduce( + (acc, element) => { acc.set(element.id, deepCopyElement(element)); return acc; - }, new Map() as PointerDownState["originalElements"]), + }, + new Map() as PointerDownState["originalElements"], + ), resize: { handleType: false, isResizing: false, diff --git ORI/excalidraw/src/components/ExportDialog.scss ALT/excalidraw/src/components/ExportDialog.scss index 3cb31c4..2ee217c 100644 --- ORI/excalidraw/src/components/ExportDialog.scss +++ ALT/excalidraw/src/components/ExportDialog.scss @@ -107,7 +107,8 @@ border-radius: 1rem; background-color: var(--button-color); - box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.28), + box-shadow: + 0 3px 5px -1px rgba(0, 0, 0, 0.28), 0 6px 10px 0 rgba(0, 0, 0, 0.14); font-family: Cascadia; diff --git ORI/excalidraw/src/components/LayerUI.scss ALT/excalidraw/src/components/LayerUI.scss index b5c88cd..fbb6829 100644 --- ORI/excalidraw/src/components/LayerUI.scss +++ ALT/excalidraw/src/components/LayerUI.scss @@ -70,12 +70,16 @@ font-weight: 500; opacity: 0; visibility: hidden; - transition: visibility 0s linear 0s, opacity 0.5s; + transition: + visibility 0s linear 0s, + opacity 0.5s; &--visible { opacity: 1; visibility: visible; - transition: visibility 0s linear 300ms, opacity 0.5s; + transition: + visibility 0s linear 300ms, + opacity 0.5s; transition-delay: 0.8s; } } diff --git ORI/excalidraw/src/css/styles.scss ALT/excalidraw/src/css/styles.scss index 826540d..082741b 100644 --- ORI/excalidraw/src/css/styles.scss +++ ALT/excalidraw/src/css/styles.scss @@ -368,13 +368,19 @@ appearance: none; background-image: var(--dropdown-icon); background-repeat: no-repeat; - background-position: right 0.7rem top 50%, 0 0; + background-position: + right 0.7rem top 50%, + 0 0; :root[dir="rtl"] & { - background-position: left 0.7rem top 50%, 0 0; + background-position: + left 0.7rem top 50%, + 0 0; } - background-size: 0.65em auto, 100%; + background-size: + 0.65em auto, + 100%; &:focus { box-shadow: 0 0 0 2px var(--focus-highlight-color); diff --git ORI/excalidraw/src/element/bounds.test.ts ALT/excalidraw/src/element/bounds.test.ts index 850c506..c147f1c 100644 --- ORI/excalidraw/src/element/bounds.test.ts +++ ALT/excalidraw/src/element/bounds.test.ts @@ -31,7 +31,7 @@ const _ce = ({ width: w, height: h, angle: a, - } as ExcalidrawElement); + }) as ExcalidrawElement; describe("getElementAbsoluteCoords", () => { it("test x1 coordinate", () => { diff --git ORI/excalidraw/src/element/resizeTest.ts ALT/excalidraw/src/element/resizeTest.ts index a344720..448e2bf 100644 --- ORI/excalidraw/src/element/resizeTest.ts +++ ALT/excalidraw/src/element/resizeTest.ts @@ -70,20 +70,26 @@ export const getElementWithTransformHandleType = ( zoom: Zoom, pointerType: PointerType, ) => { - return elements.reduce((result, element) => { - if (result) { - return result; - } - const transformHandleType = resizeTest( - element, - appState, - scenePointerX, - scenePointerY, - zoom, - pointerType, - ); - return transformHandleType ? { element, transformHandleType } : null; - }, null as { element: NonDeletedExcalidrawElement; transformHandleType: MaybeTransformHandleType } | null); + return elements.reduce( + (result, element) => { + if (result) { + return result; + } + const transformHandleType = resizeTest( + element, + appState, + scenePointerX, + scenePointerY, + zoom, + pointerType, + ); + return transformHandleType ? { element, transformHandleType } : null; + }, + null as { + element: NonDeletedExcalidrawElement; + transformHandleType: MaybeTransformHandleType; + } | null, + ); }; export const getTransformHandleTypeFromCoords = ( diff --git ORI/excalidraw/src/history.ts ALT/excalidraw/src/history.ts index d102a7e..0a5ce4c 100644 --- ORI/excalidraw/src/history.ts +++ ALT/excalidraw/src/history.ts @@ -104,35 +104,38 @@ class History { ): DehydratedHistoryEntry => this.dehydrateHistoryEntry({ appState: clearAppStatePropertiesForHistory(appState), - elements: elements.reduce((elements, element) => { - if ( - isLinearElement(element) && - appState.multiElement && - appState.multiElement.id === element.id - ) { - // don't store multi-point arrow if still has only one point + elements: elements.reduce( + (elements, element) => { if ( + isLinearElement(element) && appState.multiElement && - appState.multiElement.id === element.id && - element.points.length < 2 + appState.multiElement.id === element.id ) { - return elements; + // don't store multi-point arrow if still has only one point + if ( + appState.multiElement && + appState.multiElement.id === element.id && + element.points.length < 2 + ) { + return elements; + } + + elements.push({ + ...element, + // don't store last point if not committed + points: + element.lastCommittedPoint !== + element.points[element.points.length - 1] + ? element.points.slice(0, -1) + : element.points, + }); + } else { + elements.push(element); } - - elements.push({ - ...element, - // don't store last point if not committed - points: - element.lastCommittedPoint !== - element.points[element.points.length - 1] - ? element.points.slice(0, -1) - : element.points, - }); - } else { - elements.push(element); - } - return elements; - }, [] as Mutable), + return elements; + }, + [] as Mutable, + ), }); shouldCreateEntry(nextEntry: HistoryEntry): boolean { diff --git ORI/excalidraw/src/packages/excalidraw/example/public/index.html ALT/excalidraw/src/packages/excalidraw/example/public/index.html index 7f4ed24..27f32cd 100644 --- ORI/excalidraw/src/packages/excalidraw/example/public/index.html +++ ALT/excalidraw/src/packages/excalidraw/example/public/index.html @@ -1,4 +1,4 @@ - + diff --git ORI/excalidraw/src/renderer/renderScene.ts ALT/excalidraw/src/renderer/renderScene.ts index eac3d3c..f4f1b44 100644 --- ORI/excalidraw/src/renderer/renderScene.ts +++ ALT/excalidraw/src/renderer/renderScene.ts @@ -604,44 +604,57 @@ export const _renderScene = ({ ); } if (showBoundingBox) { - const selections = elements.reduce((acc, element) => { - const selectionColors = []; - // local user - if ( - locallySelectedIds.includes(element.id) && - !isSelectedViaGroup(appState, element) - ) { - selectionColors.push(selectionColor); - } - // remote users - if (renderConfig.remoteSelectedElementIds[element.id]) { - selectionColors.push( - ...renderConfig.remoteSelectedElementIds[element.id].map( - (socketId) => { - const background = getClientColor(socketId); - return background; - }, - ), - ); - } - - if (selectionColors.length) { - const [elementX1, elementY1, elementX2, elementY2, cx, cy] = - getElementAbsoluteCoords(element, true); - acc.push({ - angle: element.angle, - elementX1, - elementY1, - elementX2, - elementY2, - selectionColors, - dashed: !!renderConfig.remoteSelectedElementIds[element.id], - cx, - cy, - }); - } - return acc; - }, [] as { angle: number; elementX1: number; elementY1: number; elementX2: number; elementY2: number; selectionColors: string[]; dashed?: boolean; cx: number; cy: number }[]); + const selections = elements.reduce( + (acc, element) => { + const selectionColors = []; + // local user + if ( + locallySelectedIds.includes(element.id) && + !isSelectedViaGroup(appState, element) + ) { + selectionColors.push(selectionColor); + } + // remote users + if (renderConfig.remoteSelectedElementIds[element.id]) { + selectionColors.push( + ...renderConfig.remoteSelectedElementIds[element.id].map( + (socketId) => { + const background = getClientColor(socketId); + return background; + }, + ), + ); + } + + if (selectionColors.length) { + const [elementX1, elementY1, elementX2, elementY2, cx, cy] = + getElementAbsoluteCoords(element, true); + acc.push({ + angle: element.angle, + elementX1, + elementY1, + elementX2, + elementY2, + selectionColors, + dashed: !!renderConfig.remoteSelectedElementIds[element.id], + cx, + cy, + }); + } + return acc; + }, + [] as { + angle: number; + elementX1: number; + elementY1: number; + elementX2: number; + elementY2: number; + selectionColors: string[]; + dashed?: boolean; + cx: number; + cy: number; + }[], + ); const addSelectionForGroupId = (groupId: GroupId) => { const groupElements = getElementsInGroup(elements, groupId); diff --git ORI/excalidraw/src/scene/export.ts ALT/excalidraw/src/scene/export.ts index 78fc9b4..642747b 100644 --- ORI/excalidraw/src/scene/export.ts +++ ALT/excalidraw/src/scene/export.ts @@ -168,8 +168,8 @@ export const exportToSvg = async ( exportingFrameClipPath = ` @@ -235,10 +235,13 @@ const getCanvasSize = ( if (!isExportingWholeCanvas || onlyExportingSingleFrame) { const frames = elements.filter((element) => element.type === "frame"); - const exportedFrameIds = frames.reduce((acc, frame) => { - acc[frame.id] = true; - return acc; - }, {} as Record); + const exportedFrameIds = frames.reduce( + (acc, frame) => { + acc[frame.id] = true; + return acc; + }, + {} as Record, + ); // elements in a frame do not affect the canvas size if we're not exporting // the whole canvas diff --git ORI/excalidraw/src/tests/helpers/api.ts ALT/excalidraw/src/tests/helpers/api.ts index 7bba8bd..9edb595 100644 --- ORI/excalidraw/src/tests/helpers/api.ts +++ ALT/excalidraw/src/tests/helpers/api.ts @@ -28,10 +28,13 @@ const { h } = window; export class API { static setSelectedElements = (elements: ExcalidrawElement[]) => { h.setState({ - selectedElementIds: elements.reduce((acc, element) => { - acc[element.id] = true; - return acc; - }, {} as Record), + selectedElementIds: elements.reduce( + (acc, element) => { + acc[element.id] = true; + return acc; + }, + {} as Record, + ), }); }; diff --git ORI/excalidraw/src/zindex.ts ALT/excalidraw/src/zindex.ts index a1f051c..3c20868 100644 --- ORI/excalidraw/src/zindex.ts +++ ALT/excalidraw/src/zindex.ts @@ -188,11 +188,14 @@ const getTargetElementsMap = ( elements: readonly T[], indices: number[], ) => { - return indices.reduce((acc, index) => { - const element = elements[index]; - acc[element.id] = element; - return acc; - }, {} as Record); + return indices.reduce( + (acc, index) => { + const element = elements[index]; + acc[element.id] = element; + return acc; + }, + {} as Record, + ); }; const _shiftElements = ( ```
github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: typescript-eslint/typescript-eslint@4bf2d7360eaf74c9ef87b196ff4c459b8f50800b

Diff (158 lines) ````diff diff --git ORI/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts ALT/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts index bd8ce6a..b4e8d75 100644 --- ORI/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts +++ ALT/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -4,7 +4,10 @@ import type { Program, SourceFile } from 'typescript'; // @ts-expect-error - We need to access the program, but Linter has private program already export class CustomLinter extends Linter { - constructor(options: ILinterOptions, private readonly program: Program) { + constructor( + options: ILinterOptions, + private readonly program: Program, + ) { super(options, program); } diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md index e5902b2..5bfd9cb 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md @@ -22,10 +22,16 @@ function f(a = 0, b: number) {} function f(a: number, b = 0, c: number) {} function f(a: number, b?: number, c: number) {} class Foo { - constructor(public a = 10, private b: number) {} + constructor( + public a = 10, + private b: number, + ) {} } class Foo { - constructor(public a?: number, private b: number) {} + constructor( + public a?: number, + private b: number, + ) {} } ``` @@ -40,9 +46,15 @@ function f(a: number, b?: number) {} function f(a: number, b?: number, c = 0) {} function f(a: number, b = 0, c?: number) {} class Foo { - constructor(public a, private b = 0) {} + constructor( + public a, + private b = 0, + ) {} } class Foo { - constructor(public a, private b?: number) {} + constructor( + public a, + private b?: number, + ) {} } ``` diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 0d0e476..687aa70 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -209,14 +209,14 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions #### ❌ Incorrect ```ts -const func = (value: number) => ({ type: 'X', value } as any); -const func = (value: number) => ({ type: 'X', value } as Action); +const func = (value: number) => ({ type: 'X', value }) as any; +const func = (value: number) => ({ type: 'X', value }) as Action; ``` #### ✅ Correct ```ts -const func = (value: number) => ({ foo: 'bar', value } as const); +const func = (value: number) => ({ foo: 'bar', value }) as const; const func = () => x as const; ``` @@ -255,7 +255,7 @@ function foo(t: T) { return t; } -const bar = (t: T) => t; +const bar = (t: T) => t; ``` #### ✅ Correct diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 87d7d23..43cd4fe 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -90,7 +90,10 @@ The following patterns are considered correct with the default options `{ access ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -113,7 +116,10 @@ The following patterns are considered incorrect with the accessibility set to ** ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -136,7 +142,10 @@ The following patterns are considered correct with the accessibility set to **no ```ts class Animal { - constructor(protected breed, name) { + constructor( + protected breed, + name, + ) { // Parameter property and constructor this.name = name; } diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md index e48af85..d10515e 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -131,11 +131,11 @@ export const bar = () => 1; #### ✅ Correct ```ts -export const func = (value: number) => ({ type: 'X', value } as const); +export const func = (value: number) => ({ type: 'X', value }) as const; export const foo = () => ({ bar: true, - } as const); + }) as const; export const bar = () => 1 as const; ``` diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 45a7f8f..7a55b6f 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -46,7 +46,7 @@ function foo(bool?: boolean) { } // `any`, unconstrained generics and unions of more than one primitive type are disallowed -const foo = (arg: T) => (arg ? 1 : 0); +const foo = (arg: T) => (arg ? 1 : 0); // always-truthy and always-falsy types are disallowed let obj = {}; ````
github-actions[bot] commented 1 year ago

[Error]

Error: Unable to get ACTIONS_RUNTIME_TOKEN env variable
sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: babel/babel@134aa1723c6aa01a42713e379142088b30c6cc0d

Diff (292 lines) ```diff diff --git ORI/babel/packages/babel-cli/test/index.js ALT/babel/packages/babel-cli/test/index.js index 9f7cc422..ad1fd5f0 100644 --- ORI/babel/packages/babel-cli/test/index.js +++ ALT/babel/packages/babel-cli/test/index.js @@ -320,9 +320,11 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) { parseInt(process.versions.node, 10) < opts.minNodeVersion; // eslint-disable-next-line jest/valid-title - (skip - ? it.skip - : it)(testName, buildTest(binName, testName, opts), 20000); + (skip ? it.skip : it)( + testName, + buildTest(binName, testName, opts), + 20000, + ); }); }); }); diff --git ORI/babel/packages/babel-core/test/api.js ALT/babel/packages/babel-core/test/api.js index 54b8ead5..2e409d29 100644 --- ORI/babel/packages/babel-core/test/api.js +++ ALT/babel/packages/babel-core/test/api.js @@ -667,19 +667,19 @@ describe("api", function () { }); it("code option false", function () { - return transformAsync("foo('bar');", { code: false }).then(function ( - result, - ) { - expect(result.code).toBeFalsy(); - }); + return transformAsync("foo('bar');", { code: false }).then( + function (result) { + expect(result.code).toBeFalsy(); + }, + ); }); it("ast option false", function () { - return transformAsync("foo('bar');", { ast: false }).then(function ( - result, - ) { - expect(result.ast).toBeFalsy(); - }); + return transformAsync("foo('bar');", { ast: false }).then( + function (result) { + expect(result.ast).toBeFalsy(); + }, + ); }); it("ast option true", function () { diff --git ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts index 7a7aa2c5..1a8aa6f5 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts @@ -14,25 +14,28 @@ export function getInclusionReasons( ) { const minVersions = list[item] || {}; - return (Object.keys(targetVersions) as Target[]).reduce((result, env) => { - const minVersion = getLowestImplementedVersion(minVersions, env); - const targetVersion = targetVersions[env]; + return (Object.keys(targetVersions) as Target[]).reduce( + (result, env) => { + const minVersion = getLowestImplementedVersion(minVersions, env); + const targetVersion = targetVersions[env]; - if (!minVersion) { - result[env] = prettifyVersion(targetVersion); - } else { - const minIsUnreleased = isUnreleasedVersion(minVersion, env); - const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); - - if ( - !targetIsUnreleased && - (minIsUnreleased || - semver.lt(targetVersion.toString(), semverify(minVersion))) - ) { + if (!minVersion) { result[env] = prettifyVersion(targetVersion); + } else { + const minIsUnreleased = isUnreleasedVersion(minVersion, env); + const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); + + if ( + !targetIsUnreleased && + (minIsUnreleased || + semver.lt(targetVersion.toString(), semverify(minVersion))) + ) { + result[env] = prettifyVersion(targetVersion); + } } - } - return result; - }, {} as Partial>); + return result; + }, + {} as Partial>, + ); } diff --git ORI/babel/packages/babel-helper-compilation-targets/src/index.ts ALT/babel/packages/babel-helper-compilation-targets/src/index.ts index 346eee9c..3ec58830 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/index.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/index.ts @@ -65,45 +65,48 @@ function validateBrowsers(browsers: Browsers | undefined) { } function getLowestVersions(browsers: Array): Targets { - return browsers.reduce((all, browser) => { - const [browserName, browserVersion] = browser.split(" ") as [ - BrowserslistBrowserName, - string, - ]; - const target = browserNameMap[browserName]; - - if (!target) { - return all; - } - - try { - // Browser version can return as "10.0-10.2" - const splitVersion = browserVersion.split("-")[0].toLowerCase(); - const isSplitUnreleased = isUnreleasedVersion(splitVersion, target); - - if (!all[target]) { - all[target] = isSplitUnreleased - ? splitVersion - : semverify(splitVersion); + return browsers.reduce( + (all, browser) => { + const [browserName, browserVersion] = browser.split(" ") as [ + BrowserslistBrowserName, + string, + ]; + const target = browserNameMap[browserName]; + + if (!target) { return all; } - const version = all[target]; - const isUnreleased = isUnreleasedVersion(version, target); + try { + // Browser version can return as "10.0-10.2" + const splitVersion = browserVersion.split("-")[0].toLowerCase(); + const isSplitUnreleased = isUnreleasedVersion(splitVersion, target); - if (isUnreleased && isSplitUnreleased) { - all[target] = getLowestUnreleased(version, splitVersion, target); - } else if (isUnreleased) { - all[target] = semverify(splitVersion); - } else if (!isUnreleased && !isSplitUnreleased) { - const parsedBrowserVersion = semverify(splitVersion); + if (!all[target]) { + all[target] = isSplitUnreleased + ? splitVersion + : semverify(splitVersion); + return all; + } - all[target] = semverMin(version, parsedBrowserVersion); - } - } catch (e) {} + const version = all[target]; + const isUnreleased = isUnreleasedVersion(version, target); - return all; - }, {} as Record); + if (isUnreleased && isSplitUnreleased) { + all[target] = getLowestUnreleased(version, splitVersion, target); + } else if (isUnreleased) { + all[target] = semverify(splitVersion); + } else if (!isUnreleased && !isSplitUnreleased) { + const parsedBrowserVersion = semverify(splitVersion); + + all[target] = semverMin(version, parsedBrowserVersion); + } + } catch (e) {} + + return all; + }, + {} as Record, + ); } function outputDecimalWarning( diff --git ORI/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js ALT/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js index 6e436302..5be420f8 100644 --- ORI/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js +++ ALT/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js @@ -35,12 +35,12 @@ const toAdjustedSyntaxError = (adjust, error) => line: parseInt(line, 10), column: parseInt(column, 10), }; - return `(${adjust( + return `(${adjust(adjust, loc.line, "line", loc)}:${adjust( adjust, - loc.line, - "line", + loc.column, + "column", loc, - )}:${adjust(adjust, loc.column, "column", loc)})`; + )})`; }), ) : error; 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 183eedb4..c7d4c80b 100644 --- ORI/babel/packages/babel-plugin-transform-modules-umd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-umd/src/index.ts @@ -95,14 +95,17 @@ export default declare((api, options: Options) => { initAssignments = []; const members = globalName.split("."); - globalToAssign = members.slice(1).reduce((accum, curr) => { - initAssignments.push( - buildPrerequisiteAssignment({ - GLOBAL_REFERENCE: t.cloneNode(accum), - }), - ); - return t.memberExpression(accum, t.identifier(curr)); - }, t.memberExpression(t.identifier("global"), t.identifier(members[0]))); + globalToAssign = members.slice(1).reduce( + (accum, curr) => { + initAssignments.push( + buildPrerequisiteAssignment({ + GLOBAL_REFERENCE: t.cloneNode(accum), + }), + ); + return t.memberExpression(accum, t.identifier(curr)); + }, + t.memberExpression(t.identifier("global"), t.identifier(members[0])), + ); } } diff --git ORI/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts ALT/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts index 53657a52..902e87f9 100644 --- ORI/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts @@ -161,9 +161,9 @@ export default declare((api, opt: Options) => { path.replaceWith( template.expression.ast` ${t.cloneNode(outerClass.node.id)} === ${buildCheckInRHS( - node.right, - file, - )} + node.right, + file, + )} `, ); } else { diff --git ORI/babel/packages/babel-template/src/builder.ts ALT/babel/packages/babel-template/src/builder.ts index e3acc387..faa7ee71 100644 --- ORI/babel/packages/babel-template/src/builder.ts +++ ALT/babel/packages/babel-template/src/builder.ts @@ -13,9 +13,10 @@ export type TemplateBuilder = { (tpl: string, opts?: PublicOpts): (replacements?: PublicReplacements) => T; // Building from a template literal produces an AST builder function by default. - (tpl: TemplateStringsArray, ...args: Array): ( - replacements?: PublicReplacements, - ) => T; + ( + tpl: TemplateStringsArray, + ...args: Array + ): (replacements?: PublicReplacements) => T; // Allow users to explicitly create templates that produce ASTs, skipping // the need for an intermediate function. diff --git ORI/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts ALT/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts index f47eee43..935ed613 100644 --- ORI/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts +++ ALT/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts @@ -4,9 +4,10 @@ import type * as t from ".."; export default getOuterBindingIdentifiers as { (node: t.Node, duplicates: true): Record>; (node: t.Node, duplicates?: false): Record; - (node: t.Node, duplicates?: boolean): - | Record - | Record>; + ( + node: t.Node, + duplicates?: boolean, + ): Record | Record>; }; function getOuterBindingIdentifiers( ```
github-actions[bot] commented 1 year ago

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

The diff is empty.

github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: excalidraw/excalidraw@3ddcc48e4c192f525930e503b3e9214627f0043d

Diff (458 lines) ```diff diff --git ORI/excalidraw/public/index.html ALT/excalidraw/public/index.html index 5509ded..62293a1 100644 --- ORI/excalidraw/public/index.html +++ ALT/excalidraw/public/index.html @@ -1,4 +1,4 @@ - + diff --git ORI/excalidraw/src/actions/actionFrame.ts ALT/excalidraw/src/actions/actionFrame.ts index 980d0f7..c93f0a6 100644 --- ORI/excalidraw/src/actions/actionFrame.ts +++ ALT/excalidraw/src/actions/actionFrame.ts @@ -39,10 +39,13 @@ export const actionSelectAllElementsInFrame = register({ elements, appState: { ...appState, - selectedElementIds: elementsInFrame.reduce((acc, element) => { - acc[element.id] = true; - return acc; - }, {} as Record), + selectedElementIds: elementsInFrame.reduce( + (acc, element) => { + acc[element.id] = true; + return acc; + }, + {} as Record, + ), }, commitToHistory: false, }; diff --git ORI/excalidraw/src/colors.ts ALT/excalidraw/src/colors.ts index 7da1283..b460899 100644 --- ORI/excalidraw/src/colors.ts +++ ALT/excalidraw/src/colors.ts @@ -6,12 +6,15 @@ const pick = , K extends readonly (keyof R)[]>( source: R, keys: K, ) => { - return keys.reduce((acc, key: K[number]) => { - if (key in source) { - acc[key] = source[key]; - } - return acc; - }, {} as Pick) as Pick; + return keys.reduce( + (acc, key: K[number]) => { + if (key in source) { + acc[key] = source[key]; + } + return acc; + }, + {} as Pick, + ) as Pick; }; export type ColorPickerColor = diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx index f9dc353..4960990 100644 --- ORI/excalidraw/src/components/App.tsx +++ ALT/excalidraw/src/components/App.tsx @@ -4386,12 +4386,13 @@ class App extends React.Component { ), // we need to duplicate because we'll be updating this state lastCoords: { ...origin }, - originalElements: this.scene - .getNonDeletedElements() - .reduce((acc, element) => { + originalElements: this.scene.getNonDeletedElements().reduce( + (acc, element) => { acc.set(element.id, deepCopyElement(element)); return acc; - }, new Map() as PointerDownState["originalElements"]), + }, + new Map() as PointerDownState["originalElements"], + ), resize: { handleType: false, isResizing: false, diff --git ORI/excalidraw/src/components/ExportDialog.scss ALT/excalidraw/src/components/ExportDialog.scss index 3cb31c4..2ee217c 100644 --- ORI/excalidraw/src/components/ExportDialog.scss +++ ALT/excalidraw/src/components/ExportDialog.scss @@ -107,7 +107,8 @@ border-radius: 1rem; background-color: var(--button-color); - box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.28), + box-shadow: + 0 3px 5px -1px rgba(0, 0, 0, 0.28), 0 6px 10px 0 rgba(0, 0, 0, 0.14); font-family: Cascadia; diff --git ORI/excalidraw/src/components/LayerUI.scss ALT/excalidraw/src/components/LayerUI.scss index b5c88cd..fbb6829 100644 --- ORI/excalidraw/src/components/LayerUI.scss +++ ALT/excalidraw/src/components/LayerUI.scss @@ -70,12 +70,16 @@ font-weight: 500; opacity: 0; visibility: hidden; - transition: visibility 0s linear 0s, opacity 0.5s; + transition: + visibility 0s linear 0s, + opacity 0.5s; &--visible { opacity: 1; visibility: visible; - transition: visibility 0s linear 300ms, opacity 0.5s; + transition: + visibility 0s linear 300ms, + opacity 0.5s; transition-delay: 0.8s; } } diff --git ORI/excalidraw/src/css/styles.scss ALT/excalidraw/src/css/styles.scss index 826540d..082741b 100644 --- ORI/excalidraw/src/css/styles.scss +++ ALT/excalidraw/src/css/styles.scss @@ -368,13 +368,19 @@ appearance: none; background-image: var(--dropdown-icon); background-repeat: no-repeat; - background-position: right 0.7rem top 50%, 0 0; + background-position: + right 0.7rem top 50%, + 0 0; :root[dir="rtl"] & { - background-position: left 0.7rem top 50%, 0 0; + background-position: + left 0.7rem top 50%, + 0 0; } - background-size: 0.65em auto, 100%; + background-size: + 0.65em auto, + 100%; &:focus { box-shadow: 0 0 0 2px var(--focus-highlight-color); diff --git ORI/excalidraw/src/element/bounds.test.ts ALT/excalidraw/src/element/bounds.test.ts index 850c506..c147f1c 100644 --- ORI/excalidraw/src/element/bounds.test.ts +++ ALT/excalidraw/src/element/bounds.test.ts @@ -31,7 +31,7 @@ const _ce = ({ width: w, height: h, angle: a, - } as ExcalidrawElement); + }) as ExcalidrawElement; describe("getElementAbsoluteCoords", () => { it("test x1 coordinate", () => { diff --git ORI/excalidraw/src/element/resizeTest.ts ALT/excalidraw/src/element/resizeTest.ts index a344720..448e2bf 100644 --- ORI/excalidraw/src/element/resizeTest.ts +++ ALT/excalidraw/src/element/resizeTest.ts @@ -70,20 +70,26 @@ export const getElementWithTransformHandleType = ( zoom: Zoom, pointerType: PointerType, ) => { - return elements.reduce((result, element) => { - if (result) { - return result; - } - const transformHandleType = resizeTest( - element, - appState, - scenePointerX, - scenePointerY, - zoom, - pointerType, - ); - return transformHandleType ? { element, transformHandleType } : null; - }, null as { element: NonDeletedExcalidrawElement; transformHandleType: MaybeTransformHandleType } | null); + return elements.reduce( + (result, element) => { + if (result) { + return result; + } + const transformHandleType = resizeTest( + element, + appState, + scenePointerX, + scenePointerY, + zoom, + pointerType, + ); + return transformHandleType ? { element, transformHandleType } : null; + }, + null as { + element: NonDeletedExcalidrawElement; + transformHandleType: MaybeTransformHandleType; + } | null, + ); }; export const getTransformHandleTypeFromCoords = ( diff --git ORI/excalidraw/src/history.ts ALT/excalidraw/src/history.ts index d102a7e..0a5ce4c 100644 --- ORI/excalidraw/src/history.ts +++ ALT/excalidraw/src/history.ts @@ -104,35 +104,38 @@ class History { ): DehydratedHistoryEntry => this.dehydrateHistoryEntry({ appState: clearAppStatePropertiesForHistory(appState), - elements: elements.reduce((elements, element) => { - if ( - isLinearElement(element) && - appState.multiElement && - appState.multiElement.id === element.id - ) { - // don't store multi-point arrow if still has only one point + elements: elements.reduce( + (elements, element) => { if ( + isLinearElement(element) && appState.multiElement && - appState.multiElement.id === element.id && - element.points.length < 2 + appState.multiElement.id === element.id ) { - return elements; + // don't store multi-point arrow if still has only one point + if ( + appState.multiElement && + appState.multiElement.id === element.id && + element.points.length < 2 + ) { + return elements; + } + + elements.push({ + ...element, + // don't store last point if not committed + points: + element.lastCommittedPoint !== + element.points[element.points.length - 1] + ? element.points.slice(0, -1) + : element.points, + }); + } else { + elements.push(element); } - - elements.push({ - ...element, - // don't store last point if not committed - points: - element.lastCommittedPoint !== - element.points[element.points.length - 1] - ? element.points.slice(0, -1) - : element.points, - }); - } else { - elements.push(element); - } - return elements; - }, [] as Mutable), + return elements; + }, + [] as Mutable, + ), }); shouldCreateEntry(nextEntry: HistoryEntry): boolean { diff --git ORI/excalidraw/src/packages/excalidraw/example/public/index.html ALT/excalidraw/src/packages/excalidraw/example/public/index.html index 7f4ed24..27f32cd 100644 --- ORI/excalidraw/src/packages/excalidraw/example/public/index.html +++ ALT/excalidraw/src/packages/excalidraw/example/public/index.html @@ -1,4 +1,4 @@ - + diff --git ORI/excalidraw/src/renderer/renderScene.ts ALT/excalidraw/src/renderer/renderScene.ts index eac3d3c..f4f1b44 100644 --- ORI/excalidraw/src/renderer/renderScene.ts +++ ALT/excalidraw/src/renderer/renderScene.ts @@ -604,44 +604,57 @@ export const _renderScene = ({ ); } if (showBoundingBox) { - const selections = elements.reduce((acc, element) => { - const selectionColors = []; - // local user - if ( - locallySelectedIds.includes(element.id) && - !isSelectedViaGroup(appState, element) - ) { - selectionColors.push(selectionColor); - } - // remote users - if (renderConfig.remoteSelectedElementIds[element.id]) { - selectionColors.push( - ...renderConfig.remoteSelectedElementIds[element.id].map( - (socketId) => { - const background = getClientColor(socketId); - return background; - }, - ), - ); - } - - if (selectionColors.length) { - const [elementX1, elementY1, elementX2, elementY2, cx, cy] = - getElementAbsoluteCoords(element, true); - acc.push({ - angle: element.angle, - elementX1, - elementY1, - elementX2, - elementY2, - selectionColors, - dashed: !!renderConfig.remoteSelectedElementIds[element.id], - cx, - cy, - }); - } - return acc; - }, [] as { angle: number; elementX1: number; elementY1: number; elementX2: number; elementY2: number; selectionColors: string[]; dashed?: boolean; cx: number; cy: number }[]); + const selections = elements.reduce( + (acc, element) => { + const selectionColors = []; + // local user + if ( + locallySelectedIds.includes(element.id) && + !isSelectedViaGroup(appState, element) + ) { + selectionColors.push(selectionColor); + } + // remote users + if (renderConfig.remoteSelectedElementIds[element.id]) { + selectionColors.push( + ...renderConfig.remoteSelectedElementIds[element.id].map( + (socketId) => { + const background = getClientColor(socketId); + return background; + }, + ), + ); + } + + if (selectionColors.length) { + const [elementX1, elementY1, elementX2, elementY2, cx, cy] = + getElementAbsoluteCoords(element, true); + acc.push({ + angle: element.angle, + elementX1, + elementY1, + elementX2, + elementY2, + selectionColors, + dashed: !!renderConfig.remoteSelectedElementIds[element.id], + cx, + cy, + }); + } + return acc; + }, + [] as { + angle: number; + elementX1: number; + elementY1: number; + elementX2: number; + elementY2: number; + selectionColors: string[]; + dashed?: boolean; + cx: number; + cy: number; + }[], + ); const addSelectionForGroupId = (groupId: GroupId) => { const groupElements = getElementsInGroup(elements, groupId); diff --git ORI/excalidraw/src/scene/export.ts ALT/excalidraw/src/scene/export.ts index 78fc9b4..642747b 100644 --- ORI/excalidraw/src/scene/export.ts +++ ALT/excalidraw/src/scene/export.ts @@ -168,8 +168,8 @@ export const exportToSvg = async ( exportingFrameClipPath = ` @@ -235,10 +235,13 @@ const getCanvasSize = ( if (!isExportingWholeCanvas || onlyExportingSingleFrame) { const frames = elements.filter((element) => element.type === "frame"); - const exportedFrameIds = frames.reduce((acc, frame) => { - acc[frame.id] = true; - return acc; - }, {} as Record); + const exportedFrameIds = frames.reduce( + (acc, frame) => { + acc[frame.id] = true; + return acc; + }, + {} as Record, + ); // elements in a frame do not affect the canvas size if we're not exporting // the whole canvas diff --git ORI/excalidraw/src/tests/helpers/api.ts ALT/excalidraw/src/tests/helpers/api.ts index 7bba8bd..9edb595 100644 --- ORI/excalidraw/src/tests/helpers/api.ts +++ ALT/excalidraw/src/tests/helpers/api.ts @@ -28,10 +28,13 @@ const { h } = window; export class API { static setSelectedElements = (elements: ExcalidrawElement[]) => { h.setState({ - selectedElementIds: elements.reduce((acc, element) => { - acc[element.id] = true; - return acc; - }, {} as Record), + selectedElementIds: elements.reduce( + (acc, element) => { + acc[element.id] = true; + return acc; + }, + {} as Record, + ), }); }; diff --git ORI/excalidraw/src/zindex.ts ALT/excalidraw/src/zindex.ts index a1f051c..3c20868 100644 --- ORI/excalidraw/src/zindex.ts +++ ALT/excalidraw/src/zindex.ts @@ -188,11 +188,14 @@ const getTargetElementsMap = ( elements: readonly T[], indices: number[], ) => { - return indices.reduce((acc, index) => { - const element = elements[index]; - acc[element.id] = element; - return acc; - }, {} as Record); + return indices.reduce( + (acc, index) => { + const element = elements[index]; + acc[element.id] = element; + return acc; + }, + {} as Record, + ); }; const _shiftElements = ( ```
github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: typescript-eslint/typescript-eslint@4bf2d7360eaf74c9ef87b196ff4c459b8f50800b

Diff (158 lines) ````diff diff --git ORI/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts ALT/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts index bd8ce6a..b4e8d75 100644 --- ORI/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts +++ ALT/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -4,7 +4,10 @@ import type { Program, SourceFile } from 'typescript'; // @ts-expect-error - We need to access the program, but Linter has private program already export class CustomLinter extends Linter { - constructor(options: ILinterOptions, private readonly program: Program) { + constructor( + options: ILinterOptions, + private readonly program: Program, + ) { super(options, program); } diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md index e5902b2..5bfd9cb 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md @@ -22,10 +22,16 @@ function f(a = 0, b: number) {} function f(a: number, b = 0, c: number) {} function f(a: number, b?: number, c: number) {} class Foo { - constructor(public a = 10, private b: number) {} + constructor( + public a = 10, + private b: number, + ) {} } class Foo { - constructor(public a?: number, private b: number) {} + constructor( + public a?: number, + private b: number, + ) {} } ``` @@ -40,9 +46,15 @@ function f(a: number, b?: number) {} function f(a: number, b?: number, c = 0) {} function f(a: number, b = 0, c?: number) {} class Foo { - constructor(public a, private b = 0) {} + constructor( + public a, + private b = 0, + ) {} } class Foo { - constructor(public a, private b?: number) {} + constructor( + public a, + private b?: number, + ) {} } ``` diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 0d0e476..687aa70 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -209,14 +209,14 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions #### ❌ Incorrect ```ts -const func = (value: number) => ({ type: 'X', value } as any); -const func = (value: number) => ({ type: 'X', value } as Action); +const func = (value: number) => ({ type: 'X', value }) as any; +const func = (value: number) => ({ type: 'X', value }) as Action; ``` #### ✅ Correct ```ts -const func = (value: number) => ({ foo: 'bar', value } as const); +const func = (value: number) => ({ foo: 'bar', value }) as const; const func = () => x as const; ``` @@ -255,7 +255,7 @@ function foo(t: T) { return t; } -const bar = (t: T) => t; +const bar = (t: T) => t; ``` #### ✅ Correct diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 87d7d23..43cd4fe 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -90,7 +90,10 @@ The following patterns are considered correct with the default options `{ access ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -113,7 +116,10 @@ The following patterns are considered incorrect with the accessibility set to ** ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -136,7 +142,10 @@ The following patterns are considered correct with the accessibility set to **no ```ts class Animal { - constructor(protected breed, name) { + constructor( + protected breed, + name, + ) { // Parameter property and constructor this.name = name; } diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md index e48af85..d10515e 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -131,11 +131,11 @@ export const bar = () => 1; #### ✅ Correct ```ts -export const func = (value: number) => ({ type: 'X', value } as const); +export const func = (value: number) => ({ type: 'X', value }) as const; export const foo = () => ({ bar: true, - } as const); + }) as const; export const bar = () => 1 as const; ``` diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 45a7f8f..7a55b6f 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -46,7 +46,7 @@ function foo(bool?: boolean) { } // `any`, unconstrained generics and unions of more than one primitive type are disallowed -const foo = (arg: T) => (arg ? 1 : 0); +const foo = (arg: T) => (arg ? 1 : 0); // always-truthy and always-falsy types are disallowed let obj = {}; ````
github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: vega/vega-lite@c9659206602eda1d894702a2a1f5b526b9832f9f

Diff (389 lines) ```diff diff --git ORI/vega-lite/src/compile/data/aggregate.ts ALT/vega-lite/src/compile/data/aggregate.ts index a952e22..b09238c 100644 --- ORI/vega-lite/src/compile/data/aggregate.ts +++ ALT/vega-lite/src/compile/data/aggregate.ts @@ -68,7 +68,11 @@ export class AggregateNode extends DataFlowNode { * @param dimensions string set for dimensions * @param measures dictionary mapping field name => dict of aggregation functions and names to use */ - constructor(parent: DataFlowNode, private dimensions: Set, private measures: Measures) { + constructor( + parent: DataFlowNode, + private dimensions: Set, + private measures: Measures + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/bin.ts ALT/vega-lite/src/compile/data/bin.ts index 999fae5..1c43602 100644 --- ORI/vega-lite/src/compile/data/bin.ts +++ ALT/vega-lite/src/compile/data/bin.ts @@ -105,7 +105,10 @@ export class BinNode extends DataFlowNode { return new BinNode(null, duplicate(this.bins)); } - constructor(parent: DataFlowNode, private bins: Dict) { + constructor( + parent: DataFlowNode, + private bins: Dict + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/calculate.ts ALT/vega-lite/src/compile/data/calculate.ts index c31baf2..082b241 100644 --- ORI/vega-lite/src/compile/data/calculate.ts +++ ALT/vega-lite/src/compile/data/calculate.ts @@ -17,7 +17,10 @@ export class CalculateNode extends DataFlowNode { return new CalculateNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: CalculateTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: CalculateTransform + ) { super(parent); this._dependentFields = getDependentFields(this.transform.calculate); diff --git ORI/vega-lite/src/compile/data/dataflow.ts ALT/vega-lite/src/compile/data/dataflow.ts index c3acdb2..3069fcb 100644 --- ORI/vega-lite/src/compile/data/dataflow.ts +++ ALT/vega-lite/src/compile/data/dataflow.ts @@ -12,7 +12,10 @@ export abstract class DataFlowNode { protected _hash: string | number; - constructor(parent: DataFlowNode, public readonly debugName?: string) { + constructor( + parent: DataFlowNode, + public readonly debugName?: string + ) { if (parent) { this.parent = parent; } diff --git ORI/vega-lite/src/compile/data/density.ts ALT/vega-lite/src/compile/data/density.ts index d02cff1..b433dde 100644 --- ORI/vega-lite/src/compile/data/density.ts +++ ALT/vega-lite/src/compile/data/density.ts @@ -11,7 +11,10 @@ export class DensityTransformNode extends DataFlowNode { return new DensityTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: DensityTransform) { + constructor( + parent: DataFlowNode, + private transform: DensityTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/extent.ts ALT/vega-lite/src/compile/data/extent.ts index ed87f0a..202fa3e 100644 --- ORI/vega-lite/src/compile/data/extent.ts +++ ALT/vega-lite/src/compile/data/extent.ts @@ -11,7 +11,10 @@ export class ExtentTransformNode extends DataFlowNode { return new ExtentTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: ExtentTransform) { + constructor( + parent: DataFlowNode, + private transform: ExtentTransform + ) { super(parent); this.transform = duplicate(transform); } diff --git ORI/vega-lite/src/compile/data/filterinvalid.ts ALT/vega-lite/src/compile/data/filterinvalid.ts index e0cadf5..5126ea8 100644 --- ORI/vega-lite/src/compile/data/filterinvalid.ts +++ ALT/vega-lite/src/compile/data/filterinvalid.ts @@ -13,7 +13,10 @@ export class FilterInvalidNode extends DataFlowNode { return new FilterInvalidNode(null, {...this.filter}); } - constructor(parent: DataFlowNode, public readonly filter: Dict>) { + constructor( + parent: DataFlowNode, + public readonly filter: Dict> + ) { super(parent); } @@ -25,20 +28,23 @@ export class FilterInvalidNode extends DataFlowNode { return null; } - const filter = model.reduceFieldDef((aggregator: Dict>, fieldDef, channel) => { - const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); + const filter = model.reduceFieldDef( + (aggregator: Dict>, fieldDef, channel) => { + const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); - // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { - aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def + // While discrete domain scales can handle invalid values, continuous scales can't. + // Thus, for non-path marks, we have to filter null for scales with continuous domains. + // (For path marks, we will use "defined" property and skip these values instead.) + if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { + aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def + } } - } - return aggregator; - }, {} as Dict>); + return aggregator; + }, + {} as Dict> + ); if (!keys(filter).length) { return null; diff --git ORI/vega-lite/src/compile/data/flatten.ts ALT/vega-lite/src/compile/data/flatten.ts index 3a4c8b8..dd25c35 100644 --- ORI/vega-lite/src/compile/data/flatten.ts +++ ALT/vega-lite/src/compile/data/flatten.ts @@ -11,7 +11,10 @@ export class FlattenTransformNode extends DataFlowNode { return new FlattenTransformNode(this.parent, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: FlattenTransform) { + constructor( + parent: DataFlowNode, + private transform: FlattenTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const {flatten, as = []} = this.transform; diff --git ORI/vega-lite/src/compile/data/fold.ts ALT/vega-lite/src/compile/data/fold.ts index 6466a3e..e35a592 100644 --- ORI/vega-lite/src/compile/data/fold.ts +++ ALT/vega-lite/src/compile/data/fold.ts @@ -11,7 +11,10 @@ export class FoldTransformNode extends DataFlowNode { return new FoldTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: FoldTransform) { + constructor( + parent: DataFlowNode, + private transform: FoldTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/graticule.ts ALT/vega-lite/src/compile/data/graticule.ts index 2aa9321..771860e 100644 --- ORI/vega-lite/src/compile/data/graticule.ts +++ ALT/vega-lite/src/compile/data/graticule.ts @@ -8,7 +8,10 @@ export class GraticuleNode extends DataFlowNode { return new GraticuleNode(null, this.params); } - constructor(parent: DataFlowNode, private params: true | GraticuleParams) { + constructor( + parent: DataFlowNode, + private params: true | GraticuleParams + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/impute.ts ALT/vega-lite/src/compile/data/impute.ts index 63f8c09..86fbea5 100644 --- ORI/vega-lite/src/compile/data/impute.ts +++ ALT/vega-lite/src/compile/data/impute.ts @@ -16,7 +16,10 @@ export class ImputeNode extends DataFlowNode { return new ImputeNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: ImputeTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: ImputeTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/joinaggregate.ts ALT/vega-lite/src/compile/data/joinaggregate.ts index 6113860..066ba51 100644 --- ORI/vega-lite/src/compile/data/joinaggregate.ts +++ ALT/vega-lite/src/compile/data/joinaggregate.ts @@ -15,7 +15,10 @@ export class JoinAggregateTransformNode extends DataFlowNode { return new JoinAggregateTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: JoinAggregateTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: JoinAggregateTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/loess.ts ALT/vega-lite/src/compile/data/loess.ts index 1d8d457..e3dbd1a 100644 --- ORI/vega-lite/src/compile/data/loess.ts +++ ALT/vega-lite/src/compile/data/loess.ts @@ -11,7 +11,10 @@ export class LoessTransformNode extends DataFlowNode { return new LoessTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: LoessTransform) { + constructor( + parent: DataFlowNode, + private transform: LoessTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/lookup.ts ALT/vega-lite/src/compile/data/lookup.ts index 7a612e1..736d1ca 100644 --- ORI/vega-lite/src/compile/data/lookup.ts +++ ALT/vega-lite/src/compile/data/lookup.ts @@ -14,7 +14,11 @@ export class LookupNode extends DataFlowNode { return new LookupNode(null, duplicate(this.transform), this.secondary); } - constructor(parent: DataFlowNode, public readonly transform: LookupTransform, public readonly secondary: string) { + constructor( + parent: DataFlowNode, + public readonly transform: LookupTransform, + public readonly secondary: string + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/pivot.ts ALT/vega-lite/src/compile/data/pivot.ts index ca96dc1..c965784 100644 --- ORI/vega-lite/src/compile/data/pivot.ts +++ ALT/vega-lite/src/compile/data/pivot.ts @@ -11,7 +11,10 @@ export class PivotTransformNode extends DataFlowNode { return new PivotTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: PivotTransform) { + constructor( + parent: DataFlowNode, + private transform: PivotTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/quantile.ts ALT/vega-lite/src/compile/data/quantile.ts index bac3d28..08349ff 100644 --- ORI/vega-lite/src/compile/data/quantile.ts +++ ALT/vega-lite/src/compile/data/quantile.ts @@ -11,7 +11,10 @@ export class QuantileTransformNode extends DataFlowNode { return new QuantileTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: QuantileTransform) { + constructor( + parent: DataFlowNode, + private transform: QuantileTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/regression.ts ALT/vega-lite/src/compile/data/regression.ts index 41e85f4..520e41f 100644 --- ORI/vega-lite/src/compile/data/regression.ts +++ ALT/vega-lite/src/compile/data/regression.ts @@ -11,7 +11,10 @@ export class RegressionTransformNode extends DataFlowNode { return new RegressionTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: RegressionTransform) { + constructor( + parent: DataFlowNode, + private transform: RegressionTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/sample.ts ALT/vega-lite/src/compile/data/sample.ts index 771544b..a63010b 100644 --- ORI/vega-lite/src/compile/data/sample.ts +++ ALT/vega-lite/src/compile/data/sample.ts @@ -11,7 +11,10 @@ export class SampleTransformNode extends DataFlowNode { return new SampleTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: SampleTransform) { + constructor( + parent: DataFlowNode, + private transform: SampleTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/sequence.ts ALT/vega-lite/src/compile/data/sequence.ts index 9812e2d..032d168 100644 --- ORI/vega-lite/src/compile/data/sequence.ts +++ ALT/vega-lite/src/compile/data/sequence.ts @@ -8,7 +8,10 @@ export class SequenceNode extends DataFlowNode { return new SequenceNode(null, this.params); } - constructor(parent: DataFlowNode, private params: SequenceParams) { + constructor( + parent: DataFlowNode, + private params: SequenceParams + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/timeunit.ts ALT/vega-lite/src/compile/data/timeunit.ts index 1cf25d7..cea3ced 100644 --- ORI/vega-lite/src/compile/data/timeunit.ts +++ ALT/vega-lite/src/compile/data/timeunit.ts @@ -35,7 +35,10 @@ export class TimeUnitNode extends DataFlowNode { return new TimeUnitNode(null, duplicate(this.formula)); } - constructor(parent: DataFlowNode, private formula: Dict) { + constructor( + parent: DataFlowNode, + private formula: Dict + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/window.ts ALT/vega-lite/src/compile/data/window.ts index 2923d03..4709903 100644 --- ORI/vega-lite/src/compile/data/window.ts +++ ALT/vega-lite/src/compile/data/window.ts @@ -16,7 +16,10 @@ export class WindowTransformNode extends DataFlowNode { return new WindowTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: WindowTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: WindowTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/split.ts ALT/vega-lite/src/compile/split.ts index 5901975..3745045 100644 --- ORI/vega-lite/src/compile/split.ts +++ ALT/vega-lite/src/compile/split.ts @@ -9,7 +9,10 @@ import {deepEqual, duplicate, getFirstDefined, keys} from '../util'; */ // eslint-disable-next-line @typescript-eslint/ban-types export class Split { - constructor(public readonly explicit: Partial = {}, public readonly implicit: Partial = {}) {} + constructor( + public readonly explicit: Partial = {}, + public readonly implicit: Partial = {} + ) {} public clone() { return new Split(duplicate(this.explicit), duplicate(this.implicit)); ```
sosukesuzuki commented 1 year ago

run prettier/prettier@main vs 2.8.8

github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: babel/babel@134aa1723c6aa01a42713e379142088b30c6cc0d

Diff (292 lines) ```diff diff --git ORI/babel/packages/babel-cli/test/index.js ALT/babel/packages/babel-cli/test/index.js index 9f7cc422..ad1fd5f0 100644 --- ORI/babel/packages/babel-cli/test/index.js +++ ALT/babel/packages/babel-cli/test/index.js @@ -320,9 +320,11 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) { parseInt(process.versions.node, 10) < opts.minNodeVersion; // eslint-disable-next-line jest/valid-title - (skip - ? it.skip - : it)(testName, buildTest(binName, testName, opts), 20000); + (skip ? it.skip : it)( + testName, + buildTest(binName, testName, opts), + 20000, + ); }); }); }); diff --git ORI/babel/packages/babel-core/test/api.js ALT/babel/packages/babel-core/test/api.js index 54b8ead5..2e409d29 100644 --- ORI/babel/packages/babel-core/test/api.js +++ ALT/babel/packages/babel-core/test/api.js @@ -667,19 +667,19 @@ describe("api", function () { }); it("code option false", function () { - return transformAsync("foo('bar');", { code: false }).then(function ( - result, - ) { - expect(result.code).toBeFalsy(); - }); + return transformAsync("foo('bar');", { code: false }).then( + function (result) { + expect(result.code).toBeFalsy(); + }, + ); }); it("ast option false", function () { - return transformAsync("foo('bar');", { ast: false }).then(function ( - result, - ) { - expect(result.ast).toBeFalsy(); - }); + return transformAsync("foo('bar');", { ast: false }).then( + function (result) { + expect(result.ast).toBeFalsy(); + }, + ); }); it("ast option true", function () { diff --git ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts index 7a7aa2c5..1a8aa6f5 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/debug.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/debug.ts @@ -14,25 +14,28 @@ export function getInclusionReasons( ) { const minVersions = list[item] || {}; - return (Object.keys(targetVersions) as Target[]).reduce((result, env) => { - const minVersion = getLowestImplementedVersion(minVersions, env); - const targetVersion = targetVersions[env]; + return (Object.keys(targetVersions) as Target[]).reduce( + (result, env) => { + const minVersion = getLowestImplementedVersion(minVersions, env); + const targetVersion = targetVersions[env]; - if (!minVersion) { - result[env] = prettifyVersion(targetVersion); - } else { - const minIsUnreleased = isUnreleasedVersion(minVersion, env); - const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); - - if ( - !targetIsUnreleased && - (minIsUnreleased || - semver.lt(targetVersion.toString(), semverify(minVersion))) - ) { + if (!minVersion) { result[env] = prettifyVersion(targetVersion); + } else { + const minIsUnreleased = isUnreleasedVersion(minVersion, env); + const targetIsUnreleased = isUnreleasedVersion(targetVersion, env); + + if ( + !targetIsUnreleased && + (minIsUnreleased || + semver.lt(targetVersion.toString(), semverify(minVersion))) + ) { + result[env] = prettifyVersion(targetVersion); + } } - } - return result; - }, {} as Partial>); + return result; + }, + {} as Partial>, + ); } diff --git ORI/babel/packages/babel-helper-compilation-targets/src/index.ts ALT/babel/packages/babel-helper-compilation-targets/src/index.ts index 346eee9c..3ec58830 100644 --- ORI/babel/packages/babel-helper-compilation-targets/src/index.ts +++ ALT/babel/packages/babel-helper-compilation-targets/src/index.ts @@ -65,45 +65,48 @@ function validateBrowsers(browsers: Browsers | undefined) { } function getLowestVersions(browsers: Array): Targets { - return browsers.reduce((all, browser) => { - const [browserName, browserVersion] = browser.split(" ") as [ - BrowserslistBrowserName, - string, - ]; - const target = browserNameMap[browserName]; - - if (!target) { - return all; - } - - try { - // Browser version can return as "10.0-10.2" - const splitVersion = browserVersion.split("-")[0].toLowerCase(); - const isSplitUnreleased = isUnreleasedVersion(splitVersion, target); - - if (!all[target]) { - all[target] = isSplitUnreleased - ? splitVersion - : semverify(splitVersion); + return browsers.reduce( + (all, browser) => { + const [browserName, browserVersion] = browser.split(" ") as [ + BrowserslistBrowserName, + string, + ]; + const target = browserNameMap[browserName]; + + if (!target) { return all; } - const version = all[target]; - const isUnreleased = isUnreleasedVersion(version, target); + try { + // Browser version can return as "10.0-10.2" + const splitVersion = browserVersion.split("-")[0].toLowerCase(); + const isSplitUnreleased = isUnreleasedVersion(splitVersion, target); - if (isUnreleased && isSplitUnreleased) { - all[target] = getLowestUnreleased(version, splitVersion, target); - } else if (isUnreleased) { - all[target] = semverify(splitVersion); - } else if (!isUnreleased && !isSplitUnreleased) { - const parsedBrowserVersion = semverify(splitVersion); + if (!all[target]) { + all[target] = isSplitUnreleased + ? splitVersion + : semverify(splitVersion); + return all; + } - all[target] = semverMin(version, parsedBrowserVersion); - } - } catch (e) {} + const version = all[target]; + const isUnreleased = isUnreleasedVersion(version, target); - return all; - }, {} as Record); + if (isUnreleased && isSplitUnreleased) { + all[target] = getLowestUnreleased(version, splitVersion, target); + } else if (isUnreleased) { + all[target] = semverify(splitVersion); + } else if (!isUnreleased && !isSplitUnreleased) { + const parsedBrowserVersion = semverify(splitVersion); + + all[target] = semverMin(version, parsedBrowserVersion); + } + } catch (e) {} + + return all; + }, + {} as Record, + ); } function outputDecimalWarning( diff --git ORI/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js ALT/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js index 6e436302..5be420f8 100644 --- ORI/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js +++ ALT/babel/packages/babel-parser/test/helpers/to-fuzzed-options.js @@ -35,12 +35,12 @@ const toAdjustedSyntaxError = (adjust, error) => line: parseInt(line, 10), column: parseInt(column, 10), }; - return `(${adjust( + return `(${adjust(adjust, loc.line, "line", loc)}:${adjust( adjust, - loc.line, - "line", + loc.column, + "column", loc, - )}:${adjust(adjust, loc.column, "column", loc)})`; + )})`; }), ) : error; 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 183eedb4..c7d4c80b 100644 --- ORI/babel/packages/babel-plugin-transform-modules-umd/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-modules-umd/src/index.ts @@ -95,14 +95,17 @@ export default declare((api, options: Options) => { initAssignments = []; const members = globalName.split("."); - globalToAssign = members.slice(1).reduce((accum, curr) => { - initAssignments.push( - buildPrerequisiteAssignment({ - GLOBAL_REFERENCE: t.cloneNode(accum), - }), - ); - return t.memberExpression(accum, t.identifier(curr)); - }, t.memberExpression(t.identifier("global"), t.identifier(members[0]))); + globalToAssign = members.slice(1).reduce( + (accum, curr) => { + initAssignments.push( + buildPrerequisiteAssignment({ + GLOBAL_REFERENCE: t.cloneNode(accum), + }), + ); + return t.memberExpression(accum, t.identifier(curr)); + }, + t.memberExpression(t.identifier("global"), t.identifier(members[0])), + ); } } diff --git ORI/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts ALT/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts index 53657a52..902e87f9 100644 --- ORI/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts +++ ALT/babel/packages/babel-plugin-transform-private-property-in-object/src/index.ts @@ -161,9 +161,9 @@ export default declare((api, opt: Options) => { path.replaceWith( template.expression.ast` ${t.cloneNode(outerClass.node.id)} === ${buildCheckInRHS( - node.right, - file, - )} + node.right, + file, + )} `, ); } else { diff --git ORI/babel/packages/babel-template/src/builder.ts ALT/babel/packages/babel-template/src/builder.ts index e3acc387..faa7ee71 100644 --- ORI/babel/packages/babel-template/src/builder.ts +++ ALT/babel/packages/babel-template/src/builder.ts @@ -13,9 +13,10 @@ export type TemplateBuilder = { (tpl: string, opts?: PublicOpts): (replacements?: PublicReplacements) => T; // Building from a template literal produces an AST builder function by default. - (tpl: TemplateStringsArray, ...args: Array): ( - replacements?: PublicReplacements, - ) => T; + ( + tpl: TemplateStringsArray, + ...args: Array + ): (replacements?: PublicReplacements) => T; // Allow users to explicitly create templates that produce ASTs, skipping // the need for an intermediate function. diff --git ORI/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts ALT/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts index f47eee43..935ed613 100644 --- ORI/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts +++ ALT/babel/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts @@ -4,9 +4,10 @@ import type * as t from ".."; export default getOuterBindingIdentifiers as { (node: t.Node, duplicates: true): Record>; (node: t.Node, duplicates?: false): Record; - (node: t.Node, duplicates?: boolean): - | Record - | Record>; + ( + node: t.Node, + duplicates?: boolean, + ): Record | Record>; }; function getOuterBindingIdentifiers( ```
github-actions[bot] commented 1 year ago

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

The diff is empty.

github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: excalidraw/excalidraw@3ddcc48e4c192f525930e503b3e9214627f0043d

Diff (458 lines) ```diff diff --git ORI/excalidraw/public/index.html ALT/excalidraw/public/index.html index 5509ded..62293a1 100644 --- ORI/excalidraw/public/index.html +++ ALT/excalidraw/public/index.html @@ -1,4 +1,4 @@ - + diff --git ORI/excalidraw/src/actions/actionFrame.ts ALT/excalidraw/src/actions/actionFrame.ts index 980d0f7..c93f0a6 100644 --- ORI/excalidraw/src/actions/actionFrame.ts +++ ALT/excalidraw/src/actions/actionFrame.ts @@ -39,10 +39,13 @@ export const actionSelectAllElementsInFrame = register({ elements, appState: { ...appState, - selectedElementIds: elementsInFrame.reduce((acc, element) => { - acc[element.id] = true; - return acc; - }, {} as Record), + selectedElementIds: elementsInFrame.reduce( + (acc, element) => { + acc[element.id] = true; + return acc; + }, + {} as Record, + ), }, commitToHistory: false, }; diff --git ORI/excalidraw/src/colors.ts ALT/excalidraw/src/colors.ts index 7da1283..b460899 100644 --- ORI/excalidraw/src/colors.ts +++ ALT/excalidraw/src/colors.ts @@ -6,12 +6,15 @@ const pick = , K extends readonly (keyof R)[]>( source: R, keys: K, ) => { - return keys.reduce((acc, key: K[number]) => { - if (key in source) { - acc[key] = source[key]; - } - return acc; - }, {} as Pick) as Pick; + return keys.reduce( + (acc, key: K[number]) => { + if (key in source) { + acc[key] = source[key]; + } + return acc; + }, + {} as Pick, + ) as Pick; }; export type ColorPickerColor = diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx index f9dc353..4960990 100644 --- ORI/excalidraw/src/components/App.tsx +++ ALT/excalidraw/src/components/App.tsx @@ -4386,12 +4386,13 @@ class App extends React.Component { ), // we need to duplicate because we'll be updating this state lastCoords: { ...origin }, - originalElements: this.scene - .getNonDeletedElements() - .reduce((acc, element) => { + originalElements: this.scene.getNonDeletedElements().reduce( + (acc, element) => { acc.set(element.id, deepCopyElement(element)); return acc; - }, new Map() as PointerDownState["originalElements"]), + }, + new Map() as PointerDownState["originalElements"], + ), resize: { handleType: false, isResizing: false, diff --git ORI/excalidraw/src/components/ExportDialog.scss ALT/excalidraw/src/components/ExportDialog.scss index 3cb31c4..2ee217c 100644 --- ORI/excalidraw/src/components/ExportDialog.scss +++ ALT/excalidraw/src/components/ExportDialog.scss @@ -107,7 +107,8 @@ border-radius: 1rem; background-color: var(--button-color); - box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.28), + box-shadow: + 0 3px 5px -1px rgba(0, 0, 0, 0.28), 0 6px 10px 0 rgba(0, 0, 0, 0.14); font-family: Cascadia; diff --git ORI/excalidraw/src/components/LayerUI.scss ALT/excalidraw/src/components/LayerUI.scss index b5c88cd..fbb6829 100644 --- ORI/excalidraw/src/components/LayerUI.scss +++ ALT/excalidraw/src/components/LayerUI.scss @@ -70,12 +70,16 @@ font-weight: 500; opacity: 0; visibility: hidden; - transition: visibility 0s linear 0s, opacity 0.5s; + transition: + visibility 0s linear 0s, + opacity 0.5s; &--visible { opacity: 1; visibility: visible; - transition: visibility 0s linear 300ms, opacity 0.5s; + transition: + visibility 0s linear 300ms, + opacity 0.5s; transition-delay: 0.8s; } } diff --git ORI/excalidraw/src/css/styles.scss ALT/excalidraw/src/css/styles.scss index 826540d..082741b 100644 --- ORI/excalidraw/src/css/styles.scss +++ ALT/excalidraw/src/css/styles.scss @@ -368,13 +368,19 @@ appearance: none; background-image: var(--dropdown-icon); background-repeat: no-repeat; - background-position: right 0.7rem top 50%, 0 0; + background-position: + right 0.7rem top 50%, + 0 0; :root[dir="rtl"] & { - background-position: left 0.7rem top 50%, 0 0; + background-position: + left 0.7rem top 50%, + 0 0; } - background-size: 0.65em auto, 100%; + background-size: + 0.65em auto, + 100%; &:focus { box-shadow: 0 0 0 2px var(--focus-highlight-color); diff --git ORI/excalidraw/src/element/bounds.test.ts ALT/excalidraw/src/element/bounds.test.ts index 850c506..c147f1c 100644 --- ORI/excalidraw/src/element/bounds.test.ts +++ ALT/excalidraw/src/element/bounds.test.ts @@ -31,7 +31,7 @@ const _ce = ({ width: w, height: h, angle: a, - } as ExcalidrawElement); + }) as ExcalidrawElement; describe("getElementAbsoluteCoords", () => { it("test x1 coordinate", () => { diff --git ORI/excalidraw/src/element/resizeTest.ts ALT/excalidraw/src/element/resizeTest.ts index a344720..448e2bf 100644 --- ORI/excalidraw/src/element/resizeTest.ts +++ ALT/excalidraw/src/element/resizeTest.ts @@ -70,20 +70,26 @@ export const getElementWithTransformHandleType = ( zoom: Zoom, pointerType: PointerType, ) => { - return elements.reduce((result, element) => { - if (result) { - return result; - } - const transformHandleType = resizeTest( - element, - appState, - scenePointerX, - scenePointerY, - zoom, - pointerType, - ); - return transformHandleType ? { element, transformHandleType } : null; - }, null as { element: NonDeletedExcalidrawElement; transformHandleType: MaybeTransformHandleType } | null); + return elements.reduce( + (result, element) => { + if (result) { + return result; + } + const transformHandleType = resizeTest( + element, + appState, + scenePointerX, + scenePointerY, + zoom, + pointerType, + ); + return transformHandleType ? { element, transformHandleType } : null; + }, + null as { + element: NonDeletedExcalidrawElement; + transformHandleType: MaybeTransformHandleType; + } | null, + ); }; export const getTransformHandleTypeFromCoords = ( diff --git ORI/excalidraw/src/history.ts ALT/excalidraw/src/history.ts index d102a7e..0a5ce4c 100644 --- ORI/excalidraw/src/history.ts +++ ALT/excalidraw/src/history.ts @@ -104,35 +104,38 @@ class History { ): DehydratedHistoryEntry => this.dehydrateHistoryEntry({ appState: clearAppStatePropertiesForHistory(appState), - elements: elements.reduce((elements, element) => { - if ( - isLinearElement(element) && - appState.multiElement && - appState.multiElement.id === element.id - ) { - // don't store multi-point arrow if still has only one point + elements: elements.reduce( + (elements, element) => { if ( + isLinearElement(element) && appState.multiElement && - appState.multiElement.id === element.id && - element.points.length < 2 + appState.multiElement.id === element.id ) { - return elements; + // don't store multi-point arrow if still has only one point + if ( + appState.multiElement && + appState.multiElement.id === element.id && + element.points.length < 2 + ) { + return elements; + } + + elements.push({ + ...element, + // don't store last point if not committed + points: + element.lastCommittedPoint !== + element.points[element.points.length - 1] + ? element.points.slice(0, -1) + : element.points, + }); + } else { + elements.push(element); } - - elements.push({ - ...element, - // don't store last point if not committed - points: - element.lastCommittedPoint !== - element.points[element.points.length - 1] - ? element.points.slice(0, -1) - : element.points, - }); - } else { - elements.push(element); - } - return elements; - }, [] as Mutable), + return elements; + }, + [] as Mutable, + ), }); shouldCreateEntry(nextEntry: HistoryEntry): boolean { diff --git ORI/excalidraw/src/packages/excalidraw/example/public/index.html ALT/excalidraw/src/packages/excalidraw/example/public/index.html index 7f4ed24..27f32cd 100644 --- ORI/excalidraw/src/packages/excalidraw/example/public/index.html +++ ALT/excalidraw/src/packages/excalidraw/example/public/index.html @@ -1,4 +1,4 @@ - + diff --git ORI/excalidraw/src/renderer/renderScene.ts ALT/excalidraw/src/renderer/renderScene.ts index eac3d3c..f4f1b44 100644 --- ORI/excalidraw/src/renderer/renderScene.ts +++ ALT/excalidraw/src/renderer/renderScene.ts @@ -604,44 +604,57 @@ export const _renderScene = ({ ); } if (showBoundingBox) { - const selections = elements.reduce((acc, element) => { - const selectionColors = []; - // local user - if ( - locallySelectedIds.includes(element.id) && - !isSelectedViaGroup(appState, element) - ) { - selectionColors.push(selectionColor); - } - // remote users - if (renderConfig.remoteSelectedElementIds[element.id]) { - selectionColors.push( - ...renderConfig.remoteSelectedElementIds[element.id].map( - (socketId) => { - const background = getClientColor(socketId); - return background; - }, - ), - ); - } - - if (selectionColors.length) { - const [elementX1, elementY1, elementX2, elementY2, cx, cy] = - getElementAbsoluteCoords(element, true); - acc.push({ - angle: element.angle, - elementX1, - elementY1, - elementX2, - elementY2, - selectionColors, - dashed: !!renderConfig.remoteSelectedElementIds[element.id], - cx, - cy, - }); - } - return acc; - }, [] as { angle: number; elementX1: number; elementY1: number; elementX2: number; elementY2: number; selectionColors: string[]; dashed?: boolean; cx: number; cy: number }[]); + const selections = elements.reduce( + (acc, element) => { + const selectionColors = []; + // local user + if ( + locallySelectedIds.includes(element.id) && + !isSelectedViaGroup(appState, element) + ) { + selectionColors.push(selectionColor); + } + // remote users + if (renderConfig.remoteSelectedElementIds[element.id]) { + selectionColors.push( + ...renderConfig.remoteSelectedElementIds[element.id].map( + (socketId) => { + const background = getClientColor(socketId); + return background; + }, + ), + ); + } + + if (selectionColors.length) { + const [elementX1, elementY1, elementX2, elementY2, cx, cy] = + getElementAbsoluteCoords(element, true); + acc.push({ + angle: element.angle, + elementX1, + elementY1, + elementX2, + elementY2, + selectionColors, + dashed: !!renderConfig.remoteSelectedElementIds[element.id], + cx, + cy, + }); + } + return acc; + }, + [] as { + angle: number; + elementX1: number; + elementY1: number; + elementX2: number; + elementY2: number; + selectionColors: string[]; + dashed?: boolean; + cx: number; + cy: number; + }[], + ); const addSelectionForGroupId = (groupId: GroupId) => { const groupElements = getElementsInGroup(elements, groupId); diff --git ORI/excalidraw/src/scene/export.ts ALT/excalidraw/src/scene/export.ts index 78fc9b4..642747b 100644 --- ORI/excalidraw/src/scene/export.ts +++ ALT/excalidraw/src/scene/export.ts @@ -168,8 +168,8 @@ export const exportToSvg = async ( exportingFrameClipPath = ` @@ -235,10 +235,13 @@ const getCanvasSize = ( if (!isExportingWholeCanvas || onlyExportingSingleFrame) { const frames = elements.filter((element) => element.type === "frame"); - const exportedFrameIds = frames.reduce((acc, frame) => { - acc[frame.id] = true; - return acc; - }, {} as Record); + const exportedFrameIds = frames.reduce( + (acc, frame) => { + acc[frame.id] = true; + return acc; + }, + {} as Record, + ); // elements in a frame do not affect the canvas size if we're not exporting // the whole canvas diff --git ORI/excalidraw/src/tests/helpers/api.ts ALT/excalidraw/src/tests/helpers/api.ts index 7bba8bd..9edb595 100644 --- ORI/excalidraw/src/tests/helpers/api.ts +++ ALT/excalidraw/src/tests/helpers/api.ts @@ -28,10 +28,13 @@ const { h } = window; export class API { static setSelectedElements = (elements: ExcalidrawElement[]) => { h.setState({ - selectedElementIds: elements.reduce((acc, element) => { - acc[element.id] = true; - return acc; - }, {} as Record), + selectedElementIds: elements.reduce( + (acc, element) => { + acc[element.id] = true; + return acc; + }, + {} as Record, + ), }); }; diff --git ORI/excalidraw/src/zindex.ts ALT/excalidraw/src/zindex.ts index a1f051c..3c20868 100644 --- ORI/excalidraw/src/zindex.ts +++ ALT/excalidraw/src/zindex.ts @@ -188,11 +188,14 @@ const getTargetElementsMap = ( elements: readonly T[], indices: number[], ) => { - return indices.reduce((acc, index) => { - const element = elements[index]; - acc[element.id] = element; - return acc; - }, {} as Record); + return indices.reduce( + (acc, index) => { + const element = elements[index]; + acc[element.id] = element; + return acc; + }, + {} as Record, + ); }; const _shiftElements = ( ```
github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: typescript-eslint/typescript-eslint@4bf2d7360eaf74c9ef87b196ff4c459b8f50800b

Diff (158 lines) ````diff diff --git ORI/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts ALT/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts index bd8ce6a..b4e8d75 100644 --- ORI/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts +++ ALT/typescript-eslint/packages/eslint-plugin-tslint/src/custom-linter.ts @@ -4,7 +4,10 @@ import type { Program, SourceFile } from 'typescript'; // @ts-expect-error - We need to access the program, but Linter has private program already export class CustomLinter extends Linter { - constructor(options: ILinterOptions, private readonly program: Program) { + constructor( + options: ILinterOptions, + private readonly program: Program, + ) { super(options, program); } diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md index e5902b2..5bfd9cb 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/default-param-last.md @@ -22,10 +22,16 @@ function f(a = 0, b: number) {} function f(a: number, b = 0, c: number) {} function f(a: number, b?: number, c: number) {} class Foo { - constructor(public a = 10, private b: number) {} + constructor( + public a = 10, + private b: number, + ) {} } class Foo { - constructor(public a?: number, private b: number) {} + constructor( + public a?: number, + private b: number, + ) {} } ``` @@ -40,9 +46,15 @@ function f(a: number, b?: number) {} function f(a: number, b?: number, c = 0) {} function f(a: number, b = 0, c?: number) {} class Foo { - constructor(public a, private b = 0) {} + constructor( + public a, + private b = 0, + ) {} } class Foo { - constructor(public a, private b?: number) {} + constructor( + public a, + private b?: number, + ) {} } ``` diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md index 0d0e476..687aa70 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-function-return-type.md @@ -209,14 +209,14 @@ Examples of code for this rule with `{ allowDirectConstAssertionInArrowFunctions #### ❌ Incorrect ```ts -const func = (value: number) => ({ type: 'X', value } as any); -const func = (value: number) => ({ type: 'X', value } as Action); +const func = (value: number) => ({ type: 'X', value }) as any; +const func = (value: number) => ({ type: 'X', value }) as Action; ``` #### ✅ Correct ```ts -const func = (value: number) => ({ foo: 'bar', value } as const); +const func = (value: number) => ({ foo: 'bar', value }) as const; const func = () => x as const; ``` @@ -255,7 +255,7 @@ function foo(t: T) { return t; } -const bar = (t: T) => t; +const bar = (t: T) => t; ``` #### ✅ Correct diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 87d7d23..43cd4fe 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -90,7 +90,10 @@ The following patterns are considered correct with the default options `{ access ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -113,7 +116,10 @@ The following patterns are considered incorrect with the accessibility set to ** ```ts class Animal { - public constructor(public breed, name) { + public constructor( + public breed, + name, + ) { // Parameter property and constructor this.animalName = name; } @@ -136,7 +142,10 @@ The following patterns are considered correct with the accessibility set to **no ```ts class Animal { - constructor(protected breed, name) { + constructor( + protected breed, + name, + ) { // Parameter property and constructor this.name = name; } diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md index e48af85..d10515e 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -131,11 +131,11 @@ export const bar = () => 1; #### ✅ Correct ```ts -export const func = (value: number) => ({ type: 'X', value } as const); +export const func = (value: number) => ({ type: 'X', value }) as const; export const foo = () => ({ bar: true, - } as const); + }) as const; export const bar = () => 1 as const; ``` diff --git ORI/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md ALT/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md index 45a7f8f..7a55b6f 100644 --- ORI/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md +++ ALT/typescript-eslint/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md @@ -46,7 +46,7 @@ function foo(bool?: boolean) { } // `any`, unconstrained generics and unions of more than one primitive type are disallowed -const foo = (arg: T) => (arg ? 1 : 0); +const foo = (arg: T) => (arg ? 1 : 0); // always-truthy and always-falsy types are disallowed let obj = {}; ````
github-actions[bot] commented 1 year ago

prettier/prettier@main VS prettier/prettier@2.8.8 :: vega/vega-lite@c9659206602eda1d894702a2a1f5b526b9832f9f

Diff (389 lines) ```diff diff --git ORI/vega-lite/src/compile/data/aggregate.ts ALT/vega-lite/src/compile/data/aggregate.ts index a952e22..b09238c 100644 --- ORI/vega-lite/src/compile/data/aggregate.ts +++ ALT/vega-lite/src/compile/data/aggregate.ts @@ -68,7 +68,11 @@ export class AggregateNode extends DataFlowNode { * @param dimensions string set for dimensions * @param measures dictionary mapping field name => dict of aggregation functions and names to use */ - constructor(parent: DataFlowNode, private dimensions: Set, private measures: Measures) { + constructor( + parent: DataFlowNode, + private dimensions: Set, + private measures: Measures + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/bin.ts ALT/vega-lite/src/compile/data/bin.ts index 999fae5..1c43602 100644 --- ORI/vega-lite/src/compile/data/bin.ts +++ ALT/vega-lite/src/compile/data/bin.ts @@ -105,7 +105,10 @@ export class BinNode extends DataFlowNode { return new BinNode(null, duplicate(this.bins)); } - constructor(parent: DataFlowNode, private bins: Dict) { + constructor( + parent: DataFlowNode, + private bins: Dict + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/calculate.ts ALT/vega-lite/src/compile/data/calculate.ts index c31baf2..082b241 100644 --- ORI/vega-lite/src/compile/data/calculate.ts +++ ALT/vega-lite/src/compile/data/calculate.ts @@ -17,7 +17,10 @@ export class CalculateNode extends DataFlowNode { return new CalculateNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: CalculateTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: CalculateTransform + ) { super(parent); this._dependentFields = getDependentFields(this.transform.calculate); diff --git ORI/vega-lite/src/compile/data/dataflow.ts ALT/vega-lite/src/compile/data/dataflow.ts index c3acdb2..3069fcb 100644 --- ORI/vega-lite/src/compile/data/dataflow.ts +++ ALT/vega-lite/src/compile/data/dataflow.ts @@ -12,7 +12,10 @@ export abstract class DataFlowNode { protected _hash: string | number; - constructor(parent: DataFlowNode, public readonly debugName?: string) { + constructor( + parent: DataFlowNode, + public readonly debugName?: string + ) { if (parent) { this.parent = parent; } diff --git ORI/vega-lite/src/compile/data/density.ts ALT/vega-lite/src/compile/data/density.ts index d02cff1..b433dde 100644 --- ORI/vega-lite/src/compile/data/density.ts +++ ALT/vega-lite/src/compile/data/density.ts @@ -11,7 +11,10 @@ export class DensityTransformNode extends DataFlowNode { return new DensityTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: DensityTransform) { + constructor( + parent: DataFlowNode, + private transform: DensityTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/extent.ts ALT/vega-lite/src/compile/data/extent.ts index ed87f0a..202fa3e 100644 --- ORI/vega-lite/src/compile/data/extent.ts +++ ALT/vega-lite/src/compile/data/extent.ts @@ -11,7 +11,10 @@ export class ExtentTransformNode extends DataFlowNode { return new ExtentTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: ExtentTransform) { + constructor( + parent: DataFlowNode, + private transform: ExtentTransform + ) { super(parent); this.transform = duplicate(transform); } diff --git ORI/vega-lite/src/compile/data/filterinvalid.ts ALT/vega-lite/src/compile/data/filterinvalid.ts index e0cadf5..5126ea8 100644 --- ORI/vega-lite/src/compile/data/filterinvalid.ts +++ ALT/vega-lite/src/compile/data/filterinvalid.ts @@ -13,7 +13,10 @@ export class FilterInvalidNode extends DataFlowNode { return new FilterInvalidNode(null, {...this.filter}); } - constructor(parent: DataFlowNode, public readonly filter: Dict>) { + constructor( + parent: DataFlowNode, + public readonly filter: Dict> + ) { super(parent); } @@ -25,20 +28,23 @@ export class FilterInvalidNode extends DataFlowNode { return null; } - const filter = model.reduceFieldDef((aggregator: Dict>, fieldDef, channel) => { - const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); - if (scaleComponent) { - const scaleType = scaleComponent.get('type'); + const filter = model.reduceFieldDef( + (aggregator: Dict>, fieldDef, channel) => { + const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); - // While discrete domain scales can handle invalid values, continuous scales can't. - // Thus, for non-path marks, we have to filter null for scales with continuous domains. - // (For path marks, we will use "defined" property and skip these values instead.) - if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { - aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def + // While discrete domain scales can handle invalid values, continuous scales can't. + // Thus, for non-path marks, we have to filter null for scales with continuous domains. + // (For path marks, we will use "defined" property and skip these values instead.) + if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { + aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def + } } - } - return aggregator; - }, {} as Dict>); + return aggregator; + }, + {} as Dict> + ); if (!keys(filter).length) { return null; diff --git ORI/vega-lite/src/compile/data/flatten.ts ALT/vega-lite/src/compile/data/flatten.ts index 3a4c8b8..dd25c35 100644 --- ORI/vega-lite/src/compile/data/flatten.ts +++ ALT/vega-lite/src/compile/data/flatten.ts @@ -11,7 +11,10 @@ export class FlattenTransformNode extends DataFlowNode { return new FlattenTransformNode(this.parent, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: FlattenTransform) { + constructor( + parent: DataFlowNode, + private transform: FlattenTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const {flatten, as = []} = this.transform; diff --git ORI/vega-lite/src/compile/data/fold.ts ALT/vega-lite/src/compile/data/fold.ts index 6466a3e..e35a592 100644 --- ORI/vega-lite/src/compile/data/fold.ts +++ ALT/vega-lite/src/compile/data/fold.ts @@ -11,7 +11,10 @@ export class FoldTransformNode extends DataFlowNode { return new FoldTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: FoldTransform) { + constructor( + parent: DataFlowNode, + private transform: FoldTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/graticule.ts ALT/vega-lite/src/compile/data/graticule.ts index 2aa9321..771860e 100644 --- ORI/vega-lite/src/compile/data/graticule.ts +++ ALT/vega-lite/src/compile/data/graticule.ts @@ -8,7 +8,10 @@ export class GraticuleNode extends DataFlowNode { return new GraticuleNode(null, this.params); } - constructor(parent: DataFlowNode, private params: true | GraticuleParams) { + constructor( + parent: DataFlowNode, + private params: true | GraticuleParams + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/impute.ts ALT/vega-lite/src/compile/data/impute.ts index 63f8c09..86fbea5 100644 --- ORI/vega-lite/src/compile/data/impute.ts +++ ALT/vega-lite/src/compile/data/impute.ts @@ -16,7 +16,10 @@ export class ImputeNode extends DataFlowNode { return new ImputeNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: ImputeTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: ImputeTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/joinaggregate.ts ALT/vega-lite/src/compile/data/joinaggregate.ts index 6113860..066ba51 100644 --- ORI/vega-lite/src/compile/data/joinaggregate.ts +++ ALT/vega-lite/src/compile/data/joinaggregate.ts @@ -15,7 +15,10 @@ export class JoinAggregateTransformNode extends DataFlowNode { return new JoinAggregateTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: JoinAggregateTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: JoinAggregateTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/loess.ts ALT/vega-lite/src/compile/data/loess.ts index 1d8d457..e3dbd1a 100644 --- ORI/vega-lite/src/compile/data/loess.ts +++ ALT/vega-lite/src/compile/data/loess.ts @@ -11,7 +11,10 @@ export class LoessTransformNode extends DataFlowNode { return new LoessTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: LoessTransform) { + constructor( + parent: DataFlowNode, + private transform: LoessTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/lookup.ts ALT/vega-lite/src/compile/data/lookup.ts index 7a612e1..736d1ca 100644 --- ORI/vega-lite/src/compile/data/lookup.ts +++ ALT/vega-lite/src/compile/data/lookup.ts @@ -14,7 +14,11 @@ export class LookupNode extends DataFlowNode { return new LookupNode(null, duplicate(this.transform), this.secondary); } - constructor(parent: DataFlowNode, public readonly transform: LookupTransform, public readonly secondary: string) { + constructor( + parent: DataFlowNode, + public readonly transform: LookupTransform, + public readonly secondary: string + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/pivot.ts ALT/vega-lite/src/compile/data/pivot.ts index ca96dc1..c965784 100644 --- ORI/vega-lite/src/compile/data/pivot.ts +++ ALT/vega-lite/src/compile/data/pivot.ts @@ -11,7 +11,10 @@ export class PivotTransformNode extends DataFlowNode { return new PivotTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: PivotTransform) { + constructor( + parent: DataFlowNode, + private transform: PivotTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/quantile.ts ALT/vega-lite/src/compile/data/quantile.ts index bac3d28..08349ff 100644 --- ORI/vega-lite/src/compile/data/quantile.ts +++ ALT/vega-lite/src/compile/data/quantile.ts @@ -11,7 +11,10 @@ export class QuantileTransformNode extends DataFlowNode { return new QuantileTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: QuantileTransform) { + constructor( + parent: DataFlowNode, + private transform: QuantileTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/regression.ts ALT/vega-lite/src/compile/data/regression.ts index 41e85f4..520e41f 100644 --- ORI/vega-lite/src/compile/data/regression.ts +++ ALT/vega-lite/src/compile/data/regression.ts @@ -11,7 +11,10 @@ export class RegressionTransformNode extends DataFlowNode { return new RegressionTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: RegressionTransform) { + constructor( + parent: DataFlowNode, + private transform: RegressionTransform + ) { super(parent); this.transform = duplicate(transform); // duplicate to prevent side effects const specifiedAs = this.transform.as ?? [undefined, undefined]; diff --git ORI/vega-lite/src/compile/data/sample.ts ALT/vega-lite/src/compile/data/sample.ts index 771544b..a63010b 100644 --- ORI/vega-lite/src/compile/data/sample.ts +++ ALT/vega-lite/src/compile/data/sample.ts @@ -11,7 +11,10 @@ export class SampleTransformNode extends DataFlowNode { return new SampleTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private transform: SampleTransform) { + constructor( + parent: DataFlowNode, + private transform: SampleTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/sequence.ts ALT/vega-lite/src/compile/data/sequence.ts index 9812e2d..032d168 100644 --- ORI/vega-lite/src/compile/data/sequence.ts +++ ALT/vega-lite/src/compile/data/sequence.ts @@ -8,7 +8,10 @@ export class SequenceNode extends DataFlowNode { return new SequenceNode(null, this.params); } - constructor(parent: DataFlowNode, private params: SequenceParams) { + constructor( + parent: DataFlowNode, + private params: SequenceParams + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/timeunit.ts ALT/vega-lite/src/compile/data/timeunit.ts index 1cf25d7..cea3ced 100644 --- ORI/vega-lite/src/compile/data/timeunit.ts +++ ALT/vega-lite/src/compile/data/timeunit.ts @@ -35,7 +35,10 @@ export class TimeUnitNode extends DataFlowNode { return new TimeUnitNode(null, duplicate(this.formula)); } - constructor(parent: DataFlowNode, private formula: Dict) { + constructor( + parent: DataFlowNode, + private formula: Dict + ) { super(parent); } diff --git ORI/vega-lite/src/compile/data/window.ts ALT/vega-lite/src/compile/data/window.ts index 2923d03..4709903 100644 --- ORI/vega-lite/src/compile/data/window.ts +++ ALT/vega-lite/src/compile/data/window.ts @@ -16,7 +16,10 @@ export class WindowTransformNode extends DataFlowNode { return new WindowTransformNode(null, duplicate(this.transform)); } - constructor(parent: DataFlowNode, private readonly transform: WindowTransform) { + constructor( + parent: DataFlowNode, + private readonly transform: WindowTransform + ) { super(parent); } diff --git ORI/vega-lite/src/compile/split.ts ALT/vega-lite/src/compile/split.ts index 5901975..3745045 100644 --- ORI/vega-lite/src/compile/split.ts +++ ALT/vega-lite/src/compile/split.ts @@ -9,7 +9,10 @@ import {deepEqual, duplicate, getFirstDefined, keys} from '../util'; */ // eslint-disable-next-line @typescript-eslint/ban-types export class Split { - constructor(public readonly explicit: Partial = {}, public readonly implicit: Partial = {}) {} + constructor( + public readonly explicit: Partial = {}, + public readonly implicit: Partial = {} + ) {} public clone() { return new Split(duplicate(this.explicit), duplicate(this.implicit)); ```