Skip to content

Commit

Permalink
update dependencies, apply new lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
zawys committed Feb 6, 2021
1 parent 5582579 commit 9fb19c4
Show file tree
Hide file tree
Showing 6 changed files with 1,750 additions and 1,589 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,13 @@
}
},
"devDependencies": {
"@parcel/transformer-typescript-tsc": "^2.0.0-nightly.487",
"@types/diff": "^4.0.2",
"@parcel/transformer-typescript-tsc": "^2.0.0-nightly.576",
"@types/diff": "^5.0.0",
"@types/glob": "^7.1.3",
"@types/mocha": "^8.0.3",
"@types/node": "^14.6.2",
"@types/vscode": "^1.48.0",
"@types/which": "^1.3.2",
"@types/which": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"cpy-cli": "^3.1.1",
Expand All @@ -372,11 +372,11 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-unicorn": "^24.0.0",
"eslint-plugin-unicorn": "^27.0.0",
"glob": "^7.1.6",
"husky": "^4.2.5",
"mocha": "^8.1.3",
"node-pty": "^0.9.0",
"node-pty": "^0.10.0",
"parcel": "^2.0.0-beta.1",
"prettier": "^2.1.1",
"ts-node": "^9.0.0",
Expand Down
15 changes: 9 additions & 6 deletions src/mergetoolUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class MergetoolUI {
}
this.disposing = true;
this.disposeStatusBarItems();
this.registeredDisposables.forEach((item) => void item?.dispose());
for (const item of this.registeredDisposables) void item?.dispose();
this.registeredDisposables = new Set();
void this.disposeProcessManager();
}
Expand Down Expand Up @@ -586,8 +586,13 @@ export class MergetoolUI {
return true;
}

private disposeStatusBarItems() {
this.statusBarItems?.forEach((item) => item.dispose());
private disposeStatusBarItems(): void {
if (this.statusBarItems === undefined) {
return;
}
for (const item of this.statusBarItems) {
item.dispose();
}
this.statusBarItems = undefined;
}

Expand All @@ -610,9 +615,7 @@ export class MergetoolUI {
14,
nextMergeStepCommandID,
"Go to next conflict, next file, or commit message"
)
);
this.statusBarItems.push(
),
this.createStatusBarItem(
"$(live-share)" + (showLabel ? " Skip file" : ""),
13,
Expand Down
26 changes: 16 additions & 10 deletions src/scrollSynchronizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export class ScrollSynchronizer implements Disposable {
syncMethod?: ScrollSyncMethod,
mappedIntervalRelativeSize?: number
): Promise<ScrollSynchronizer> {
const scrollIgnoreCounts = new Array<number>(editors.length).fill(
synchronizationSourceOnStartIndex === undefined ? 0 : 1
);
const scrollIgnoreCounts = Array.from<number>({
length: editors.length,
}).fill(synchronizationSourceOnStartIndex === undefined ? 0 : 1);
if (synchronizationSourceOnStartIndex !== undefined) {
scrollIgnoreCounts[synchronizationSourceOnStartIndex] = 0;
}
Expand Down Expand Up @@ -85,12 +85,18 @@ export class ScrollSynchronizer implements Disposable {
private readonly centerPosCorrection = +0.5,
private readonly eventDecayPerSec = 0.25
) {
this.editorLinesCache = new Array<undefined>(editors.length).fill(
undefined
);
this.scrollIgnoreDates = new Array<number>(editors.length).fill(0);
this.selectionIgnoreCounts = new Array<number>(editors.length).fill(0);
this.selectionIgnoreDates = new Array<number>(editors.length).fill(0);
this.editorLinesCache = Array.from<undefined>({
length: editors.length,
}).fill(undefined);
this.scrollIgnoreDates = Array.from<number>({
length: editors.length,
}).fill(0);
this.selectionIgnoreCounts = Array.from<number>({
length: editors.length,
}).fill(0);
this.selectionIgnoreDates = Array.from<number>({
length: editors.length,
}).fill(0);
this.documents = this.editors.map((editor) => editor.document);
this.mappedWeight1 = (1 - mappedIntervalRelativeSize) / 2;
this.mappedWeight0 = 1 - this.mappedWeight1;
Expand Down Expand Up @@ -477,7 +483,7 @@ export class ScrollSynchronizer implements Disposable {
if (mapper === undefined) {
return undefined;
}
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
// eslint-disable-next-line unicorn/no-array-callback-reference
return mapper.map(position);
}
}
Expand Down
6 changes: 4 additions & 2 deletions test/mochaTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function runMochaTests(
): Promise<void> {
// Create the mocha test
const debug = /--debug|--inspect/.test(
[process.argv.concat(process.execArgv)].join(" ")
[...process.argv, ...process.execArgv].join(" ")
);
const mocha = new Mocha({
ui: "tdd",
Expand All @@ -25,7 +25,9 @@ export function runMochaTests(
}

// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));
for (const f of files) {
mocha.addFile(path.resolve(testsRoot, f));
}

try {
// Run the mocha test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ suite("DiffLineMapper", () => {
testCase.old.split(""),
testCase.new.split("")
);
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
// eslint-disable-next-line unicorn/no-array-callback-reference
const actual = sut.map(testCase.from);
assert.strictEqual(
actual,
Expand Down
Loading

0 comments on commit 9fb19c4

Please sign in to comment.