From 0d78eeb2a834d2f74efaaaebe4a80c3c38339e48 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 3 Aug 2017 12:15:54 +0100 Subject: [PATCH] [ci skip] Fix eslint errors --- .../notes/components/issue_comment_form.vue | 4 ++-- .../javascripts/notes/components/issue_discussion.vue | 2 +- .../javascripts/notes/components/issue_note.vue | 4 ++-- .../notes/components/issue_note_actions.vue | 2 +- .../notes/components/issue_note_awards_list.vue | 8 ++++---- .../javascripts/notes/components/issue_note_body.vue | 2 +- .../javascripts/notes/components/issue_note_form.vue | 5 ++++- .../notes/components/issue_note_header.vue | 3 +-- .../notes/components/issue_note_signed_out_widget.vue | 11 +++++------ .../javascripts/notes/components/issue_notes_app.vue | 9 ++++----- .../notes/components/issue_placeholder_note_spec.js | 11 ----------- 11 files changed, 25 insertions(+), 36 deletions(-) diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index 407954f3272..4bfea099023 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -37,7 +37,7 @@ 'getIssueData', ]), isLoggedIn() { - return this.getUserData === null ? false : true; + return this.getUserData !== null; }, commentButtonTitle() { return this.noteType === constants.COMMENT ? 'Comment' : 'Start discussion'; @@ -64,7 +64,7 @@ }, canSubmit() { return !this.note.length || this.isSubmitting; - } + }, }, methods: { ...mapActions([ diff --git a/app/assets/javascripts/notes/components/issue_discussion.vue b/app/assets/javascripts/notes/components/issue_discussion.vue index 4de4ab71464..d4754178933 100644 --- a/app/assets/javascripts/notes/components/issue_discussion.vue +++ b/app/assets/javascripts/notes/components/issue_discussion.vue @@ -50,7 +50,7 @@ }, newNotePath() { return this.getIssueData.create_note_path; - } + }, }, methods: { ...mapActions([ diff --git a/app/assets/javascripts/notes/components/issue_note.vue b/app/assets/javascripts/notes/components/issue_note.vue index 8b1f9dbca01..7a3d5c4e0c8 100644 --- a/app/assets/javascripts/notes/components/issue_note.vue +++ b/app/assets/javascripts/notes/components/issue_note.vue @@ -75,14 +75,14 @@ }); } }, - formUpdateHandler(note) { + formUpdateHandler(noteText) { const data = { endpoint: this.note.path, note: { full_data: true, target_type: 'issue', target_id: this.note.noteable_id, - note: { note: note }, + note: { note: noteText }, }, }; diff --git a/app/assets/javascripts/notes/components/issue_note_actions.vue b/app/assets/javascripts/notes/components/issue_note_actions.vue index 25eec8e45cd..f24abfb6a9d 100644 --- a/app/assets/javascripts/notes/components/issue_note_actions.vue +++ b/app/assets/javascripts/notes/components/issue_note_actions.vue @@ -74,7 +74,7 @@ }, currentUserId() { return this.getUserDataByProp('id'); - } + }, }, }; diff --git a/app/assets/javascripts/notes/components/issue_note_awards_list.vue b/app/assets/javascripts/notes/components/issue_note_awards_list.vue index 2dd27d65096..936be4523c8 100644 --- a/app/assets/javascripts/notes/components/issue_note_awards_list.vue +++ b/app/assets/javascripts/notes/components/issue_note_awards_list.vue @@ -52,10 +52,10 @@ // We need to do this otherwise we will render the same emoji over and over again. groupedAwards() { const awards = this.awards.reduce((acc, award) => { - if (acc.hasOwnProperty(award.name)) { + if (Object.prototype.hasOwnProperty.call(acc, award.name)) { acc[award.name].push(award); } else { - Object.assign(acc, {[award.name]: [award]}); + Object.assign(acc, { [award.name]: [award] }); } return acc; @@ -73,7 +73,7 @@ delete awards.thumbsdown; } - return Object.assign({}, orderedAwards, awards); + return Object.assign({}, orderedAwards, awards); }, isAuthoredByMe() { return this.noteAuthorId === window.gon.current_user_id; @@ -150,7 +150,7 @@ endpoint: this.toggleAwardPath, noteId: this.noteId, // 100 emoji is a number. Callback for v-for click sends it as a string - awardName: awardName === "100" ? 100: awardName, + awardName: awardName === '100' ? 100 : awardName, }; this.toggleAwardRequest(data) diff --git a/app/assets/javascripts/notes/components/issue_note_body.vue b/app/assets/javascripts/notes/components/issue_note_body.vue index a44ad1d822d..087403e51a1 100644 --- a/app/assets/javascripts/notes/components/issue_note_body.vue +++ b/app/assets/javascripts/notes/components/issue_note_body.vue @@ -48,7 +48,7 @@ }, formCancelHandler(shouldConfirm, isDirty) { this.$emit('cancelFormEdition', shouldConfirm, isDirty); - } + }, }, mounted() { this.renderGFM(); diff --git a/app/assets/javascripts/notes/components/issue_note_form.vue b/app/assets/javascripts/notes/components/issue_note_form.vue index 963d6ecbeb4..14d8742a4b9 100644 --- a/app/assets/javascripts/notes/components/issue_note_form.vue +++ b/app/assets/javascripts/notes/components/issue_note_form.vue @@ -72,7 +72,10 @@ }, editMyLastNote() { if (this.note === '') { - const lastNoteInDiscussion = this.getDiscussionLastNote(this.discussion, this.currentUserId); + const lastNoteInDiscussion = this.getDiscussionLastNote( + this.discussion, + this.currentUserId, + ); if (lastNoteInDiscussion) { eventHub.$emit('enterEditMode', { diff --git a/app/assets/javascripts/notes/components/issue_note_header.vue b/app/assets/javascripts/notes/components/issue_note_header.vue index 17f3fe3b000..a2a6b140013 100644 --- a/app/assets/javascripts/notes/components/issue_note_header.vue +++ b/app/assets/javascripts/notes/components/issue_note_header.vue @@ -1,7 +1,6 @@ diff --git a/app/assets/javascripts/notes/components/issue_notes_app.vue b/app/assets/javascripts/notes/components/issue_notes_app.vue index d3df0ec8c7f..14b7afe1287 100644 --- a/app/assets/javascripts/notes/components/issue_notes_app.vue +++ b/app/assets/javascripts/notes/components/issue_notes_app.vue @@ -27,7 +27,7 @@ userData: { type: Object, required: false, - default: {} + default: {}, }, }, store, @@ -89,7 +89,7 @@ this.checkLocationHash(); }); }) - .catch((error) => Flash('Something went wrong while fetching issue comments. Please try again.')); + .catch(() => Flash('Something went wrong while fetching issue comments. Please try again.')); }, initPolling() { this.setLastFetchedAt(this.getNotesDataByProp('lastFetchedAt')); @@ -99,8 +99,7 @@ bindEventHubListeners() { this.$el.parentElement.addEventListener('toggleAward', (event) => { const { awardName, noteId } = event.detail; - this.actionToggleAward({ awardName, noteId }) - + this.actionToggleAward({ awardName, noteId }); }); // JQuery is needed here because it is a custom event being dispatched with jQuery. @@ -121,7 +120,7 @@ created() { this.setNotesData(this.notesData); this.setIssueData(this.issueData); - this.setUserData(this.userData) + this.setUserData(this.userData); }, mounted() { this.fetchNotes(); diff --git a/spec/javascripts/notes/components/issue_placeholder_note_spec.js b/spec/javascripts/notes/components/issue_placeholder_note_spec.js index f4d8e01bfe6..64d4ed42dfa 100644 --- a/spec/javascripts/notes/components/issue_placeholder_note_spec.js +++ b/spec/javascripts/notes/components/issue_placeholder_note_spec.js @@ -1,16 +1,5 @@ -import Vue from 'vue'; -import placeholderNote from '~/notes/components/issue_placeholder_note.vue'; - describe('issue placeholder system note component', () => { - let mountComponent; beforeEach(() => { - const PlaceholderNote = Vue.extend(placeholderNote); - - mountComponent = props => new PlaceholderNote({ - propsData: { - note: props, - }, - }).$mount(); }); describe('user information', () => {