Skip to content

Commit ebd1b12

Browse files
authored
Merge pull request #895 from meeseeksmachine/auto-backport-of-pr-892-on-jlab-2
Backport PR #892 on branch jlab-2 (Remove eslint warnings)
2 parents 0bad949 + 892def3 commit ebd1b12

15 files changed

+64
-46
lines changed

src/commandsAndMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function addCommands(
115115
fileBrowser: FileBrowser,
116116
settings: ISettingRegistry.ISettings,
117117
renderMime: IRenderMimeRegistry
118-
) {
118+
): void {
119119
const { commands, shell } = app;
120120

121121
/**

src/components/Feedback.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class Feedback extends React.Component<IFeedbackProps, IFeedbackState> {
8989
return state;
9090
}
9191

92-
render() {
92+
render(): JSX.Element {
9393
if (this.state.logStack.length > 1) {
9494
setTimeout(() => {
9595
if (this.state.logStack.length > 1) {

src/components/FileList.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
115115
openContextMenu = (
116116
selectedFile: Git.IStatusFile,
117117
event: React.MouseEvent
118-
) => {
118+
): void => {
119119
event.preventDefault();
120120

121121
this.setState({
@@ -138,7 +138,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
138138
openSimpleContextMenu = (
139139
selectedFile: Git.IStatusFile,
140140
event: React.MouseEvent
141-
) => {
141+
): void => {
142142
event.preventDefault();
143143

144144
const contextMenu = new Menu({ commands: this.props.commands });
@@ -148,25 +148,25 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
148148
};
149149

150150
/** Reset all staged files */
151-
resetAllStagedFiles = async (event: React.MouseEvent) => {
151+
resetAllStagedFiles = async (event: React.MouseEvent): Promise<void> => {
152152
event.stopPropagation();
153153
await this.props.model.reset();
154154
};
155155

156156
/** Reset a specific staged file */
157-
resetStagedFile = async (file: string) => {
157+
resetStagedFile = async (file: string): Promise<void> => {
158158
await this.props.model.reset(file);
159159
};
160160

161161
/** Add all unstaged files */
162-
addAllUnstagedFiles = async (event: React.MouseEvent) => {
162+
addAllUnstagedFiles = async (event: React.MouseEvent): Promise<void> => {
163163
event.stopPropagation();
164164

165165
await this.props.model.addAllUnstaged();
166166
};
167167

168168
/** Discard changes in all unstaged files */
169-
discardAllUnstagedFiles = async (event: React.MouseEvent) => {
169+
discardAllUnstagedFiles = async (event: React.MouseEvent): Promise<void> => {
170170
event.stopPropagation();
171171

172172
const result = await showDialog({
@@ -185,7 +185,7 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
185185
};
186186

187187
/** Discard changes in all unstaged and staged files */
188-
discardAllChanges = async (event: React.MouseEvent) => {
188+
discardAllChanges = async (event: React.MouseEvent): Promise<void> => {
189189
event.stopPropagation();
190190
const result = await showDialog({
191191
title: 'Discard all changes',
@@ -203,39 +203,39 @@ export class FileList extends React.Component<IFileListProps, IFileListState> {
203203
};
204204

205205
/** Add a specific unstaged file */
206-
addFile = async (...file: string[]) => {
206+
addFile = async (...file: string[]): Promise<void> => {
207207
await this.props.model.add(...file);
208208
};
209209

210210
/** Discard changes in a specific unstaged or staged file */
211-
discardChanges = async (file: Git.IStatusFile) => {
211+
discardChanges = async (file: Git.IStatusFile): Promise<void> => {
212212
await this.props.commands.execute(ContextCommandIDs.gitFileDiscard, ({
213213
files: [file]
214214
} as CommandArguments.IGitContextAction) as any);
215215
};
216216

217217
/** Add all untracked files */
218-
addAllUntrackedFiles = async (event: React.MouseEvent) => {
218+
addAllUntrackedFiles = async (event: React.MouseEvent): Promise<void> => {
219219
event.stopPropagation();
220220
await this.props.model.addAllUntracked();
221221
};
222222

223-
addAllMarkedFiles = async () => {
223+
addAllMarkedFiles = async (): Promise<void> => {
224224
await this.addFile(...this.markedFiles.map(file => file.to));
225225
};
226226

227-
updateSelectedFile = (file: Git.IStatusFile | null) => {
227+
updateSelectedFile = (file: Git.IStatusFile | null): void => {
228228
this.setState({ selectedFile: file });
229229
};
230230

231-
get markedFiles() {
231+
get markedFiles(): Git.IStatusFile[] {
232232
return this.props.files.filter(file => this.props.model.getMark(file.to));
233233
}
234234

235235
/**
236236
* Render the modified files
237237
*/
238-
render() {
238+
render(): JSX.Element {
239239
if (this.props.settings.composite['simpleStaging']) {
240240
return (
241241
<div className={fileListWrapperClass}>

src/components/GitPanel.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
162162
Signal.clearData(this);
163163
}
164164

165-
refreshBranch = async () => {
165+
refreshBranch = async (): Promise<void> => {
166166
const { currentBranch } = this.props.model;
167167

168168
this.setState({
@@ -171,7 +171,7 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
171171
});
172172
};
173173

174-
refreshHistory = async () => {
174+
refreshHistory = async (): Promise<void> => {
175175
if (this.props.model.pathRepository !== null) {
176176
// Get git log for current branch
177177
const logData = await this.props.model.log(
@@ -191,7 +191,7 @@ export class GitPanel extends React.Component<IGitPanelProps, IGitPanelState> {
191191
/**
192192
* Refresh widget, update all content
193193
*/
194-
refreshView = async () => {
194+
refreshView = async (): Promise<void> => {
195195
if (this.props.model.pathRepository !== null) {
196196
await this.refreshBranch();
197197
await this.refreshHistory();

src/components/TagMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class TagMenu extends React.Component<ITagMenuProps, ITagMenuState> {
134134
};
135135
}
136136

137-
componentDidMount() {
137+
componentDidMount(): void {
138138
this.props.model
139139
.tags()
140140
.then(response => {

src/components/diff/Diff.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface IDiffProps {
4343
* The parent diff component which maintains a registry of various diff providers.
4444
* Based on the extension of the file, it delegates to the relevant diff provider.
4545
*/
46-
export function Diff(props: IDiffProps) {
46+
export function Diff(props: IDiffProps): JSX.Element {
4747
const fileExtension = PathExt.extname(props.path).toLocaleLowerCase();
4848
if (fileExtension in DIFF_PROVIDER_REGISTRY) {
4949
const DiffProvider = DIFF_PROVIDER_REGISTRY[fileExtension];

src/components/diff/NBDiffHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface INBDiffHeaderProps {
1111
* being rendered. Shows the path to the file and the previous and current ref
1212
* being used for the diff.
1313
*/
14-
export function NBDiffHeader(props: INBDiffHeaderProps) {
14+
export function NBDiffHeader(props: INBDiffHeaderProps): JSX.Element {
1515
return (
1616
<div>
1717
<div className="jp-git-diff-header-path">{props.path}</div>

src/components/diff/NbDiff.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class CellDiff extends React.Component<ICellDiffProps> {
6565
}
6666
}
6767

68-
render() {
68+
render(): JSX.Element {
6969
const chunk = this.props.cellChunk;
7070
return (
7171
<RenderMimeConsumer>
@@ -119,11 +119,11 @@ export class NBDiff extends React.Component<IDiffProps, INBDiffState> {
119119
};
120120
}
121121

122-
componentDidMount() {
122+
componentDidMount(): void {
123123
this.performDiff(this.props.diffContext);
124124
}
125125

126-
render() {
126+
render(): JSX.Element {
127127
if (this.state.errorMessage !== undefined) {
128128
return (
129129
<div>

src/components/diff/PlainTextDiff.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ export class PlainTextDiff extends React.Component<
3131
this._mergeViewRef = React.createRef<HTMLDivElement>();
3232
}
3333

34-
componentDidMount() {
34+
componentDidMount(): void {
3535
this._performDiff(this.props.diffContext);
3636
}
3737

38-
render() {
38+
render(): JSX.Element {
3939
if (this.state.errorMessage !== null) {
4040
return (
4141
<div>

src/components/diff/mergeview.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,13 +1869,22 @@ namespace Private {
18691869
}
18701870
}
18711871

1872-
export function posMin(a: CodeMirror.Position, b: CodeMirror.Position) {
1872+
export function posMin(
1873+
a: CodeMirror.Position,
1874+
b: CodeMirror.Position
1875+
): CodeMirror.Position {
18731876
return (a.line - b.line || a.ch - b.ch) < 0 ? a : b;
18741877
}
1875-
export function posMax(a: CodeMirror.Position, b: CodeMirror.Position) {
1878+
export function posMax(
1879+
a: CodeMirror.Position,
1880+
b: CodeMirror.Position
1881+
): CodeMirror.Position {
18761882
return (a.line - b.line || a.ch - b.ch) > 0 ? a : b;
18771883
}
1878-
export function posEq(a: CodeMirror.Position, b: CodeMirror.Position) {
1884+
export function posEq(
1885+
a: CodeMirror.Position,
1886+
b: CodeMirror.Position
1887+
): boolean {
18791888
return a.line == b.line && a.ch == b.ch;
18801889
}
18811890

@@ -1907,7 +1916,12 @@ namespace Private {
19071916
}
19081917
}
19091918

1910-
export function goNearbyDiff(cm: CodeMirror.Editor, dir: number) {
1919+
export function goNearbyDiff(
1920+
cm: CodeMirror.Editor,
1921+
dir: number
1922+
): void | {
1923+
toString(): 'CodeMirror.PASS';
1924+
} {
19111925
let found = null;
19121926
const views = cm.state.diffViews;
19131927
// @ts-ignore

0 commit comments

Comments
 (0)