Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Mar 13, 2021
1 parent ca03e8c commit 7c939ee
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions src/components/discussion/Discussion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ export class Discussion extends Panel {
: 'Leave a comment';

const node = generateNode('div', {
class: 'jp-PullRequestCommentItem',
class: 'jp-PullRequestCommentItem'
});
const p = node
.appendChild(
generateNode('div', { class: 'jp-PullRequestCommentItemContent' })
)
.appendChild(
generateNode('p', {
class: 'jp-PullRequestCommentItemContentTitle',
class: 'jp-PullRequestCommentItemContentTitle'
})
);
p.innerHTML = msg;
Expand Down Expand Up @@ -107,7 +107,7 @@ export class Discussion extends Panel {
*/
protected initNode(): void {
const expandButton = generateNode('button', {
class: 'jp-PullRequestExpandButton',
class: 'jp-PullRequestExpandButton'
}) as HTMLButtonElement;
expandButton.appendChild(
caretUpIcon.element({ tag: 'span', title: 'Collapse Discussion' })
Expand Down Expand Up @@ -135,7 +135,7 @@ export class Discussion extends Panel {
* Add the thread view in the widget
*/
protected addThreadView(): void {
this._thread.comments.forEach((comment) => {
this._thread.comments.forEach(comment => {
this.addWidget(
new CommentWidget({ comment, renderMime: this._renderMime })
);
Expand All @@ -160,7 +160,7 @@ export class Discussion extends Panel {
body = {
...body,
line: this._thread.line,
originalLine: this._thread.originalLine,
originalLine: this._thread.originalLine
};
} else {
body = { ...body, discussionId: this._thread.id };
Expand All @@ -180,7 +180,7 @@ export class Discussion extends Panel {
text: response.text,
updatedAt: response.updateAt,
userName: response.userName,
userPicture: response.userPicture,
userPicture: response.userPicture
};
// Update discussion reference
if (response.inReplyTo) {
Expand Down Expand Up @@ -219,7 +219,7 @@ export class Discussion extends Panel {
private createCommentInput(): InputComment {
const widget = new InputComment({
handleSubmit: this.handleAddComment.bind(this),
handleCancel: this.handleCancelComment.bind(this),
handleCancel: this.handleCancelComment.bind(this)
});
widget.addClass('jp-PullRequestCommentItem');
return widget;
Expand All @@ -239,12 +239,12 @@ export class Discussion extends Panel {
{
click: () => {
this.inputShown = true;
},
}
}
)
);
return new Widget({
node,
node
});
}

Expand Down
14 changes: 7 additions & 7 deletions src/tests/BrowserGroup.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'jest';
import * as React from 'react';
import {
BrowserGroup,
IBrowserGroupProps,
IBrowserGroupProps
} from '../components/browser/BrowserGroup';
import { PullRequestItem } from '../components/browser/PullRequestItem';
import * as samplePRs from './sample-responses/samplepr.json';
Expand All @@ -13,7 +13,7 @@ describe('BrowserGroup', () => {
const DEFAULT_PROPS: IBrowserGroupProps = {
commands: {} as any,
docRegistry: {} as any,
group: { name: 'group1', pullRequests: (samplePRs as any).default },
group: { name: 'group1', pullRequests: (samplePRs as any).default }
};

// Test render
Expand All @@ -27,9 +27,9 @@ describe('BrowserGroup', () => {
it('should have a header with text props.header', () => {
const component = shallow(<BrowserGroup {...DEFAULT_PROPS} />);
expect(component.find('header h2')).toHaveLength(1);
expect(component.contains([<h2>{DEFAULT_PROPS.group.name}</h2>])).toEqual(
true
);
expect(
component.contains([<h2 key={1}>{DEFAULT_PROPS.group.name}</h2>])
).toEqual(true);
});

it('should load group', () => {
Expand All @@ -54,7 +54,7 @@ describe('BrowserGroup', () => {
group={{
name: 'error',
pullRequests: [],
error: 'There is an error',
error: 'There is an error'
}}
/>
);
Expand All @@ -70,7 +70,7 @@ describe('BrowserGroup', () => {
group={{
name: 'error',
pullRequests: [],
error,
error
}}
/>
);
Expand Down
20 changes: 10 additions & 10 deletions src/tests/Discussion.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CommentWidget } from '../components/discussion/Comment';
import { InputComment } from '../components/discussion/InputComment';
import {
Discussion,
IDiscussionProps,
IDiscussionProps
} from '../components/discussion/Discussion';
import { IComment, IThread } from '../tokens';
import * as sampleComment from './sample-responses/samplecomment.json';
Expand All @@ -19,13 +19,13 @@ describe('Discussion', () => {
id: 22,
line: 4,
originalLine: 2,
pullRequestId: 'pullrequest-id',
pullRequestId: 'pullrequest-id'
};

const DEFAULT_PROPS: IDiscussionProps = {
renderMime: {} as any,
thread: DEFAULT_THREAD,
handleRemove: () => {},
handleRemove: () => void 0
};

beforeEach(() => {
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('Discussion', () => {
it('should construct a new discussion', () => {
const discussion = new Discussion({
...DEFAULT_PROPS,
thread: { ...DEFAULT_THREAD, comments: [] },
thread: { ...DEFAULT_THREAD, comments: [] }
});
expect(discussion).toBeInstanceOf(Discussion);

Expand All @@ -87,7 +87,7 @@ describe('Discussion', () => {
it('should construct a single comment', () => {
const discussion = new Discussion({
...DEFAULT_PROPS,
thread: { ...DEFAULT_THREAD, singleton: true },
thread: { ...DEFAULT_THREAD, singleton: true }
});
expect(discussion).toBeInstanceOf(Discussion);

Expand All @@ -109,7 +109,7 @@ describe('Discussion', () => {
it('should construct a new single comment', () => {
const discussion = new Discussion({
...DEFAULT_PROPS,
thread: { ...DEFAULT_THREAD, comments: [], singleton: true },
thread: { ...DEFAULT_THREAD, comments: [], singleton: true }
});
expect(discussion).toBeInstanceOf(Discussion);

Expand All @@ -134,14 +134,14 @@ describe('Discussion', () => {
[[(sampleComment as any).default], false],
[[], false],
[[(sampleComment as any).default], true],
[[], true],
[[], true]
] as Array<[Array<IComment>, boolean]>).forEach(([comments, singleton]) => {
it(`should hide comments widget if not expanded with ${
comments.length
} comments and ${singleton ? '' : 'not '}singleton`, () => {
const discussion = new Discussion({
...DEFAULT_PROPS,
thread: { ...DEFAULT_THREAD, comments, singleton },
thread: { ...DEFAULT_THREAD, comments, singleton }
});
jest.clearAllMocks();
discussion.isExpanded = false;
Expand All @@ -163,13 +163,13 @@ describe('Discussion', () => {
});

describe('#inputShown', () => {
([false, true] as Array<boolean>).forEach((singleton) => {
([false, true] as Array<boolean>).forEach(singleton => {
it(`should show input comment widget with ${
singleton ? '' : 'not '
}singleton`, () => {
const discussion = new Discussion({
...DEFAULT_PROPS,
thread: { ...DEFAULT_THREAD, singleton },
thread: { ...DEFAULT_THREAD, singleton }
});
jest.clearAllMocks();
discussion.inputShown = true;
Expand Down
4 changes: 2 additions & 2 deletions src/tests/PullRequestItem.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import { BeatLoader } from 'react-spinners';
import {
IPullRequestItemProps,
PullRequestItem,
PullRequestItem
} from '../components/browser/PullRequestItem';
import * as samplePRs from './sample-responses/samplepr.json';
import * as sampleFiles from './sample-responses/samplefile.json';
Expand All @@ -14,7 +14,7 @@ describe('PullRequestItem', () => {
const DEFAULT_PROPS: IPullRequestItemProps = {
commands: {} as any,
docRegistry: {} as any,
pullRequest: (samplePRs as any).default[0],
pullRequest: (samplePRs as any).default[0]
};

// Cache original functionality
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1893,16 +1893,16 @@
"@babel/types" "^7.0.0"

"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6":
version "7.11.0"
resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.11.0.tgz#b9a1efa635201ba9bc850323a8793ee2d36c04a0"
integrity sha512-kSjgDMZONiIfSH1Nxcr5JIRMwUetDki63FSQfpTCz8ogF3Ulqm8+mr5f78dUYs6vMiB6gBusQqfQmBvHZj/lwg==
version "7.11.1"
resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.11.1.tgz#654f6c4f67568e24c23b367e947098c6206fa639"
integrity sha512-Vs0hm0vPahPMYi9tDjtP66llufgO3ST16WXaSTtDGEl9cewAl3AibmxWw6TINOqHPT9z0uABKAYjT9jNSg4npw==
dependencies:
"@babel/types" "^7.3.0"

"@types/cheerio@*":
version "0.22.26"
resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.26.tgz#190127a564d723e17f414d358e2453a5dced0300"
integrity sha512-ckxG5bCHk803zCbeq3GO4wbFan8AyVP8BuYynR0E0d/CD0N8I92kXyvikDWsbG14onoKTXR6B+sboxwjnTMSRg==
version "0.22.27"
resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.27.tgz#3a44d9b06fa40ca43599380cd0f3e2a1ceb98a57"
integrity sha512-UpmYZewEWNEE6Ya24RzAQ2X2OYwz32AaLyzYinpM8qqFGRyYufqKSvxPjjZkvS+h16bajfXl7VojrAxWzG/+mA==
dependencies:
"@types/node" "*"

Expand Down Expand Up @@ -7589,9 +7589,9 @@ yallist@^4.0.0:
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

yaml@^1.7.2:
version "1.10.0"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"
integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==
version "1.10.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.1.tgz#bb13d805ed104fba38f533570f3441027eeeca22"
integrity sha512-z/asvd+V08l1ywhaemZVirCwjdzLo6O1/0j2JbYCsGjiezupNQqjs5IIPyNtctbHjPEckqzVGd4jvpU5Lr25vQ==

yargs-parser@18.x, yargs-parser@^18.1.2:
version "18.1.3"
Expand Down

0 comments on commit 7c939ee

Please sign in to comment.