Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add eslint rule to find unused properties, data and computed properties #5347

Merged
merged 13 commits into from Apr 8, 2019
2 changes: 1 addition & 1 deletion kolibri/core/assets/src/views/ContentIcon.vue
Expand Up @@ -120,7 +120,7 @@
return validateContentNodeKind(value, [USER]);
},
},
colorstyle: {
colorStyle: {
type: String,
default: 'action',
},
Expand Down
12 changes: 0 additions & 12 deletions kolibri/core/assets/src/views/ContentRenderer/index.vue
Expand Up @@ -67,10 +67,6 @@
UiAlert,
},
props: {
id: {
type: String,
required: true,
},
kind: {
type: String,
required: true,
Expand All @@ -79,14 +75,6 @@
type: Array,
default: () => [],
},
contentId: {
type: String,
default: '',
},
channelId: {
type: String,
default: '',
},
available: {
type: Boolean,
default: false,
Expand Down
4 changes: 0 additions & 4 deletions kolibri/core/assets/src/views/ExamReport/PageStatus.vue
Expand Up @@ -43,7 +43,6 @@
import KGridItem from 'kolibri.coreVue.components.KGridItem';
import ProgressIcon from 'kolibri.coreVue.components.ProgressIcon';
import ElapsedTime from 'kolibri.coreVue.components.ElapsedTime';
import { ContentNodeKinds } from 'kolibri.coreVue.vuex.constants';
import KLabeledIcon from 'kolibri.coreVue.components.KLabeledIcon';
import KIcon from 'kolibri.coreVue.components.KIcon';

Expand Down Expand Up @@ -96,9 +95,6 @@
// Either return in completed or in progress
return this.completed ? 1 : 0.1;
},
kind() {
return ContentNodeKinds.EXAM;
},
},
};

Expand Down
8 changes: 0 additions & 8 deletions kolibri/core/assets/src/views/KSelect/KeenUiSelect.vue
Expand Up @@ -389,14 +389,6 @@
return this.options.findIndex(option => looseEqual(this.highlightedOption, option));
},

// Returns the index of the currently selected option, -1 if multi-select
selectedIndex() {
if (this.multiple) {
return -1;
}
return this.options.findIndex(option => looseEqual(this.value, option));
},

// Returns an array containing the options and extra annotations
annotatedOptions() {
const options = JSON.parse(JSON.stringify(this.options));
Expand Down
1 change: 0 additions & 1 deletion kolibri/core/assets/src/views/KTooltip/Popper.vue
Expand Up @@ -185,7 +185,6 @@
referenceElm: null,
popperJS: null,
showPopper: false,
currentPlacement: '',
popperOptions: {
placement: 'bottom',
computeStyle: {
Expand Down
9 changes: 0 additions & 9 deletions kolibri/core/assets/src/views/icons/KLabeledIcon.vue
Expand Up @@ -17,15 +17,6 @@
export default {
name: 'KLabeledIcon',
components: {},
props: {
/**
* Whether the label should wrap
*/
nowrap: {
type: Boolean,
default: false,
},
},
};

</script>
Expand Down
5 changes: 0 additions & 5 deletions kolibri/core/assets/test/views/KTooltipExample.vue
Expand Up @@ -32,11 +32,6 @@
required: false,
default: () => {},
},
kTooltipText: {
type: String,
required: false,
default: '',
},
},
};

