From 99a7b9024756b2cdf61693ba5564b9c4dcaab6bf Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Fri, 26 Apr 2024 13:15:30 +0200 Subject: [PATCH] Fix linting issues --- test/api/unit/libs/content.test.js | 4 ++- test/content/schedule.test.js | 34 +++++++++++++------ .../admin-panel/user-support/userProfile.vue | 18 +++++----- website/client/src/components/appFooter.vue | 9 ++--- .../avatarModal/customize-banner.vue | 2 +- .../components/avatarModal/extra-settings.vue | 6 ++-- .../components/avatarModal/hair-settings.vue | 8 +++-- .../client/src/components/creatorIntro.vue | 10 +++--- .../components/shops/customizations/index.vue | 2 +- website/client/src/components/ui/itemRows.vue | 2 +- .../script/content/constants/schedule.js | 2 +- .../script/content/shop-featuredItems.js | 3 +- .../common/script/libs/cleanupPinnedItems.js | 4 +-- website/common/script/libs/getItemInfo.js | 3 +- 14 files changed, 65 insertions(+), 42 deletions(-) diff --git a/test/api/unit/libs/content.test.js b/test/api/unit/libs/content.test.js index 36a626151f..53c85e4205 100644 --- a/test/api/unit/libs/content.test.js +++ b/test/api/unit/libs/content.test.js @@ -54,7 +54,9 @@ describe('contentLib', () => { let resSpy; beforeEach(() => { resSpy = generateRes(); - fs.rmdirSync(contentLib.CONTENT_CACHE_PATH, { recursive: true }); + if (fs.existsSync(contentLib.CONTENT_CACHE_PATH)) { + fs.rmdirSync(contentLib.CONTENT_CACHE_PATH, { recursive: true }); + } fs.mkdirSync(contentLib.CONTENT_CACHE_PATH); }); diff --git a/test/content/schedule.test.js b/test/content/schedule.test.js index 748bd53ce8..f3eb83f49a 100644 --- a/test/content/schedule.test.js +++ b/test/content/schedule.test.js @@ -5,7 +5,7 @@ import { // eslint-disable-next-line max-len import { getAllScheduleMatchingGroups } from '../../website/common/script/content/constants/schedule'; -function validateMatcher(matcher, checkedDate) { +function validateMatcher (matcher, checkedDate) { expect(matcher.end).to.be.a('date'); expect(matcher.end).to.be.greaterThan(checkedDate); } @@ -15,15 +15,19 @@ describe('Content Schedule', () => { const date = new Date('2024-01-15'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); it('assembles scheduled items on january 31th', () => { - const date = new Date('2024-01-31') + const date = new Date('2024-01-31'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); @@ -31,7 +35,9 @@ describe('Content Schedule', () => { const date = new Date('2024-03-02'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); @@ -39,22 +45,28 @@ describe('Content Schedule', () => { const date = new Date('2024-03-21'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); it('assembles scheduled items on october 7th', () => { - const date = new Date('2024-10-07') + const date = new Date('2024-10-07'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); it('assembles scheduled items on november 1th', () => { const date = new Date('2024-11-01'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); @@ -62,7 +74,9 @@ describe('Content Schedule', () => { const date = new Date('2024-12-20'); const matchers = getAllScheduleMatchingGroups(date); for (const key in matchers) { - validateMatcher(matchers[key], date); + if (matchers[key]) { + validateMatcher(matchers[key], date); + } } }); }); diff --git a/website/client/src/components/admin-panel/user-support/userProfile.vue b/website/client/src/components/admin-panel/user-support/userProfile.vue index 2cfe84cc6d..adb100382e 100644 --- a/website/client/src/components/admin-panel/user-support/userProfile.vue +++ b/website/client/src/components/admin-panel/user-support/userProfile.vue @@ -28,15 +28,15 @@
- -
+ +
-30 Days
Time Traveling! It is {{ new Date().toLocaleDateString() }} - Reset + Reset
Check out the - Customizations Shop + Customizations Shop for even more ways to customize your avatar! diff --git a/website/client/src/components/avatarModal/extra-settings.vue b/website/client/src/components/avatarModal/extra-settings.vue index 1103e83d56..16d9ce7fca 100644 --- a/website/client/src/components/avatarModal/extra-settings.vue +++ b/website/client/src/components/avatarModal/extra-settings.vue @@ -58,11 +58,13 @@ >

{{ $t('noItemsOwned') }}

+ > + {{ $t('noItemsOwned') }} +

{{ $t('noItemsOwned') }}

+ > + {{ $t('noItemsOwned') }} +

diff --git a/website/client/src/components/creatorIntro.vue b/website/client/src/components/creatorIntro.vue index 361355fb4f..c006f76bf8 100644 --- a/website/client/src/components/creatorIntro.vue +++ b/website/client/src/components/creatorIntro.vue @@ -157,8 +157,8 @@ {{ $t('incentiveBackgrounds') }}
- +
-

{{ $t('noItemsOwned') }}

+

+ {{ $t('noItemsOwned') }} +

diff --git a/website/client/src/components/shops/customizations/index.vue b/website/client/src/components/shops/customizations/index.vue index 32dfa4b202..5343fc4cc9 100644 --- a/website/client/src/components/shops/customizations/index.vue +++ b/website/client/src/components/shops/customizations/index.vue @@ -63,8 +63,8 @@ slot-scope="ctx" >

diff --git a/website/common/script/content/constants/schedule.js b/website/common/script/content/constants/schedule.js index fc9c96bced..e18f524ff4 100644 --- a/website/common/script/content/constants/schedule.js +++ b/website/common/script/content/constants/schedule.js @@ -853,7 +853,7 @@ function makeMatcherClass () { }; } -function makeEndDate(checkedDate, matcher) { +function makeEndDate (checkedDate, matcher) { let end = moment(checkedDate); end.date(TYPE_SCHEDULE[matcher.type]); if (matcher.endMonth !== undefined) { diff --git a/website/common/script/content/shop-featuredItems.js b/website/common/script/content/shop-featuredItems.js index ed40d75e5e..74ffb6a5f5 100644 --- a/website/common/script/content/shop-featuredItems.js +++ b/website/common/script/content/shop-featuredItems.js @@ -1,5 +1,4 @@ -import moment from 'moment'; -import { EVENTS, getScheduleMatchingGroup } from './constants'; +import { getScheduleMatchingGroup } from './constants'; // Magic Hatching Potions are configured like this: // type: 'premiumHatchingPotion', // note no "s" at the end // path: 'premiumHatchingPotions.Rainbow', diff --git a/website/common/script/libs/cleanupPinnedItems.js b/website/common/script/libs/cleanupPinnedItems.js index 8acd8fe8ae..0986927888 100644 --- a/website/common/script/libs/cleanupPinnedItems.js +++ b/website/common/script/libs/cleanupPinnedItems.js @@ -21,7 +21,7 @@ export default function cleanupPinnedItems (user) { .filter(pinnedItem => { const { type } = pinnedItem; const key = pinnedItem.path.split('.').slice(-1)[0]; - if (simpleSeasonalPins.indexOf(type) != -1) { + if (simpleSeasonalPins.indexOf(type) !== -1) { if (type === 'background') { return matchers.backgrounds.match(pinnedItem.path.split('.')[1]); } if (type === 'premiumHatchingPotion') { @@ -32,7 +32,7 @@ export default function cleanupPinnedItems (user) { return matchers.seasonalQuests.match(key); } return matchers[type].match(key); - } if (detailSeasonalPins.indexOf(type) != -1) { + } if (detailSeasonalPins.indexOf(type) !== -1) { const item = getItemByPathAndType(type, pinnedItem.path); if (type === 'gear' && item.klass === 'special') { return matchers.seasonalGear.match(item.set); diff --git a/website/common/script/libs/getItemInfo.js b/website/common/script/libs/getItemInfo.js index ac125249d6..07e1021021 100644 --- a/website/common/script/libs/getItemInfo.js +++ b/website/common/script/libs/getItemInfo.js @@ -492,7 +492,8 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang throw new BadRequest(i18n.t('wrongItemType', { type }, language)); } - if (matcher && (!itemInfo.set || ALWAYS_AVAILABLE_CUSTOMIZATIONS.indexOf(itemInfo.set.key) === -1)) { + if (matcher && (!itemInfo.set + || ALWAYS_AVAILABLE_CUSTOMIZATIONS.indexOf(itemInfo.set.key) === -1)) { itemInfo.end = matcher.end; }