Skip to content

Commit

Permalink
Merge pull request #5347 from MisRob/eslint-rule-no-unused-properties
Browse files Browse the repository at this point in the history
Add eslint rule to find unused properties, data and computed properties
  • Loading branch information
indirectlylit committed Apr 8, 2019
2 parents ac12a46 + ac3cb9f commit c3af46e
Show file tree
Hide file tree
Showing 54 changed files with 864 additions and 239 deletions.
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
2 changes: 0 additions & 2 deletions kolibri/core/assets/src/views/ExamReport/index.vue
Expand Up @@ -38,12 +38,10 @@
/>
<ContentRenderer
v-if="exercise"
:id="exercise.id"
:itemId="itemId"
:allowHints="false"
:kind="exercise.kind"
:files="exercise.files"
:contentId="exercise.content_id"
:available="exercise.available"
:extraFields="exercise.extra_fields"
:interactive="false"
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
1 change: 0 additions & 1 deletion kolibri/core/assets/test/content-renderer.spec.js
Expand Up @@ -23,7 +23,6 @@ describe('ContentRenderer Component', () => {

function defaultPropsDataFromFiles(files = defaultFiles) {
return {
id: 'testing',
kind: 'test',
files,
};
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 @@ -58,13 +58,11 @@
/>
<ContentRenderer
v-if="currentInteraction"
:id="exercise.id"
:itemId="currentAttemptLog.item"
:assessment="true"
:allowHints="false"
:kind="exercise.kind"
:files="exercise.files"
:contentId="exercise.content_id"
:available="exercise.available"
:answerState="answerState"
:showCorrectAnswer="showCorrectAnswer"
Expand Down
Expand Up @@ -37,13 +37,11 @@
/>
<ContentRenderer
v-if="currentInteraction"
:id="exercise.id"
:itemId="currentLearner.item"
:assessment="true"
:allowHints="false"
:kind="exercise.kind"
:files="exercise.files"
:contentId="exercise.content_id"
:available="exercise.available"
:answerState="answerState"
:showCorrectAnswer="showCorrectAnswer"
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 @@ -52,11 +52,9 @@
>
<ContentRenderer
v-if="content && itemId"
:id="content.id"
ref="contentRenderer"
:kind="content.kind"
:files="content.files"
:contentId="content.content_id"
:available="content.available"
:extraFields="content.extra_fields"
:itemId="itemId"
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 @@ -158,11 +158,9 @@
</h3>
<ContentRenderer
v-if="content && questionId"
:id="content.id"
ref="contentRenderer"
:kind="content.kind"
:files="content.files"
:contentId="content.content_id"
:available="content.available"
:extraFields="content.extra_fields"
:itemId="questionId"
Expand Down Expand Up @@ -300,13 +298,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 @@ -5,15 +5,12 @@
{{ header }}
</h2>
<ContentRenderer
:id="content.id"
:class="{ hof: isExercise}"
:showCorrectAnswer="true"
:itemId="selectedQuestion"
:allowHints="false"
:kind="content.kind"
:files="content.files"
:contentId="content.content_id"
:channelId="content.channel_id"
:available="content.available"
:extraFields="content.extra_fields"
:interactive="false"
Expand Down Expand Up @@ -55,11 +52,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 @@ -30,14 +30,11 @@
/>
<ContentRenderer
v-if="currentInteraction"
:id="exercise.id"
:itemId="currentAttemptLog.item"
:assessment="true"
:allowHints="false"
:kind="exercise.kind"
:files="exercise.files"
:contentId="exercise.content_id"
:channelId="channelId"
:available="exercise.available"
:answerState="answerState"
:showCorrectAnswer="showCorrectAnswer"
Expand Down
Expand Up @@ -79,6 +79,7 @@
group() {
return this.groupMap[this.$route.params.groupId];
},
/** TODO COACH
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
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

0 comments on commit c3af46e

Please sign in to comment.