Skip to content

Commit b8b2916

Browse files
Enable eslint rule 'eqeqeq' in nuxt-client package (#3951)
* enable eslint rule * fix more comparisons * change role to smart for better null checks
1 parent 1b7dc87 commit b8b2916

File tree

16 files changed

+47
-47
lines changed

16 files changed

+47
-47
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export default defineConfigWithVueTs([
105105
"no-prototype-builtins": "error",
106106
"no-undef": "warn",
107107
"no-unused-vars": "off",
108+
"eqeqeq": ["error", "smart"],
108109
"@typescript-eslint/no-unused-vars": "off",
109110
"unused-imports/no-unused-imports": "warn",
110111
"unused-imports/no-unused-vars": [

src/components/molecules/vCustomDoublePanels.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export default {
7575
type: Number,
7676
default: 0,
7777
required: false,
78-
validator: (val) => val == 0 || val == 1,
78+
validator: (val) => val === 0 || val === 1,
7979
},
8080
},
8181
data: function () {

src/components/molecules/vRoomGroupAvatar.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ export default {
9191
},
9292
computed: {
9393
hasNotifications() {
94-
return this.data.groupElements.some((item) => item.notification == true);
94+
return this.data.groupElements.some((item) => item.notification === true);
9595
},
9696
itemSpecs() {
9797
return {
98-
columnCount: this.device == "large" || this.device == "desktop" ? 3 : 4,
99-
maxItem: this.device == "large" || this.device == "desktop" ? 16 : 9,
98+
columnCount: this.device === "large" || this.device === "desktop" ? 3 : 4,
99+
maxItem: this.device === "large" || this.device === "desktop" ? 16 : 9,
100100
};
101101
},
102102
},

src/components/organisms/DataFilter/DataFilter.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ const {
8181
} = useDataTableFilter(userType.value);
8282
8383
const modalTitle = computed(
84-
() => defaultFilterMenuItems.find((item: SelectOptionsType) => item.value == selectedFilterType.value)?.label
84+
() => defaultFilterMenuItems.find((item: SelectOptionsType) => item.value === selectedFilterType.value)?.label
8585
);
8686
8787
const selectionProps = computed(() =>
88-
selectedFilterType.value == FilterOption.CLASSES ? props.classNames : registrationOptions[userType.value as User]
88+
selectedFilterType.value === FilterOption.CLASSES ? props.classNames : registrationOptions[userType.value as User]
8989
);
9090
9191
const filteredValues = computed(() => {

src/components/organisms/DataFilter/composables/filter.composable.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ export const useDataTableFilter = (userType: string) => {
7979

8080
const isDateFiltering = computed(
8181
() =>
82-
selectedFilterType.value == FilterOption.CREATION_DATE ||
83-
selectedFilterType.value == FilterOption.LAST_MIGRATION_ON ||
84-
selectedFilterType.value == FilterOption.OBSOLOTE_SINCE
82+
selectedFilterType.value === FilterOption.CREATION_DATE ||
83+
selectedFilterType.value === FilterOption.LAST_MIGRATION_ON ||
84+
selectedFilterType.value === FilterOption.OBSOLOTE_SINCE
8585
);
8686

8787
const isSelectFiltering = computed(
88-
() => selectedFilterType.value == FilterOption.CLASSES || selectedFilterType.value == FilterOption.REGISTRATION
88+
() => selectedFilterType.value === FilterOption.CLASSES || selectedFilterType.value === FilterOption.REGISTRATION
8989
);
9090

9191
const filterMenuItems = ref<SelectOptionsType[]>([]);
@@ -128,7 +128,7 @@ export const useDataTableFilter = (userType: string) => {
128128
};
129129

130130
const prepareChipTitles = (chipItem: FilterItem) => {
131-
if (chipItem[0] == FilterOption.REGISTRATION) {
131+
if (chipItem[0] === FilterOption.REGISTRATION) {
132132
const statusKeyMap = {
133133
[Registration.COMPLETE]: t("pages.administration.students.legend.icon.success"),
134134
[Registration.MISSING]: t("utils.adminFilter.consent.label.missing"),
@@ -139,19 +139,20 @@ export const useDataTableFilter = (userType: string) => {
139139
return status.join(` ${t("common.words.and")} `);
140140
}
141141

142-
if (chipItem[0] == FilterOption.CLASSES) return `${t("utils.adminFilter.class.title")} = ${chipItem[1].join(", ")}`;
142+
if (chipItem[0] === FilterOption.CLASSES)
143+
return `${t("utils.adminFilter.class.title")} = ${chipItem[1].join(", ")}`;
143144

144-
if (chipItem[0] == FilterOption.CREATION_DATE)
145+
if (chipItem[0] === FilterOption.CREATION_DATE)
145146
return `${t("utils.adminFilter.date.created")} ${printDate(
146147
chipItem[1].$gte
147148
)} ${t("common.words.and")} ${printDate(chipItem[1].$lte)}`;
148149

149-
if (chipItem[0] == FilterOption.LAST_MIGRATION_ON)
150+
if (chipItem[0] === FilterOption.LAST_MIGRATION_ON)
150151
return `${t("utils.adminFilter.lastMigration.title")} ${printDate(
151152
chipItem[1].$gte
152153
)} ${t("common.words.and")} ${printDate(chipItem[1].$lte)}`;
153154

154-
if (chipItem[0] == FilterOption.OBSOLOTE_SINCE)
155+
if (chipItem[0] === FilterOption.OBSOLOTE_SINCE)
155156
return `${t("utils.adminFilter.outdatedSince.title")} ${printDate(
156157
chipItem[1].$gte
157158
)} ${t("common.words.and")} ${printDate(chipItem[1].$lte)}`;

src/components/organisms/DataFilter/composables/filter.composable.unit.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ describe("filter composable", () => {
7777
const { registrationOptions } = setup("student");
7878
const { student, teacher } = registrationOptions;
7979

80-
expect(1 == 1).toEqual(true);
81-
8280
expect(student.length).toEqual(3);
8381
expect(teacher.length).toEqual(2);
8482

@@ -133,7 +131,7 @@ describe("filter composable", () => {
133131

134132
expect(filterMenuItems.value.length).toEqual(4);
135133

136-
const found = filterMenuItems.value.find((item) => item.value == FilterOption.CLASSES);
134+
const found = filterMenuItems.value.find((item) => item.value === FilterOption.CLASSES);
137135
expect(found).toBeUndefined();
138136
});
139137
});

src/components/organisms/DataFilter/composables/localStorage.composable.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ export const useFilterLocalStorage = () => {
3636
const state = useStorage("uiState", defaultState);
3737

3838
const getFilterStorage = () =>
39-
userType.value == User.STUDENT
39+
userType.value === User.STUDENT
4040
? state.value.filter["pages.administration.students.index"]?.query
4141
: state.value.filter["pages.administration.teachers.index"]?.query;
4242

4343
const setFilterState = (val: object) => {
44-
if (userType.value == User.STUDENT)
44+
if (userType.value === User.STUDENT)
4545
state.value.filter["pages.administration.students.index"] = {
4646
query: val,
4747
};
48-
if (userType.value == User.TEACHER)
48+
if (userType.value === User.TEACHER)
4949
state.value.filter["pages.administration.teachers.index"] = {
5050
query: val,
5151
};

src/components/organisms/vCustomDialog.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const closeDialog = () => {
116116
emit("dialog-closed");
117117
};
118118
119-
const checkButtons = (buttonName: string) => props.buttons.some((button) => button == buttonName);
119+
const checkButtons = (buttonName: string) => props.buttons.some((button) => button === buttonName);
120120
</script>
121121

122122
<style lang="scss" scoped>

src/modules/data/board/ariaNotification/ariaLiveNotificationHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export const useBoardAriaNotification = () => {
132132
const { isOwnAction } = action;
133133
if (isOwnAction) return;
134134

135-
if (addedIndex == undefined || removedIndex == undefined) return;
135+
if (typeof addedIndex !== "number" || typeof removedIndex !== "number") return;
136136

137137
notifyOnScreenReader(
138138
t(SR_I18N_KEYS_MAP.COLUMN_MOVED_SUCCESS, {
@@ -235,7 +235,7 @@ export const useBoardAriaNotification = () => {
235235
if (isOwnAction) return;
236236

237237
const cardId = getElementOwner(elementId);
238-
if (cardId == undefined) return;
238+
if (cardId === undefined) return;
239239

240240
const { columnIndex, cardIndex } = boardStore.getCardLocation(cardId) as {
241241
columnIndex: number;

src/modules/data/folder/Folder.state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const useFolderState = () => {
3838
const breadcrumbs = computed<Breadcrumb[]>(() => {
3939
const breadcrumbItems: Breadcrumb[] = [];
4040

41-
if (!parentNodeInfos.value || parentNodeInfos.value.length == 0) return breadcrumbItems;
41+
if (parentNodeInfos.value?.length === 0) return breadcrumbItems;
4242

4343
const rootItem = buildRootBreadCrumbItem(parentNodeInfos);
4444
if (rootItem) breadcrumbItems.push(rootItem);

0 commit comments

Comments
 (0)