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

EPMGCIP-179: Configure linters #31

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-implied-eval": "error",
"@typescript-eslint/no-mixed-enums": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/only-throw-error": "error",
"@typescript-eslint/prefer-enum-initializers": "warn",
"@typescript-eslint/prefer-for-of": "error",
Expand Down Expand Up @@ -71,12 +72,41 @@
"pathGroupsExcludedImportTypes": ["react"]
}
],
"max-depth": ["warn", 1],
Dzmitry-Yaniuk marked this conversation as resolved.
Show resolved Hide resolved
"max-lines": ["warn", 200],
"max-nested-callbacks": ["warn", 3],
"max-params": ["warn", 3],
"max-statements-per-line": [
"warn",
{
"max": 1
}
],
"newline-before-return": "error",
"no-case-declarations": "warn",
"no-implied-eval": "off",
"no-else-return": "error",
"no-magic-numbers": [
"warn",
{
"detectObjects": false,
"enforceConst": true,
"ignore": [-1, 0, 1, 2, 10, 100],
"ignoreArrayIndexes": true
}
],
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxEOF": 1
}
],
"no-nested-ternary": "error",
"no-return-await": "off",
"no-throw-literal": "off",
"no-unneeded-ternary": "error",
"no-warning-comments": "warn",
"one-var-declaration-per-line": ["warn", "always"],
"react/display-name": "warn",
"react/sort-comp": "warn",
"sort-keys": "warn",
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ import { useTranslations } from 'next-intl';

export default function NotFoundPage() {
const t = useTranslations();

return <h1>{t('pageNotFound')}</h1>;
}
1 change: 1 addition & 0 deletions src/components/atoms/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function Dropdown<Option extends IDropdownOption>({

useEffect(() => {
window.addEventListener('click', handleClickOutside, true);

return () => {
window.removeEventListener('click', handleClickOutside, true);
};
Expand Down
3 changes: 3 additions & 0 deletions src/components/organisms/ImageGallery/ImageGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const ImageGallery = ({ images }: Props) => {
const loadImage = (url: string) => {
const image = new window.Image();
image.src = url;

return new Promise<HTMLImageElement>((resolve) => {
image.onload = () => resolve(image);
});
Expand Down Expand Up @@ -122,6 +123,7 @@ const ImageGallery = ({ images }: Props) => {
const yetAnotherReactLightboxShift = 1 - 1 / zoom;
const offsetX = ((wrapperX / 100) * (translateX - 50)) / yetAnotherReactLightboxShift;
const offsetY = ((wrapperY / 100) * (translateY - 50)) / yetAnotherReactLightboxShift;

return { offsetX, offsetY };
}

Expand Down Expand Up @@ -162,6 +164,7 @@ const ImageGallery = ({ images }: Props) => {
const imageUrl = images.find((image) => image.id === galleryId)?.url || '';
if (!imageUrl) {
console.error('Image URL not found.');

return;
}

Expand Down
1 change: 1 addition & 0 deletions src/utils/localStorageWithExpiry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function getLocalStorageWithExpiry(key: string) {

if (now.getTime() > item.expiry) {
localStorage.removeItem(key);

return null;
}

Expand Down