1
0
mirror of https://github.com/excalidraw/excalidraw.git synced 2024-11-02 03:25:53 +01:00

Update react-scripts, TS and remove ESlint as it exist in CRA (#2302)

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Lipis 2020-10-28 18:28:07 +02:00 committed by GitHub
parent 44af6b4a78
commit 9de6c947ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7280 additions and 3057 deletions

@ -1,7 +1,10 @@
{ {
"extends": ["prettier", "react-app"], "extends": ["prettier", "react-app", "react-app/jest"],
"plugins": ["prettier"], "plugins": ["prettier"],
"rules": { "rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-redeclare": "off",
"import/no-anonymous-default-export": "off",
"curly": "warn", "curly": "warn",
"no-console": [ "no-console": [
"warn", "warn",

9934
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -44,16 +44,15 @@
"pwacompat": "2.0.17", "pwacompat": "2.0.17",
"react": "17.0.1", "react": "17.0.1",
"react-dom": "17.0.1", "react-dom": "17.0.1",
"react-scripts": "3.4.3", "react-scripts": "4.0.0",
"roughjs": "4.3.1", "roughjs": "4.3.1",
"socket.io-client": "2.3.1", "socket.io-client": "2.3.1",
"typescript": "3.9.7" "typescript": "4.0.5"
}, },
"devDependencies": { "devDependencies": {
"@types/lodash.throttle": "4.1.6", "@types/lodash.throttle": "4.1.6",
"@types/pako": "1.0.1", "@types/pako": "1.0.1",
"asar": "3.0.3", "asar": "3.0.3",
"eslint": "6.8.0",
"eslint-config-prettier": "6.15.0", "eslint-config-prettier": "6.15.0",
"eslint-plugin-prettier": "3.1.4", "eslint-plugin-prettier": "3.1.4",
"firebase-tools": "8.14.1", "firebase-tools": "8.14.1",
@ -76,7 +75,8 @@
"jest": { "jest": {
"transformIgnorePatterns": [ "transformIgnorePatterns": [
"node_modules/(?!(roughjs|points-on-curve|path-data-parser|points-on-path|browser-nativefs)/)" "node_modules/(?!(roughjs|points-on-curve|path-data-parser|points-on-path|browser-nativefs)/)"
] ],
"resetMocks": false
}, },
"name": "excalidraw", "name": "excalidraw",
"private": true, "private": true,
@ -94,7 +94,7 @@
"prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore", "prettier": "prettier \"**/*.{css,scss,json,md,html,yml}\" --ignore-path=.eslintignore",
"start": "react-scripts start", "start": "react-scripts start",
"test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false", "test:all": "npm run test:typecheck && npm run test:code && npm run test:other && npm run test:app -- --watchAll=false",
"test:app": "react-scripts test --env=jsdom-fourteen --passWithNoTests", "test:app": "react-scripts test --passWithNoTests",
"test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .", "test:code": "eslint --max-warnings=0 --ignore-path .gitignore --ext .js,.ts,.tsx .",
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache", "test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
"test:other": "npm run prettier -- --list-different", "test:other": "npm run prettier -- --list-different",

@ -57,11 +57,11 @@ const restoreElementWithProperties = <T extends ExcalidrawElement>(
boundElementIds: element.boundElementIds ?? [], boundElementIds: element.boundElementIds ?? [],
}; };
return { return ({
...base, ...base,
...getNormalizedDimensions(base), ...getNormalizedDimensions(base),
...extra, ...extra,
} as T; } as unknown) as T;
}; };
const restoreElement = ( const restoreElement = (

@ -3240,8 +3240,8 @@ Object {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 1,
"type": "rectangle", "type": "rectangle",
"version": 4, "version": 8,
"versionNonce": 453191, "versionNonce": 1116226695,
"width": 10, "width": 10,
"x": 10, "x": 10,
"y": 10, "y": 10,
@ -3312,7 +3312,7 @@ Object {
"elements": Array [ "elements": Array [
Object { Object {
"angle": 0, "angle": 0,
"backgroundColor": "#fa5252", "backgroundColor": "transparent",
"boundElementIds": null, "boundElementIds": null,
"fillStyle": "hachure", "fillStyle": "hachure",
"groupIds": Array [], "groupIds": Array [],
@ -3335,6 +3335,78 @@ Object {
}, },
], ],
}, },
Object {
"appState": Object {
"editingGroupId": null,
"editingLinearElement": null,
"name": "Untitled-201933152653",
"selectedElementIds": Object {
"id0": true,
},
"viewBackgroundColor": "#ffffff",
},
"elements": Array [
Object {
"angle": 0,
"backgroundColor": "#fa5252",
"boundElementIds": null,
"fillStyle": "hachure",
"groupIds": Array [],
"height": 10,
"id": "id0",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 337897,
"strokeColor": "#000000",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 5,
"versionNonce": 401146281,
"width": 10,
"x": 10,
"y": 10,
},
],
},
Object {
"appState": Object {
"editingGroupId": null,
"editingLinearElement": null,
"name": "Untitled-201933152653",
"selectedElementIds": Object {
"id0": true,
},
"viewBackgroundColor": "#ffffff",
},
"elements": Array [
Object {
"angle": 0,
"backgroundColor": "#fa5252",
"boundElementIds": null,
"fillStyle": "hachure",
"groupIds": Array [],
"height": 10,
"id": "id0",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 337897,
"strokeColor": "#000000",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 6,
"versionNonce": 2019559783,
"width": 10,
"x": 10,
"y": 10,
},
],
},
Object { Object {
"appState": Object { "appState": Object {
"editingGroupId": null, "editingGroupId": null,
@ -3363,8 +3435,8 @@ Object {
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 1,
"type": "rectangle", "type": "rectangle",
"version": 4, "version": 8,
"versionNonce": 453191, "versionNonce": 1116226695,
"width": 10, "width": 10,
"x": 10, "x": 10,
"y": 10, "y": 10,
@ -3377,7 +3449,7 @@ Object {
exports[`regression tests change the properties of a shape: [end of test] number of elements 1`] = `1`; exports[`regression tests change the properties of a shape: [end of test] number of elements 1`] = `1`;
exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `8`; exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `10`;
exports[`regression tests click on an element and drag it: [dragged] appState 1`] = ` exports[`regression tests click on an element and drag it: [dragged] appState 1`] = `
Object { Object {
@ -8633,7 +8705,7 @@ Object {
exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partialy overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] number of elements 1`] = `2`; exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partialy overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] number of elements 1`] = `2`;
exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partialy overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] number of renders 1`] = `15`; exports[`regression tests given a selected element A and a not selected element B with higher z-index than A and given B partialy overlaps A when there's a shift-click on the overlapped section B is added to the selection: [end of test] number of renders 1`] = `16`;
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] appState 1`] = ` exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] appState 1`] = `
Object { Object {
@ -8873,7 +8945,7 @@ Object {
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] number of elements 1`] = `2`; exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] number of elements 1`] = `2`;
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] number of renders 1`] = `15`; exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when clicking intersection between A and B B should be selected on pointer up: [end of test] number of renders 1`] = `16`;
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] appState 1`] = ` exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] appState 1`] = `
Object { Object {
@ -9175,7 +9247,7 @@ Object {
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] number of elements 1`] = `2`; exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] number of elements 1`] = `2`;
exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] number of renders 1`] = `16`; exports[`regression tests given selected element A with lower z-index than unselected element B and given B is partially over A when dragging on intersection between A and B A should be dragged and keep being selected: [end of test] number of renders 1`] = `17`;
exports[`regression tests hotkey 2 selects rectangle tool: [end of test] appState 1`] = ` exports[`regression tests hotkey 2 selects rectangle tool: [end of test] appState 1`] = `
Object { Object {
@ -23114,7 +23186,7 @@ Object {
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"version": 3, "version": 3,
"versionNonce": 1505387817, "versionNonce": 81784553,
"width": 20, "width": 20,
"x": 10, "x": 10,
"y": 10, "y": 10,
@ -23133,14 +23205,14 @@ Object {
"isDeleted": false, "isDeleted": false,
"opacity": 60, "opacity": 60,
"roughness": 2, "roughness": 2,
"seed": 238820263, "seed": 23633383,
"strokeColor": "#c92a2a", "strokeColor": "#c92a2a",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "dotted", "strokeStyle": "dotted",
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"version": 9, "version": 13,
"versionNonce": 1604849351, "versionNonce": 915032327,
"width": 20, "width": 20,
"x": 40, "x": 40,
"y": 40, "y": 40,
@ -23303,7 +23375,7 @@ Object {
"opacity": 100, "opacity": 100,
"roughness": 1, "roughness": 1,
"seed": 449462985, "seed": 449462985,
"strokeColor": "#c92a2a", "strokeColor": "#000000",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 1, "strokeWidth": 1,
@ -23350,42 +23422,6 @@ Object {
"x": 10, "x": 10,
"y": 10, "y": 10,
}, },
Object {
"angle": 0,
"backgroundColor": "#e64980",
"boundElementIds": null,
"fillStyle": "hachure",
"groupIds": Array [],
"height": 20,
"id": "id1",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 449462985,
"strokeColor": "#c92a2a",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 4,
"versionNonce": 2019559783,
"width": 20,
"x": 40,
"y": 40,
},
],
},
Object {
"appState": Object {
"editingGroupId": null,
"editingLinearElement": null,
"name": "Untitled-201933152653",
"selectedElementIds": Object {
"id1": true,
},
"viewBackgroundColor": "#ffffff",
},
"elements": Array [
Object { Object {
"angle": 0, "angle": 0,
"backgroundColor": "transparent", "backgroundColor": "transparent",
@ -23393,29 +23429,6 @@ Object {
"fillStyle": "hachure", "fillStyle": "hachure",
"groupIds": Array [], "groupIds": Array [],
"height": 20, "height": 20,
"id": "id0",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 337897,
"strokeColor": "#000000",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 2,
"versionNonce": 1278240551,
"width": 20,
"x": 10,
"y": 10,
},
Object {
"angle": 0,
"backgroundColor": "#e64980",
"boundElementIds": null,
"fillStyle": "cross-hatch",
"groupIds": Array [],
"height": 20,
"id": "id1", "id": "id1",
"isDeleted": false, "isDeleted": false,
"opacity": 100, "opacity": 100,
@ -23470,9 +23483,9 @@ Object {
}, },
Object { Object {
"angle": 0, "angle": 0,
"backgroundColor": "#e64980", "backgroundColor": "transparent",
"boundElementIds": null, "boundElementIds": null,
"fillStyle": "cross-hatch", "fillStyle": "hachure",
"groupIds": Array [], "groupIds": Array [],
"height": 20, "height": 20,
"id": "id1", "id": "id1",
@ -23483,7 +23496,7 @@ Object {
"strokeColor": "#c92a2a", "strokeColor": "#c92a2a",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "solid", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 1,
"type": "rectangle", "type": "rectangle",
"version": 6, "version": 6,
"versionNonce": 1116226695, "versionNonce": 1116226695,
@ -23531,7 +23544,7 @@ Object {
"angle": 0, "angle": 0,
"backgroundColor": "#e64980", "backgroundColor": "#e64980",
"boundElementIds": null, "boundElementIds": null,
"fillStyle": "cross-hatch", "fillStyle": "hachure",
"groupIds": Array [], "groupIds": Array [],
"height": 20, "height": 20,
"id": "id1", "id": "id1",
@ -23541,11 +23554,11 @@ Object {
"seed": 449462985, "seed": 449462985,
"strokeColor": "#c92a2a", "strokeColor": "#c92a2a",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "dotted", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 1,
"type": "rectangle", "type": "rectangle",
"version": 7, "version": 8,
"versionNonce": 1014066025, "versionNonce": 238820263,
"width": 20, "width": 20,
"x": 40, "x": 40,
"y": 40, "y": 40,
@ -23596,14 +23609,14 @@ Object {
"id": "id1", "id": "id1",
"isDeleted": false, "isDeleted": false,
"opacity": 100, "opacity": 100,
"roughness": 2, "roughness": 1,
"seed": 238820263, "seed": 449462985,
"strokeColor": "#c92a2a", "strokeColor": "#c92a2a",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "dotted", "strokeStyle": "solid",
"strokeWidth": 2, "strokeWidth": 1,
"type": "rectangle", "type": "rectangle",
"version": 8, "version": 9,
"versionNonce": 400692809, "versionNonce": 400692809,
"width": 20, "width": 20,
"x": 40, "x": 40,
@ -23654,16 +23667,193 @@ Object {
"height": 20, "height": 20,
"id": "id1", "id": "id1",
"isDeleted": false, "isDeleted": false,
"opacity": 60, "opacity": 100,
"roughness": 2, "roughness": 1,
"seed": 238820263, "seed": 449462985,
"strokeColor": "#c92a2a",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 2,
"type": "rectangle",
"version": 10,
"versionNonce": 1604849351,
"width": 20,
"x": 40,
"y": 40,
},
],
},
Object {
"appState": Object {
"editingGroupId": null,
"editingLinearElement": null,
"name": "Untitled-201933152653",
"selectedElementIds": Object {
"id1": true,
},
"viewBackgroundColor": "#ffffff",
},
"elements": Array [
Object {
"angle": 0,
"backgroundColor": "transparent",
"boundElementIds": null,
"fillStyle": "hachure",
"groupIds": Array [],
"height": 20,
"id": "id0",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 337897,
"strokeColor": "#000000",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 2,
"versionNonce": 1278240551,
"width": 20,
"x": 10,
"y": 10,
},
Object {
"angle": 0,
"backgroundColor": "#e64980",
"boundElementIds": null,
"fillStyle": "cross-hatch",
"groupIds": Array [],
"height": 20,
"id": "id1",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 449462985,
"strokeColor": "#c92a2a", "strokeColor": "#c92a2a",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "dotted", "strokeStyle": "dotted",
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"version": 9, "version": 11,
"versionNonce": 1604849351, "versionNonce": 1505387817,
"width": 20,
"x": 40,
"y": 40,
},
],
},
Object {
"appState": Object {
"editingGroupId": null,
"editingLinearElement": null,
"name": "Untitled-201933152653",
"selectedElementIds": Object {
"id1": true,
},
"viewBackgroundColor": "#ffffff",
},
"elements": Array [
Object {
"angle": 0,
"backgroundColor": "transparent",
"boundElementIds": null,
"fillStyle": "hachure",
"groupIds": Array [],
"height": 20,
"id": "id0",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 337897,
"strokeColor": "#000000",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 2,
"versionNonce": 1278240551,
"width": 20,
"x": 10,
"y": 10,
},
Object {
"angle": 0,
"backgroundColor": "#e64980",
"boundElementIds": null,
"fillStyle": "cross-hatch",
"groupIds": Array [],
"height": 20,
"id": "id1",
"isDeleted": false,
"opacity": 100,
"roughness": 2,
"seed": 23633383,
"strokeColor": "#c92a2a",
"strokeSharpness": "sharp",
"strokeStyle": "dotted",
"strokeWidth": 2,
"type": "rectangle",
"version": 12,
"versionNonce": 493213705,
"width": 20,
"x": 40,
"y": 40,
},
],
},
Object {
"appState": Object {
"editingGroupId": null,
"editingLinearElement": null,
"name": "Untitled-201933152653",
"selectedElementIds": Object {
"id1": true,
},
"viewBackgroundColor": "#ffffff",
},
"elements": Array [
Object {
"angle": 0,
"backgroundColor": "transparent",
"boundElementIds": null,
"fillStyle": "hachure",
"groupIds": Array [],
"height": 20,
"id": "id0",
"isDeleted": false,
"opacity": 100,
"roughness": 1,
"seed": 337897,
"strokeColor": "#000000",
"strokeSharpness": "sharp",
"strokeStyle": "solid",
"strokeWidth": 1,
"type": "rectangle",
"version": 2,
"versionNonce": 1278240551,
"width": 20,
"x": 10,
"y": 10,
},
Object {
"angle": 0,
"backgroundColor": "#e64980",
"boundElementIds": null,
"fillStyle": "cross-hatch",
"groupIds": Array [],
"height": 20,
"id": "id1",
"isDeleted": false,
"opacity": 60,
"roughness": 2,
"seed": 23633383,
"strokeColor": "#c92a2a",
"strokeSharpness": "sharp",
"strokeStyle": "dotted",
"strokeWidth": 2,
"type": "rectangle",
"version": 13,
"versionNonce": 915032327,
"width": 20, "width": 20,
"x": 40, "x": 40,
"y": 40, "y": 40,
@ -23699,7 +23889,7 @@ Object {
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"version": 3, "version": 3,
"versionNonce": 1505387817, "versionNonce": 81784553,
"width": 20, "width": 20,
"x": 10, "x": 10,
"y": 10, "y": 10,
@ -23715,14 +23905,14 @@ Object {
"isDeleted": false, "isDeleted": false,
"opacity": 60, "opacity": 60,
"roughness": 2, "roughness": 2,
"seed": 238820263, "seed": 23633383,
"strokeColor": "#c92a2a", "strokeColor": "#c92a2a",
"strokeSharpness": "sharp", "strokeSharpness": "sharp",
"strokeStyle": "dotted", "strokeStyle": "dotted",
"strokeWidth": 2, "strokeWidth": 2,
"type": "rectangle", "type": "rectangle",
"version": 9, "version": 13,
"versionNonce": 1604849351, "versionNonce": 915032327,
"width": 20, "width": 20,
"x": 40, "x": 40,
"y": 40, "y": 40,
@ -23735,7 +23925,7 @@ Object {
exports[`regression tests selecting 'Paste styles' in context menu pastes styles: [end of test] number of elements 1`] = `2`; exports[`regression tests selecting 'Paste styles' in context menu pastes styles: [end of test] number of elements 1`] = `2`;
exports[`regression tests selecting 'Paste styles' in context menu pastes styles: [end of test] number of renders 1`] = `19`; exports[`regression tests selecting 'Paste styles' in context menu pastes styles: [end of test] number of renders 1`] = `21`;
exports[`regression tests selecting 'Send backward' in context menu sends element backward: [end of test] appState 1`] = ` exports[`regression tests selecting 'Send backward' in context menu sends element backward: [end of test] appState 1`] = `
Object { Object {

@ -210,6 +210,7 @@ describe("regression tests", () => {
mouse.up(10, 10); mouse.up(10, 10);
const transformHandles = getTransformHandles("mouse"); const transformHandles = getTransformHandles("mouse");
// @ts-ignore
delete transformHandles.rotation; // exclude rotation handle delete transformHandles.rotation; // exclude rotation handle
for (const handlePos in transformHandles) { for (const handlePos in transformHandles) {
const [x, y] = transformHandles[ const [x, y] = transformHandles[

@ -10,6 +10,7 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,