Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: eslint various #959

Merged
merged 10 commits into from
Jan 16, 2025
1 change: 1 addition & 0 deletions apps/web/__tests__/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'cypress-wait-until';
import 'cypress-iframe';

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
getByTestId(id: string): Chainable;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/__tests__/test/unit/apiUrl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('validateApiUrl function', () => {
});

it('should remove multiple trailing slashes', () => {
const apiUrl = `${expectedApiUrl}/\//`;
const apiUrl = `${expectedApiUrl}///`;
expect(validateApiUrl(apiUrl)).toEqual(expectedApiUrl);
});

Expand Down
2 changes: 2 additions & 0 deletions apps/web/__tests__/test/unit/i18n.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { describe, expect, it } from 'vitest'
import { getLocaleObject } from '../../../configuration/locale.config'

// eslint-disable-next-line @typescript-eslint/no-require-imports
const en = require('../../../lang/en.json')
// eslint-disable-next-line @typescript-eslint/no-require-imports
const de = require('../../../lang/de.json')

describe('i18n', () => {
Expand Down
1 change: 1 addition & 0 deletions apps/web/build/logs/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class BuildLogger implements Logger {

info(message: string): void {
const formattedMessage = this.formatMessage('INFO', message);
// eslint-disable-next-line no-console
console.log(formattedMessage);
this.logStream.write(`${formattedMessage}\n`);
}
Expand Down
1 change: 1 addition & 0 deletions apps/web/build/validators/FileTypeValidator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class FileTypeValidator {
public static isImage(fileName: string): boolean {
const allowedImageTypes = ['png', 'jpg', 'jpeg', 'gif', 'svg', 'avif', 'webp'];
Expand Down
4 changes: 0 additions & 4 deletions apps/web/components/CategoryFilters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ export type CategoryFiltersProps = {
export type FilterProps = {
facet?: FilterGroup;
};

export type FilterEmits = {
// (event: 'update:selected', parameter: FilterProps['selected']): void;
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ describe('Banner image', () => {

const image = wrapper.find('[data-testid="banner-image-0"]');

console.log(image.html());

expect(image.attributes('src')).toBe('');
expect(image.attributes('alt')).toBe('');
expect(image.attributes('style')).toContain('height: 576px');
Expand Down
2 changes: 1 addition & 1 deletion apps/web/composables/usePayPal/usePayPal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const usePayPal = () => {
return paypalScript;
})
.finally(() => {
delete state.value.loadingScripts[scriptKey];
delete state.value.loadingScripts.scriptKey;
});

return state.value.loadingScripts[scriptKey];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ export const useProductAttributes = (): UseProductAttributesReturn => {
const value = item?.values.find((value) => value.attributeValueId === valueId) || undefined;

if (!value || !valueId) {
delete state.value.attributeValues[attributeId];
delete state.value.attributeValues.attributeId;
disableAttributes();
return;
}

if (value.disabled) {
delete state.value.attributeValues[attributeId];
delete state.value.attributeValues.attributeId;
const oldValues = { ...state.value.attributeValues };
state.value.attributeValues = {};
state.value.attributeValues[attributeId] = valueId;
Expand Down
1 change: 1 addition & 0 deletions apps/web/configuration/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,6 @@ export default {
},
},
},
// eslint-disable-next-line @typescript-eslint/no-require-imports
plugins: [sfTypography, require('@savvywombat/tailwindcss-grid-areas')],
} as Config;
14 changes: 2 additions & 12 deletions apps/web/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,11 @@ export default withNuxt(
*/
rules: {
'arrow-parens': 'off',
'no-console': 'off',
'no-constant-binary-expression': 'off',
'no-useless-escape': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-dynamic-delete': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-invalid-void-type': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-expressions': ['error', { allowTernary: true }],
'vue/no-export-in-script-setup': 'off',
'vue/no-multiple-template-root': 'off',
'vue/no-v-html': 'off',
'vue/no-multiple-template-root': ['off'],
'vue/no-v-html': ['off'],
'vue/html-self-closing': 'off',
}
},
Expand Down
1 change: 0 additions & 1 deletion apps/web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ export default defineNuxtConfig({
navigationPreload: true,
runtimeCaching: [
{
// @ts-ignore
urlPattern: ({ request }) => request.mode === 'navigate',
handler: 'NetworkOnly',
options: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineVitestConfig({
clearMocks: true,
setupFiles: './vitest.config.setup.ts',
include: ['**/*/?(*.)+(spec|test).[jt]s'],
onConsoleLog: (log: string): boolean | void => {
onConsoleLog: (log: string): boolean | undefined => {
if (silenceLogsFromSuspenseComponent(log)) {
return false;
}
Expand Down
Loading