Skip to content

Add eslint, prettier; refactor code#64

Open
boda4ek888 wants to merge 2 commits into
mate-academy:mainfrom
boda4ek888:task_solution
Open

Add eslint, prettier; refactor code#64
boda4ek888 wants to merge 2 commits into
mate-academy:mainfrom
boda4ek888:task_solution

Conversation

@boda4ek888

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

You've made a great start on this task, and the Page Object Model is well-implemented. However, some changes are needed before this can be approved. The main issue is in eslint.config.mjs, where eslint-config-prettier must be the last element in the array to correctly override other style rules. Additionally, a test in tests/signUp/signUpNegative.spec.js will likely fail because the multi-line error message string contains extra whitespace and newlines that won't match the actual text on the page. There are also a few remaining linting errors, such as a line exceeding the maximum length in tests/signUp/signUpPositive.spec.js. Addressing these configuration and test issues will ensure all requirements are met.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread eslint.config.mjs Outdated
/** @type {import('eslint').Linter.Config[]} */
export default [
{ languageOptions: { globals: globals.node } },
eslintConfigPrettier,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

According to the eslint-config-prettier documentation, this configuration should be placed last in the array. This ensures it can properly override any conflicting style rules from other configurations like @eslint/js and eslint-plugin-playwright.

Comment thread eslint.config.mjs Outdated
...pluginJs.configs.recommended,
...playwright.configs['flat/recommended'],
rules: {
...pluginJs.configs.recommended.rules,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The rules from pluginJs.configs.recommended are already included by spreading the configuration object on line 12. Spreading the rules again here is redundant and can be removed.

Comment thread eslint.config.mjs Outdated
comments: 80,
},
],
...playwright.configs['flat/recommended'].rules,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similar to the JavaScript rules, the Playwright-specific rules are already included by the spread on line 13. This makes this line redundant and it should be removed.

Comment thread tests/signUp/signUpPositive.spec.js Outdated
email: faker.internet.email(),
password: faker.internet.password(),
}
username: `${faker.person.firstName()}_${faker.person.lastName()}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line exceeds the 80-character limit defined in the eslint.config.mjs file. To fix this, you could create separate variables for the first and last names and then combine them.

Comment on lines 17 to 20
await signUpPage.assertErrorMessageContainsText(
`username:Username must start with a letter, have no spaces, and be 2 - 40 characters.`
`username:Username must start with a letter,
have no spaces, and be 2 - 40 characters.`,
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When you create a string that spans multiple lines using a template literal, the newline character and any leading whitespace (indentation) on the following lines are included in the string itself. This will likely cause the toContainText assertion to fail because the error message on the web page won't contain this extra formatting. Consider concatenating the strings or writing the full string on a single line to fix this.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this task! You've successfully configured ESLint, Prettier, and Husky, and addressed nearly all the feedback from the previous review. The project is in great shape, and the automated checks are working as expected.

I am approving your solution, but please address one remaining minor linting issue before your next commit:

  • In tests/signIn/signInNegative.spec.js, one line exceeds the 80-character limit. You can resolve this by moving the error message string into a constant, just as you did in the sign-up tests.

This is a great demonstration of setting up and adhering to a project's quality standards. Keep up the fantastic work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

await signInPage.fillEmailField('test@gmail.com');
await signInPage.clickSignInButton();
await signInPage.assertErrorMessageContainsText(`password:can\'t be blank`);
await signInPage.assertErrorMessageContainsText(`password:can't be blank`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line exceeds the 80-character limit defined in eslint.config.mjs, especially when accounting for indentation. To resolve this, you could move the error message string into a constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants