Skip to content

Commit

Permalink
chore: upgrade to eslint 9 (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksted authored Jan 10, 2025
1 parent d00afe5 commit 1ae3d4a
Show file tree
Hide file tree
Showing 221 changed files with 3,502 additions and 753 deletions.
4 changes: 2 additions & 2 deletions apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"scripts": {
"dev": "nodemon",
"start": "nodemon",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix",
"lint": "echo \"No linting configured for server app\"",
"lint:fix": "echo \"No linting configured for server app\"",
"build": "tsup --minify"
},
"dependencies": {
Expand Down
3 changes: 0 additions & 3 deletions apps/web/.eslintignore

This file was deleted.

58 changes: 0 additions & 58 deletions apps/web/.eslintrc.cjs

This file was deleted.

4 changes: 2 additions & 2 deletions apps/web/__tests__/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Cypress.Commands.add('waitUntilElementInDOM', (actionToWaitOn: () => Cypress.Cha
cy.waitUntil(() =>
actionToWaitOn()
.should('have.length.gte', 0)
.then((element) => !!element.length),
.then(element => !!element.length),
),
);

Cypress.Commands.add('clearServiceWorkers', () => {
// Fix for stuck visit even though page is loaded in cypress
if (window.navigator && navigator.serviceWorker) {
const registrationPromise = window.navigator.serviceWorker.getRegistrations().then((registrations) =>
const registrationPromise = window.navigator.serviceWorker.getRegistrations().then(registrations =>
registrations.forEach((registration) => {
registration.unregister();
}),
Expand Down
4 changes: 2 additions & 2 deletions apps/web/__tests__/support/failOnError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const ignoreErrors = [
'turnstile',
];

Cypress.on("window:before:load", win => {
cy.stub(win.console, "error").callsFake(msg => {
Cypress.on("window:before:load", (win) => {
cy.stub(win.console, "error").callsFake((msg) => {
throw new Error(msg)
})
});
Expand Down
8 changes: 4 additions & 4 deletions apps/web/__tests__/support/pageObjects/EditorObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class EditorObject extends PageObject {
replaceEditorContent(content: string) {
this.editorTextarea
.should('be.visible')
.then($el => {
.then(($el) => {
if ($el.prop('isContentEditable')) {
cy.wrap($el).invoke('text', '');
} else {
Expand Down Expand Up @@ -156,7 +156,7 @@ export class EditorObject extends PageObject {
}

deleteBlock() {
this.blockWrapper.then(initialBlocks => {
this.blockWrapper.then((initialBlocks) => {
const initialLength = initialBlocks.length;
this.blockWrapper.first().should('exist');
this.deleteBlockButton.eq(1).click();
Expand All @@ -182,7 +182,7 @@ export class EditorObject extends PageObject {
}

addBlockTop() {
this.blockWrapper.then(initialBlocks => {
this.blockWrapper.then((initialBlocks) => {
const initialLength = initialBlocks.length;
this.topBlockButton.invoke('removeClass', 'opacity-0');
this.topBlockButton.first().should('exist').click();
Expand All @@ -192,7 +192,7 @@ export class EditorObject extends PageObject {
}

addBlockBottom() {
this.blockWrapper.then(initialBlocks => {
this.blockWrapper.then((initialBlocks) => {
const initialLength = initialBlocks.length;
this.bottomBlockButton.invoke('removeClass', 'opacity-0');
this.bottomBlockButton.first().should('exist').click();
Expand Down
2 changes: 1 addition & 1 deletion apps/web/__tests__/test/feature/auth-guard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('Auth Guard', () => {

cy.wait('@doLogin');

guardedRoutes.forEach(route => {
guardedRoutes.forEach((route) => {
cy.visitAndHydrate(route);
cy.url().should('include', route);
});
Expand Down
6 changes: 3 additions & 3 deletions apps/web/__tests__/test/unit/i18n.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ describe('i18n', () => {
it('has values for all English keys', () => {
const valuesEn: Array<string | object> = Object.values(en);

valuesEn.forEach(value => {
valuesEn.forEach((value) => {
hasText(value);
})
});

it('has values for all German keys', () => {
const valuesDe: Array<string | object> = Object.values(de);

valuesDe.forEach(value => {
valuesDe.forEach((value) => {
hasText(value);
})
});
Expand Down Expand Up @@ -76,7 +76,7 @@ const hasText = (value: string | object) => {
if (isObject(value)) {
expect(JSON.stringify(value)).not.toEqual('{}');

Object.values(value).forEach(childValue => {
Object.values(value).forEach((childValue) => {
hasText(childValue);
})
}
Expand Down
6 changes: 3 additions & 3 deletions apps/web/build/configurator/AppConfigurator.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import dotenv from 'dotenv';
import path, { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { BaseColors, ConfigurationCategory, ConfigurationEntry, ConfigurationResponse, Languages } from './types';
import type { BaseColors, ConfigurationCategory, ConfigurationEntry, ConfigurationResponse, Languages } from './types';
import { getPaletteFromColor } from '../../utils/tailwindHelper';
import { Writer } from '../writers/types';
import { Logger } from '../logs/types';
import type { Writer } from '../writers/types';
import type { Logger } from '../logs/types';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand Down
4 changes: 2 additions & 2 deletions apps/web/build/configurator/AssetDownloader.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import path, { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { FileTypeValidator } from '../validators/FileTypeValidator';
import { Writer } from '../writers/types';
import { Logger } from '../logs/types';
import type { Writer } from '../writers/types';
import type { Logger } from '../logs/types';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand Down
5 changes: 3 additions & 2 deletions apps/web/build/configurator/SystemConfiguration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios, { AxiosRequestConfig } from 'axios';
import type { AxiosRequestConfig } from 'axios';
import axios from 'axios';
import https from 'node:https';
import { ConfigurationResponse, BaseColors, Languages } from './types';
import type { ConfigurationResponse, BaseColors, Languages } from './types';

export class SystemConfiguration {
private axiosRequestConfig: AxiosRequestConfig = {
Expand Down
6 changes: 3 additions & 3 deletions apps/web/build/configurator/__tests__/AppConfigurator.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { AppConfigurator } from '../AppConfigurator';
import { BaseColors, ConfigurationResponse } from '../types';
import { Writer } from '../../writers/types';
import { Logger } from '../../logs/types';
import type { BaseColors, ConfigurationResponse } from '../types';
import type { Writer } from '../../writers/types';
import type { Logger } from '../../logs/types';

describe('AppConfigurator', () => {
let writerMock: Writer;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/build/configurator/__tests__/AssetDownloader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { AssetDownloader } from '../AssetDownloader';
import { FileTypeValidator } from '../../validators/FileTypeValidator';
import { Writer } from '../../writers/types';
import { Logger } from '../../logs/types';
import type { Writer } from '../../writers/types';
import type { Logger } from '../../logs/types';
import path from 'path';

describe('AssetDownloader', () => {
Expand Down
1 change: 0 additions & 1 deletion apps/web/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const main = async () => {
}
};

// eslint-disable-next-line etc/no-implicit-any-catch
await main().catch((error: Error) => {
BuildLoggerInstance.error('An error occurred:', error);
});
5 changes: 3 additions & 2 deletions apps/web/build/logs/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import path, { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { createWriteStream, WriteStream } from 'node:fs';
import { Logger } from './types';
import type { WriteStream } from 'node:fs';
import { createWriteStream } from 'node:fs';
import type { Logger } from './types';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand Down
4 changes: 2 additions & 2 deletions apps/web/build/writers/CdnToFileWriter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import { existsSync, writeFileSync } from 'node:fs';
import { Writer } from './types';
import { Logger } from '../logs/types';
import type { Writer } from './types';
import type { Logger } from '../logs/types';

export class CdnToFileWriter implements Writer {
private logger: Logger;
Expand Down
4 changes: 2 additions & 2 deletions apps/web/build/writers/DataToFileWriter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeFileSync, existsSync } from 'node:fs';
import { Writer } from './types';
import { Logger } from '../logs/types';
import type { Writer } from './types';
import type { Logger } from '../logs/types';

export class DataToFileWriter implements Writer {
private logger: Logger;
Expand Down
6 changes: 3 additions & 3 deletions apps/web/components/AccountForms/AccountFormsName.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<form @submit.prevent="$emit('on-save')" data-testid="account-forms-name">
<form data-testid="account-forms-name" @submit.prevent="$emit('on-save')">
<div class="md:flex justify-between gap-4">
<label class="block flex-1">
<UiFormLabel>{{ $t('account.accountSettings.personalData.firstName') }} {{ $t('form.required') }}</UiFormLabel>
<SfInput name="firstname" type="text" v-model="userData.firstName" required />
<SfInput v-model="userData.firstName" name="firstname" type="text" required />
</label>
<label class="block flex-1 mt-4 md:mt-0">
<UiFormLabel>{{ $t('account.accountSettings.personalData.lastName') }} {{ $t('form.required') }}</UiFormLabel>
<SfInput name="lastname" type="text" v-model="userData.lastName" required />
<SfInput v-model="userData.lastName" name="lastname" type="text" required />
</label>
</div>
<div class="mt-6 flex flex-col-reverse md:flex-row md:justify-end gap-4">
Expand Down
8 changes: 4 additions & 4 deletions apps/web/components/AccountForms/AccountFormsPassword.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<template>
<form @submit.prevent="submitChangePassword" data-testid="account-forms-password">
<form data-testid="account-forms-password" @submit.prevent="submitChangePassword">
<label class="block">
<UiFormLabel
>{{ t('account.accountSettings.personalData.currentPassword') }} {{ $t('form.required') }}</UiFormLabel
>
<UiFormPasswordInput
v-model="userPasswords.oldPassword"
name="password"
autocomplete="current-password"
v-model="userPasswords.oldPassword"
required
/>
</label>
<label class="block my-4">
<UiFormLabel>{{ t('account.accountSettings.personalData.newPassword') }} {{ $t('form.required') }}</UiFormLabel>
<UiFormPasswordInput
v-model="userPasswords.firstNewPassword"
name="password"
autocomplete="new-password"
v-model="userPasswords.firstNewPassword"
required
minlength="8"
pattern="^(?=.*[A-Za-z])(?=.*\d)\S{8,}$"
Expand All @@ -28,9 +28,9 @@
>{{ t('account.accountSettings.personalData.newPasswordAgain') }} {{ $t('form.required') }}</UiFormLabel
>
<UiFormPasswordInput
v-model="userPasswords.secondNewPassword"
name="password"
autocomplete="new-password"
v-model="userPasswords.secondNewPassword"
required
minlength="8"
pattern="^(?=.*[A-Za-z])(?=.*\d)\S{8,}$"
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/Address/Address.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<script lang="ts" setup>
import { SfIconCheckCircle } from '@storefront-ui/vue';
import { type AddressProps } from './types';
import type { AddressProps } from './types';
import { userAddressGetters } from '@plentymarkets/shop-api';
const { address, isDefault, isSelected, showDivider } = defineProps<AddressProps>();
Expand Down
8 changes: 4 additions & 4 deletions apps/web/components/AddressContainer/AddressContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
@edit="edit"
/>
<UiButton
:data-testid="'save-address-' + type"
v-else
@click="validateAndSubmitForm"
:data-testid="'save-address-' + type"
:disabled="formIsLoading"
variant="secondary"
@click="validateAndSubmitForm"
>
{{ t('saveAddress') }}
</UiButton>
Expand All @@ -29,10 +29,10 @@
:label="!editing && !showNewForm && !disabled ? t('editAddress') : ''"
>
<UiButton
@click="edit(checkoutAddress)"
:disabled="formIsLoading || disabled"
variant="secondary"
:data-testid="'edit-address-' + type"
@click="edit(checkoutAddress)"
>
<template v-if="!editing && !showNewForm">{{ t('contactInfo.edit') }}</template>
<SfIconClose v-else />
Expand Down Expand Up @@ -67,7 +67,7 @@

<script setup lang="ts">
import { SfIconClose, SfTooltip } from '@storefront-ui/vue';
import { type AddressContainerProps } from './types';
import type { AddressContainerProps } from './types';
import { type Address, AddressType } from '@plentymarkets/shop-api';
const { disabled = false, type } = defineProps<AddressContainerProps>();
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/AddressContainer/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AddressType } from '@plentymarkets/shop-api';
import type { AddressType } from '@plentymarkets/shop-api';

export type AddressContainerProps = {
disabled?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/AddressDisplay/AddressDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<script lang="ts" setup>
import { userAddressGetters } from '@plentymarkets/shop-api';
import { type AddressProps } from './types';
import type { AddressProps } from './types';
const { address } = defineProps<AddressProps>();
Expand Down
2 changes: 1 addition & 1 deletion apps/web/components/AddressDisplay/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Address } from '@plentymarkets/shop-api';
import type { Address } from '@plentymarkets/shop-api';

export type AddressProps = {
address: Address;
Expand Down
Loading

0 comments on commit 1ae3d4a

Please sign in to comment.