Fix linting issues

This commit is contained in:
Phillip Thelen
2024-04-26 13:15:30 +02:00
parent fbdaa50fcf
commit 99a7b90247
14 changed files with 65 additions and 42 deletions

View File

@@ -54,7 +54,9 @@ describe('contentLib', () => {
let resSpy;
beforeEach(() => {
resSpy = generateRes();
if (fs.existsSync(contentLib.CONTENT_CACHE_PATH)) {
fs.rmdirSync(contentLib.CONTENT_CACHE_PATH, { recursive: true });
}
fs.mkdirSync(contentLib.CONTENT_CACHE_PATH);
});

View File

@@ -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,54 +15,68 @@ describe('Content Schedule', () => {
const date = new Date('2024-01-15');
const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) {
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) {
if (matchers[key]) {
validateMatcher(matchers[key], date);
}
}
});
it('assembles scheduled items on march 2nd', () => {
const date = new Date('2024-03-02');
const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) {
if (matchers[key]) {
validateMatcher(matchers[key], date);
}
}
});
it('assembles scheduled items on march 21st', () => {
const date = new Date('2024-03-21');
const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) {
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) {
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) {
if (matchers[key]) {
validateMatcher(matchers[key], date);
}
}
});
it('assembles scheduled items on december 20th', () => {
const date = new Date('2024-12-20');
const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) {
if (matchers[key]) {
validateMatcher(matchers[key], date);
}
}
});
});

View File

@@ -810,6 +810,7 @@ h3 {
import axios from 'axios';
import moment from 'moment';
import Vue from 'vue';
import sinon from 'sinon';
// images
import melior from '@/assets/svg/melior.svg';

View File

@@ -20,7 +20,7 @@
class="check-link"
>
<span>Check out the </span>
<a href='/shops/customizations'>Customizations Shop</a>
<a href="/shops/customizations">Customizations Shop</a>
<span> for even more ways to customize your avatar!</span>
</div>
</div>

View File

@@ -58,11 +58,13 @@
>
<h3
v-once
> {{ $t('noItemsOwned') }} </h3>
>
{{ $t('noItemsOwned') }}
</h3>
<p
v-once
v-html="$t('visitCustomizationsShop')"
class="w-50 mx-auto"
v-html="$t('visitCustomizationsShop')"
></p>
</div>
<customize-banner

View File

@@ -50,16 +50,18 @@
:items="userBeards"
/>
<div
class="my-5"
v-if="showEmptySection"
class="my-5"
>
<h3
v-once
> {{ $t('noItemsOwned') }} </h3>
>
{{ $t('noItemsOwned') }}
</h3>
<p
v-once
v-html="$t('visitCustomizationsShop')"
class="w-50 mx-auto"
v-html="$t('visitCustomizationsShop')"
></p>
</div>
</div>

View File

@@ -157,8 +157,8 @@
<strong>{{ $t('incentiveBackgrounds') }}</strong>
</div>
<div
class="row title-row"
v-if="standardBackgrounds.length < standardBackgroundMax"
class="row title-row"
>
<div
class="col-12"
@@ -301,14 +301,16 @@
/>
</div>
</div>
<customize-banner class="padding-fix"/>
<customize-banner class="padding-fix" />
</div>
<div v-else>
<h3 v-once> {{ $t('noItemsOwned') }} </h3>
<h3 v-once>
{{ $t('noItemsOwned') }}
</h3>
<p
v-once
v-html="$t('visitCustomizationsShop')"
class="w-50 mx-auto"
v-html="$t('visitCustomizationsShop')"
></p>
</div>
</div>

View File

@@ -63,8 +63,8 @@
slot-scope="ctx"
>
<shop-item
:item="ctx.item"
:key="ctx.item.path"
:item="ctx.item"
:price="ctx.item.value"
:price-type="ctx.item.currency"
:empty-item="false"

View File

@@ -15,8 +15,8 @@
<div v-if="items.length === 0">
<p
class="empty-state"
v-html="noItemsLabel"
@click.stop.prevent="$emit('emptyClick', $event)"
v-html="noItemsLabel"
>
</p>
</div>

View File

@@ -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) {

View File

@@ -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',

View File

@@ -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);

View File

@@ -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;
}