Expand Down
Expand Up @@ -33,11 +33,6 @@
required: true,
},
},
data() {
return {
active: null,
};
},
computed: {
activeClasses() {
// return both fixed and dynamic classes
Expand Down
Expand Up @@ -104,7 +104,6 @@
data() {
return {
loading: true,
error: false,
moreResults: true,
nextPage: 1,
progressFilter: 'all',
Expand Down
Expand Up @@ -58,10 +58,6 @@
type: Object,
required: true,
},
isLast: {
type: Boolean,
default: false,
},
to: {
type: Object,
required: false,
Expand Down
Expand Up @@ -138,7 +138,7 @@
import KRouterLink from 'kolibri.coreVue.components.KRouterLink';
import KSelect from 'kolibri.coreVue.components.KSelect';
import CoreInfoIcon from 'kolibri.coreVue.components.CoreInfoIcon';
import { ContentNodeKinds, ERROR_CONSTANTS } from 'kolibri.coreVue.vuex.constants';
import { ERROR_CONSTANTS } from 'kolibri.coreVue.vuex.constants';
import { crossComponentTranslator } from 'kolibri.utils.i18n';
import CatchErrors from 'kolibri.utils.CatchErrors';
import KLabeledIcon from 'kolibri.coreVue.components.KLabeledIcon';
Expand Down Expand Up @@ -216,9 +216,6 @@
manageExamModalStrings() {
return manageExamModalStrings;
},
examKind() {
return ContentNodeKinds.EXAM;
},
sortedExams() {
return this.exams.slice().reverse();
},
Expand Down
Expand Up @@ -300,13 +300,6 @@
previewQuizStrings() {
return previewQuizStrings;
},
draggableOptions() {
return {
animation: 150,
touchStartThreshold: 3,
direction: 'vertical',
};
},
currentQuestion() {
return this.selectedQuestions[this.currentQuestionIndex] || {};
},
Expand Down
Expand Up @@ -166,9 +166,6 @@
usersNotInClass() {
return differenceWith(this.classUsers, this.currentGroupUsers, (a, b) => a.id === b.id);
},
filteredUsers() {
return this.usersNotInClass.filter(user => userMatchesFilter(user, this.filterInput));
},
sortedFilteredUsers() {
return filterAndSortUsers(this.usersNotInClass, user =>
userMatchesFilter(user, this.filterInput)
Expand All @@ -195,9 +192,6 @@
visibleFilteredUsers() {
return this.sortedFilteredUsers.slice(this.startRange, this.endRange);
},
showConfirmEnrollmentModal() {
return this.modalShown === true;
},
emptyMessage() {
if (this.classUsers.length === 0) {
return this.$tr('noUsersExist');
Expand Down
Expand Up @@ -55,11 +55,6 @@
default: '',
},
},
computed: {
hasHeader() {
return Boolean(this.header);
},
},
};

</script>
Expand Down
Expand Up @@ -60,13 +60,6 @@
validator: value => typeof value(0) === 'string',
},
},
computed: {
buttonAndHeaderBorder() {
return {
borderBottom: `2px solid ${this.$coreTextDisabled}`,
};
},
},
};

</script>
Expand Down
Expand Up @@ -109,11 +109,7 @@
import KSelect from 'kolibri.coreVue.components.KSelect';
import KLabeledIcon from 'kolibri.coreVue.components.KLabeledIcon';
import KIcon from 'kolibri.coreVue.components.KIcon';
import {
ContentNodeKinds,
CollectionKinds,
ERROR_CONSTANTS,
} from 'kolibri.coreVue.vuex.constants';
import { CollectionKinds, ERROR_CONSTANTS } from 'kolibri.coreVue.vuex.constants';
import CatchErrors from 'kolibri.utils.CatchErrors';
import { crossComponentTranslator } from 'kolibri.utils.i18n';
import LessonActive from '../../common/LessonActive';
Expand Down Expand Up @@ -148,7 +144,6 @@
data() {
return {
showModal: false,
lessonKind: ContentNodeKinds.LESSON,
filterSelection: {},
};
},
Expand Down
Expand Up @@ -79,6 +79,7 @@
group() {
return this.groupMap[this.$route.params.groupId];
},
/** TODO COACH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks unfinished?

recipients() {
return this.group.member_ids;
},
Expand All @@ -92,6 +93,7 @@
}
return this._.meanBy(statuses, 'score');
},
*/
},
$trs: {
back: 'All groups',
Expand Down
Expand Up @@ -73,9 +73,6 @@
},
mixins: [commonCoach],
computed: {
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
recipients() {
return this.getLearnersForGroups([this.$route.params.groupId]);
},
Expand Down
Expand Up @@ -93,6 +93,7 @@
components: {},
mixins: [commonCoach],
computed: {
/** TODO COACH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

actionOptions() {
return [
{ label: this.coachStrings.$tr('editDetailsAction'), value: 'ReportsLessonEditorPage' },
Expand All @@ -102,6 +103,7 @@
},
];
},
*/
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
Expand Down
Expand Up @@ -13,7 +13,7 @@
<p>
<BackLink
:to="classRoute('ReportsGroupReportLessonPage', {})"
:text="$tr('back', { lesson: 'Lesson 1' })"
:text="$tr('back', { lesson: lesson.title })"
/>
</p>
<h1>
Expand Down Expand Up @@ -98,9 +98,6 @@
recipients() {
return this.getLearnersForGroups([this.$route.params.groupId]);
},
avgTime() {
return this.getContentAvgTimeSpent(this.$route.params.resourceId, this.recipients);
},
tally() {
return this.getContentStatusTally(this.$route.params.resourceId, this.recipients);
},
Expand Down
Expand Up @@ -73,9 +73,6 @@
recipients() {
return this.getLearnersForGroups([this.$route.params.groupId]);
},
tally() {
return this.getExamStatusTally(this.exam.id, this.recipients);
},
},
$trs: {
back: 'All quizzes',
Expand Down
Expand Up @@ -33,16 +33,6 @@
LessonDetailEditor,
},
mixins: [commonCoach],
data() {
return {
lessonTitle: 'Lesson A',
lessonDescription: 'Ipsum lorem',
selectedCollectionIds: ['a'],
availableGroups: [{ name: 'Group A', id: 'a' }, { name: 'Group B', id: 'b' }],
selectedClassroomId: 'x',
isActive: true,
};
},
$trs: {},
};

Expand Down
Expand Up @@ -79,6 +79,7 @@
components: {},
mixins: [commonCoach],
computed: {
/** TODO COACH
actionOptions() {
return [
{ label: this.coachStrings.$tr('editDetailsAction'), value: 'ReportsLessonEditorPage' },
Expand All @@ -88,6 +89,7 @@
},
];
},
*/
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
Expand Down
Expand Up @@ -81,6 +81,7 @@
emptyMessage() {
return LessonSummaryPageStrings.$tr('noResourcesInLesson');
},
/** TODO COACH
actionOptions() {
return [
{ label: this.coachStrings.$tr('editDetailsAction'), value: 'ReportsLessonEditorPage' },
Expand All @@ -90,6 +91,7 @@
},
];
},
*/
lesson() {
return this.lessonMap[this.$route.params.lessonId];
},
Expand Down
Expand Up @@ -30,16 +30,6 @@
QuizDetailEditor,
},
mixins: [commonCoach],
data() {
return {
lessonTitle: 'Lesson A',
lessonDescription: 'Ipsum lorem',
selectedCollectionIds: ['a'],
availableGroups: [{ name: 'Group A', id: 'a' }, { name: 'Group B', id: 'b' }],
selectedClassroomId: 'x',
isActive: true,
};
},
$trs: {},
};

Expand Down
Expand Up @@ -80,12 +80,14 @@
avgScore() {
return this.getExamAvgScore(this.$route.params.quizId, this.recipients);
},
/** TODO COACH
actionOptions() {
return [
{ label: this.coachStrings.$tr('previewAction'), value: 'ReportsQuizPreviewPage' },
{ label: this.coachStrings.$tr('editDetailsAction'), value: 'ReportsQuizEditorPage' },
];
},
*/
exam() {
return this.examMap[this.$route.params.quizId];
},
Expand Down
Expand Up @@ -90,7 +90,6 @@
selectedAddressId: '',
showUiAlerts: false,
stage: '',
Stages,
};
},
computed: {
Expand Down