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

Merged
merged 14 commits into from
Dec 3, 2024
Merged
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
6 changes: 0 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@
"no-throw-literal": "off",
"no-warning-comments": "warn",
"react/display-name": "warn",
"react/function-component-definition": [
"warn",
{
"namedComponents": "arrow-function"
}
],
"react/sort-comp": "warn",
"sort-keys": "warn",
"unused-imports/no-unused-imports": "error"
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const config = {
'*.{js,jsx,ts,tsx}': ['eslint --fix --max-warnings 100', 'prettier --write'],
'*.{js,jsx,ts,tsx}': ['eslint --fix --max-warnings 30', 'prettier --write'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dzmitry-Yaniuk
What do you think about decreasing warnings to '0'? It was '0' before switching to nextjs, so I guess we can try to continue doing that.

Copy link
Collaborator Author

@Dzmitry-Yaniuk Dzmitry-Yaniuk Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! From my opinion absence of warnings in code is a project good shape indicator.
However, with existing applied rules we get already around 10 warnings, refactoring code in terms of this PR might not be a good idea. Perhaps I can set this limit now to 20 items?

Otherwise code cannot be pushed without bypass option for git commit.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, so let's set the lowest available number for now and I will create additional ticket for reaching 0

'*.{json,scss,css}': ['prettier --write'],
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/atoms/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import Dropdown from './Dropdown';

describe('Dropdown', () => {
const options = [
{ id: '1', text: 'Option 1', image: '/image1.png' },
{ id: '2', text: 'Option 2', image: '/image2.png' },
{ id: '3', text: 'Option 3', image: '/image3.png' },
{ id: '1', image: '/image1.png', text: 'Option 1' },
{ id: '2', image: '/image2.png', text: 'Option 2' },
{ id: '3', image: '/image3.png', text: 'Option 3' },
];

it('displays the default option', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Storage.prototype.setItem = jest.fn();
const replaceMock = jest.fn();

jest.mock('@/navigation', () => ({
usePathname: jest.fn().mockReturnValue('/test'),
useRouter: jest.fn().mockReturnValue({
replace: (a: string, b: string) => replaceMock(a, b),
}),
usePathname: jest.fn().mockReturnValue('/test'),
}));

describe('LanguageSwitcher', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export default function LanguageSwitcher() {

const options = locales.map((lang) => ({
id: lang,
text: lang,
image: `/images/${lang}.png`,
text: lang,
}));

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Exhibit/Exhibit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export default function ExhibitPage({ exhibit, slug }: Props) {

const images =
exhibit?.imagesCollection?.items?.map((i) => ({
url: i?.url || '',
id: i?.sys.id || '',
url: i?.url || '',
})) || [];

const title = exhibit?.[`name${currentLocale}`];
Expand Down