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; let resSpy;
beforeEach(() => { beforeEach(() => {
resSpy = generateRes(); 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); fs.mkdirSync(contentLib.CONTENT_CACHE_PATH);
}); });

View File

@@ -5,7 +5,7 @@ import {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
import { getAllScheduleMatchingGroups } from '../../website/common/script/content/constants/schedule'; 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.a('date');
expect(matcher.end).to.be.greaterThan(checkedDate); expect(matcher.end).to.be.greaterThan(checkedDate);
} }
@@ -15,15 +15,19 @@ describe('Content Schedule', () => {
const date = new Date('2024-01-15'); const date = new Date('2024-01-15');
const matchers = getAllScheduleMatchingGroups(date); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { for (const key in matchers) {
validateMatcher(matchers[key], date); if (matchers[key]) {
validateMatcher(matchers[key], date);
}
} }
}); });
it('assembles scheduled items on january 31th', () => { 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); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { 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 date = new Date('2024-03-02');
const matchers = getAllScheduleMatchingGroups(date); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { 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 date = new Date('2024-03-21');
const matchers = getAllScheduleMatchingGroups(date); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { for (const key in matchers) {
validateMatcher(matchers[key], date); if (matchers[key]) {
validateMatcher(matchers[key], date);
}
} }
}); });
it('assembles scheduled items on october 7th', () => { 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); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { for (const key in matchers) {
validateMatcher(matchers[key], date); if (matchers[key]) {
validateMatcher(matchers[key], date);
}
} }
}); });
it('assembles scheduled items on november 1th', () => { it('assembles scheduled items on november 1th', () => {
const date = new Date('2024-11-01'); const date = new Date('2024-11-01');
const matchers = getAllScheduleMatchingGroups(date); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { 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 date = new Date('2024-12-20');
const matchers = getAllScheduleMatchingGroups(date); const matchers = getAllScheduleMatchingGroups(date);
for (const key in matchers) { for (const key in matchers) {
validateMatcher(matchers[key], date); if (matchers[key]) {
validateMatcher(matchers[key], date);
}
} }
}); });
}); });

View File

@@ -28,15 +28,15 @@
<div class="form-group"> <div class="form-group">
<label>About</label> <label>About</label>
<div class="row about-row"> <div class="row about-row">
<textarea <textarea
v-model="hero.profile.blurb" v-model="hero.profile.blurb"
class="form-control col" class="form-control col"
rows="10" rows="10"
></textarea> ></textarea>
<div <div
v-markdown="hero.profile.blurb" v-markdown="hero.profile.blurb"
class="markdownPreview col" class="markdownPreview col"
></div> ></div>
</div> </div>
</div> </div>
<input <input

View File

@@ -308,10 +308,10 @@
>-30 Days</a> >-30 Days</a>
<div class="my-2"> <div class="my-2">
Time Traveling! It is {{ new Date().toLocaleDateString() }} Time Traveling! It is {{ new Date().toLocaleDateString() }}
<a <a
class="btn btn-warning mr-1" class="btn btn-warning mr-1"
@click="resetTime()" @click="resetTime()"
>Reset</a> >Reset</a>
</div> </div>
<a <a
class="btn btn-secondary mr-1" class="btn btn-secondary mr-1"
@@ -810,6 +810,7 @@ h3 {
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import Vue from 'vue'; import Vue from 'vue';
import sinon from 'sinon';
// images // images
import melior from '@/assets/svg/melior.svg'; import melior from '@/assets/svg/melior.svg';

View File

@@ -20,7 +20,7 @@
class="check-link" class="check-link"
> >
<span>Check out the </span> <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> <span> for even more ways to customize your avatar!</span>
</div> </div>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -853,7 +853,7 @@ function makeMatcherClass () {
}; };
} }
function makeEndDate(checkedDate, matcher) { function makeEndDate (checkedDate, matcher) {
let end = moment(checkedDate); let end = moment(checkedDate);
end.date(TYPE_SCHEDULE[matcher.type]); end.date(TYPE_SCHEDULE[matcher.type]);
if (matcher.endMonth !== undefined) { if (matcher.endMonth !== undefined) {

View File

@@ -1,5 +1,4 @@
import moment from 'moment'; import { getScheduleMatchingGroup } from './constants';
import { EVENTS, getScheduleMatchingGroup } from './constants';
// Magic Hatching Potions are configured like this: // Magic Hatching Potions are configured like this:
// type: 'premiumHatchingPotion', // note no "s" at the end // type: 'premiumHatchingPotion', // note no "s" at the end
// path: 'premiumHatchingPotions.Rainbow', // path: 'premiumHatchingPotions.Rainbow',

View File

@@ -21,7 +21,7 @@ export default function cleanupPinnedItems (user) {
.filter(pinnedItem => { .filter(pinnedItem => {
const { type } = pinnedItem; const { type } = pinnedItem;
const key = pinnedItem.path.split('.').slice(-1)[0]; const key = pinnedItem.path.split('.').slice(-1)[0];
if (simpleSeasonalPins.indexOf(type) != -1) { if (simpleSeasonalPins.indexOf(type) !== -1) {
if (type === 'background') { if (type === 'background') {
return matchers.backgrounds.match(pinnedItem.path.split('.')[1]); return matchers.backgrounds.match(pinnedItem.path.split('.')[1]);
} if (type === 'premiumHatchingPotion') { } if (type === 'premiumHatchingPotion') {
@@ -32,7 +32,7 @@ export default function cleanupPinnedItems (user) {
return matchers.seasonalQuests.match(key); return matchers.seasonalQuests.match(key);
} }
return matchers[type].match(key); return matchers[type].match(key);
} if (detailSeasonalPins.indexOf(type) != -1) { } if (detailSeasonalPins.indexOf(type) !== -1) {
const item = getItemByPathAndType(type, pinnedItem.path); const item = getItemByPathAndType(type, pinnedItem.path);
if (type === 'gear' && item.klass === 'special') { if (type === 'gear' && item.klass === 'special') {
return matchers.seasonalGear.match(item.set); 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)); 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; itemInfo.end = matcher.end;
} }