From 7c939eee41319a80f85edf4afaa99b5d3e5f50f1 Mon Sep 17 00:00:00 2001 From: Frederic COLLONVAL Date: Sat, 13 Mar 2021 18:03:43 +0100 Subject: [PATCH] Fix linter errors --- src/components/discussion/Discussion.ts | 18 +++++++++--------- src/tests/BrowserGroup.spec.tsx | 14 +++++++------- src/tests/Discussion.spec.ts | 20 ++++++++++---------- src/tests/PullRequestItem.spec.tsx | 4 ++-- yarn.lock | 18 +++++++++--------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/components/discussion/Discussion.ts b/src/components/discussion/Discussion.ts index df55372..94d4cce 100644 --- a/src/components/discussion/Discussion.ts +++ b/src/components/discussion/Discussion.ts @@ -63,7 +63,7 @@ export class Discussion extends Panel { : 'Leave a comment'; const node = generateNode('div', { - class: 'jp-PullRequestCommentItem', + class: 'jp-PullRequestCommentItem' }); const p = node .appendChild( @@ -71,7 +71,7 @@ export class Discussion extends Panel { ) .appendChild( generateNode('p', { - class: 'jp-PullRequestCommentItemContentTitle', + class: 'jp-PullRequestCommentItemContentTitle' }) ); p.innerHTML = msg; @@ -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' }) @@ -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 }) ); @@ -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 }; @@ -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) { @@ -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; @@ -239,12 +239,12 @@ export class Discussion extends Panel { { click: () => { this.inputShown = true; - }, + } } ) ); return new Widget({ - node, + node }); } diff --git a/src/tests/BrowserGroup.spec.tsx b/src/tests/BrowserGroup.spec.tsx index 7bb0fda..eda752c 100644 --- a/src/tests/BrowserGroup.spec.tsx +++ b/src/tests/BrowserGroup.spec.tsx @@ -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'; @@ -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 @@ -27,9 +27,9 @@ describe('BrowserGroup', () => { it('should have a header with text props.header', () => { const component = shallow(); expect(component.find('header h2')).toHaveLength(1); - expect(component.contains([

{DEFAULT_PROPS.group.name}

])).toEqual( - true - ); + expect( + component.contains([

{DEFAULT_PROPS.group.name}

]) + ).toEqual(true); }); it('should load group', () => { @@ -54,7 +54,7 @@ describe('BrowserGroup', () => { group={{ name: 'error', pullRequests: [], - error: 'There is an error', + error: 'There is an error' }} /> ); @@ -70,7 +70,7 @@ describe('BrowserGroup', () => { group={{ name: 'error', pullRequests: [], - error, + error }} /> ); diff --git a/src/tests/Discussion.spec.ts b/src/tests/Discussion.spec.ts index 9eb4cba..da58e42 100644 --- a/src/tests/Discussion.spec.ts +++ b/src/tests/Discussion.spec.ts @@ -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'; @@ -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(() => { @@ -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); @@ -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); @@ -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); @@ -134,14 +134,14 @@ describe('Discussion', () => { [[(sampleComment as any).default], false], [[], false], [[(sampleComment as any).default], true], - [[], true], + [[], true] ] as Array<[Array, 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; @@ -163,13 +163,13 @@ describe('Discussion', () => { }); describe('#inputShown', () => { - ([false, true] as Array).forEach((singleton) => { + ([false, true] as Array).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; diff --git a/src/tests/PullRequestItem.spec.tsx b/src/tests/PullRequestItem.spec.tsx index b5f997a..aed73bf 100644 --- a/src/tests/PullRequestItem.spec.tsx +++ b/src/tests/PullRequestItem.spec.tsx @@ -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'; @@ -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 diff --git a/yarn.lock b/yarn.lock index be97427..4449355 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" "*" @@ -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"