Skip to content

Commit 4330f04

Browse files
authored
Upgrade dep following security advices (#935)
* Upgrade dep following security advices * Fix prettier 2.3
1 parent 50e8c03 commit 4330f04

File tree

7 files changed

+1015
-1410
lines changed

7 files changed

+1015
-1410
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@
144144
},
145145
"homepage": "https://github.com/jupyterlab/jupyterlab-git",
146146
"resolutions": {
147-
"@types/react": "^17.0.0"
147+
"@types/react": "^17.0.0",
148+
"codemirror": "~5.61.0"
148149
},
149150
"jupyterlab": {
150151
"discovery": {

src/commandsAndMenu.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export namespace CommandArguments {
8484

8585
function pluralizedContextLabel(singular: string, plural: string) {
8686
return (args: any) => {
87-
const { files } = (args as any) as CommandArguments.IGitContextAction;
87+
const { files } = args as any as CommandArguments.IGitContextAction;
8888
if (files.length > 1) {
8989
return plural;
9090
} else {
@@ -423,7 +423,7 @@ export function addCommands(
423423
label: trans.__('Show Diff'),
424424
caption: trans.__('Display a file diff.'),
425425
execute: async args => {
426-
const { model, isText } = (args as any) as {
426+
const { model, isText } = args as any as {
427427
model: Git.Diff.IModel<string>;
428428
isText?: boolean;
429429
};
@@ -516,7 +516,7 @@ export function addCommands(
516516
trans.__('Open selected files')
517517
),
518518
execute: async args => {
519-
const { files } = (args as any) as CommandArguments.IGitContextAction;
519+
const { files } = args as any as CommandArguments.IGitContextAction;
520520
for (const file of files) {
521521
const { x, y, to } = file;
522522
if (x === 'D' || y === 'D') {
@@ -549,7 +549,7 @@ export function addCommands(
549549
trans.__('Diff selected files')
550550
),
551551
execute: async args => {
552-
const { files } = (args as any) as CommandArguments.IGitFileDiff;
552+
const { files } = args as any as CommandArguments.IGitFileDiff;
553553
for (const file of files) {
554554
const { context, filePath, isText, status } = file;
555555

@@ -656,7 +656,7 @@ export function addCommands(
656656
trans.__('Stage or track the changes of selected files')
657657
),
658658
execute: async args => {
659-
const { files } = (args as any) as CommandArguments.IGitContextAction;
659+
const { files } = args as any as CommandArguments.IGitContextAction;
660660
for (const file of files) {
661661
await gitModel.add(file.to);
662662
}
@@ -671,7 +671,7 @@ export function addCommands(
671671
trans.__('Stage the changes of selected files')
672672
),
673673
execute: async args => {
674-
const { files } = (args as any) as CommandArguments.IGitContextAction;
674+
const { files } = args as any as CommandArguments.IGitContextAction;
675675
for (const file of files) {
676676
await gitModel.add(file.to);
677677
}
@@ -686,7 +686,7 @@ export function addCommands(
686686
trans.__('Start tracking selected files')
687687
),
688688
execute: async args => {
689-
const { files } = (args as any) as CommandArguments.IGitContextAction;
689+
const { files } = args as any as CommandArguments.IGitContextAction;
690690
for (const file of files) {
691691
await gitModel.add(file.to);
692692
}
@@ -701,7 +701,7 @@ export function addCommands(
701701
trans.__('Unstage the changes of selected files')
702702
),
703703
execute: async args => {
704-
const { files } = (args as any) as CommandArguments.IGitContextAction;
704+
const { files } = args as any as CommandArguments.IGitContextAction;
705705
for (const file of files) {
706706
if (file.x !== 'D') {
707707
await gitModel.reset(file.to);
@@ -727,7 +727,7 @@ export function addCommands(
727727
trans.__('Delete these files')
728728
),
729729
execute: async args => {
730-
const { files } = (args as any) as CommandArguments.IGitContextAction;
730+
const { files } = args as any as CommandArguments.IGitContextAction;
731731
const fileList = representFiles(files);
732732

733733
const result = await showDialog({
@@ -770,7 +770,7 @@ export function addCommands(
770770
trans.__('Discard recent changes of selected files')
771771
),
772772
execute: async args => {
773-
const { files } = (args as any) as CommandArguments.IGitContextAction;
773+
const { files } = args as any as CommandArguments.IGitContextAction;
774774
const fileList = representFiles(files);
775775

776776
const result = await showDialog({
@@ -828,7 +828,7 @@ export function addCommands(
828828
trans.__('Ignore these files (add to .gitignore)')
829829
),
830830
execute: async args => {
831-
const { files } = (args as any) as CommandArguments.IGitContextAction;
831+
const { files } = args as any as CommandArguments.IGitContextAction;
832832
for (const file of files) {
833833
if (file) {
834834
await gitModel.ignore(file.to, false);
@@ -839,7 +839,7 @@ export function addCommands(
839839

840840
commands.addCommand(ContextCommandIDs.gitIgnoreExtension, {
841841
label: args => {
842-
const { files } = (args as any) as CommandArguments.IGitContextAction;
842+
const { files } = args as any as CommandArguments.IGitContextAction;
843843
const extensions = files
844844
.map(file => PathExt.extname(file.to))
845845
.filter(extension => extension.length > 0);
@@ -855,7 +855,7 @@ export function addCommands(
855855
trans.__('Ignore these files extension (add to .gitignore)')
856856
),
857857
execute: async args => {
858-
const { files } = (args as any) as CommandArguments.IGitContextAction;
858+
const { files } = args as any as CommandArguments.IGitContextAction;
859859
for (const selectedFile of files) {
860860
if (selectedFile) {
861861
const extension = PathExt.extname(selectedFile.to);
@@ -879,7 +879,7 @@ export function addCommands(
879879
}
880880
},
881881
isVisible: args => {
882-
const { files } = (args as any) as CommandArguments.IGitContextAction;
882+
const { files } = args as any as CommandArguments.IGitContextAction;
883883
return files.some(selectedFile => {
884884
const extension = PathExt.extname(selectedFile.to);
885885
return extension.length > 0;
@@ -967,22 +967,22 @@ export function addMenuItems(
967967
if (command === ContextCommandIDs.gitFileDiff) {
968968
contextMenu.addItem({
969969
command,
970-
args: ({
970+
args: {
971971
files: selectedFiles.map(file => {
972972
return {
973973
filePath: file.to,
974974
isText: !file.is_binary,
975975
status: file.status
976976
};
977977
})
978-
} as CommandArguments.IGitFileDiff) as any
978+
} as CommandArguments.IGitFileDiff as any
979979
});
980980
} else {
981981
contextMenu.addItem({
982982
command,
983-
args: ({
983+
args: {
984984
files: selectedFiles
985-
} as CommandArguments.IGitContextAction) as any
985+
} as CommandArguments.IGitContextAction as any
986986
});
987987
}
988988
});
@@ -1148,7 +1148,7 @@ namespace Private {
11481148
switch (operation) {
11491149
case Operation.Clone:
11501150
// eslint-disable-next-line no-case-declarations
1151-
const { path, url } = (args as any) as IGitCloneArgs;
1151+
const { path, url } = args as any as IGitCloneArgs;
11521152
result = await model.clone(path, url, authentication);
11531153
break;
11541154
case Operation.Pull:

src/components/FileList.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
227227

228228
/** Discard changes in a specific unstaged or staged file */
229229
discardChanges = async (file: Git.IStatusFile): Promise<void> => {
230-
await this.props.commands.execute(ContextCommandIDs.gitFileDiscard, ({
230+
await this.props.commands.execute(ContextCommandIDs.gitFileDiscard, {
231231
files: [file]
232-
} as CommandArguments.IGitContextAction) as any);
232+
} as CommandArguments.IGitContextAction as any);
233233
};
234234

235235
/** Add all untracked files */
@@ -347,9 +347,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
347347
const { data, index, style } = rowProps;
348348
const file = data[index] as Git.IStatusFile;
349349
const openFile = () => {
350-
this.props.commands.execute(ContextCommandIDs.gitFileOpen, ({
350+
this.props.commands.execute(ContextCommandIDs.gitFileOpen, {
351351
files: [file]
352-
} as CommandArguments.IGitContextAction) as any);
352+
} as CommandArguments.IGitContextAction as any);
353353
};
354354
const diffButton = this._createDiffButton(file);
355355
return (
@@ -434,9 +434,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
434434
const { data, index, style } = rowProps;
435435
const file = data[index] as Git.IStatusFile;
436436
const openFile = () => {
437-
this.props.commands.execute(ContextCommandIDs.gitFileOpen, ({
437+
this.props.commands.execute(ContextCommandIDs.gitFileOpen, {
438438
files: [file]
439-
} as CommandArguments.IGitContextAction) as any);
439+
} as CommandArguments.IGitContextAction as any);
440440
};
441441
const diffButton = this._createDiffButton(file);
442442
return (
@@ -548,9 +548,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
548548
icon={openIcon}
549549
title={this.props.trans.__('Open this file')}
550550
onClick={() => {
551-
this.props.commands.execute(ContextCommandIDs.gitFileOpen, ({
551+
this.props.commands.execute(ContextCommandIDs.gitFileOpen, {
552552
files: [file]
553-
} as CommandArguments.IGitContextAction) as any);
553+
} as CommandArguments.IGitContextAction as any);
554554
}}
555555
/>
556556
<ActionButton
@@ -568,9 +568,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
568568
model={this.props.model}
569569
onDoubleClick={() => {
570570
if (!doubleClickDiff) {
571-
this.props.commands.execute(ContextCommandIDs.gitFileOpen, ({
571+
this.props.commands.execute(ContextCommandIDs.gitFileOpen, {
572572
files: [file]
573-
} as CommandArguments.IGitContextAction) as any);
573+
} as CommandArguments.IGitContextAction as any);
574574
}
575575
}}
576576
selected={this._isSelectedFile(file)}
@@ -622,9 +622,9 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
622622
.composite as boolean;
623623

624624
const openFile = () => {
625-
this.props.commands.execute(ContextCommandIDs.gitFileOpen, ({
625+
this.props.commands.execute(ContextCommandIDs.gitFileOpen, {
626626
files: [file]
627-
} as CommandArguments.IGitContextAction) as any);
627+
} as CommandArguments.IGitContextAction as any);
628628
};
629629

630630
// Default value for actions and double click
@@ -761,15 +761,15 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
761761
*/
762762
private async _openDiffView(file: Git.IStatusFile): Promise<void> {
763763
try {
764-
await this.props.commands.execute(ContextCommandIDs.gitFileDiff, ({
764+
await this.props.commands.execute(ContextCommandIDs.gitFileDiff, {
765765
files: [
766766
{
767767
filePath: file.to,
768768
isText: !file.is_binary,
769769
status: file.status
770770
}
771771
]
772-
} as CommandArguments.IGitFileDiff) as any);
772+
} as CommandArguments.IGitFileDiff as any);
773773
} catch (reason) {
774774
console.error(`Failed to open diff view for ${file.to}.\n${reason}`);
775775
}

src/components/SinglePastCommitInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export class SinglePastCommitInfo extends React.Component<
350350
event.stopPropagation();
351351

352352
try {
353-
self.props.commands.execute(ContextCommandIDs.gitFileDiff, ({
353+
self.props.commands.execute(ContextCommandIDs.gitFileDiff, {
354354
files: [
355355
{
356356
filePath: fpath,
@@ -361,7 +361,7 @@ export class SinglePastCommitInfo extends React.Component<
361361
}
362362
}
363363
]
364-
} as CommandArguments.IGitFileDiff) as any);
364+
} as CommandArguments.IGitFileDiff as any);
365365
} catch (err) {
366366
console.error(`Failed to open diff view for ${fpath}.\n${err}`);
367367
}

src/widgets/AuthorBox.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { Git } from '../tokens';
77
*/
88
export class GitAuthorForm
99
extends Widget
10-
implements Dialog.IBodyWidget<Git.IIdentity> {
10+
implements Dialog.IBodyWidget<Git.IIdentity>
11+
{
1112
constructor() {
1213
super();
1314
this.node.appendChild(this.createBody());

src/widgets/CredentialsBox.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { Git } from '../tokens';
88
*/
99
export class GitCredentialsForm
1010
extends Widget
11-
implements Dialog.IBodyWidget<Git.IAuth> {
11+
implements Dialog.IBodyWidget<Git.IAuth>
12+
{
1213
constructor(
1314
trans: TranslationBundle,
1415
textContent = trans.__('Enter credentials for remote repository'),

0 commit comments

Comments
 (0)