Skip to content
Open

result #3745

Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 4 additions & 16 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { Person } from './components/Person/Person';
import './App.scss';

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 violates checklist item #2: ternary operator operands should be on separate lines. Format it as:

const partnerRole = person.sex === 'm'
  ? 'wife'
  : 'husband';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Violates checklist item #2: ternary operands should be on separate lines. Format as:

export const misha = {
Expand All @@ -25,21 +26,8 @@ export const alex = {

export const App = () => (
<div className="App">
<section className="Person">
<h2 className="Person__name">My name is Misha</h2>
<p className="Person__age">I am 37</p>
<p className="Person__partner">Natasha is my wife</p>
</section>

<section className="Person">
<h2 className="Person__name">My name is Olya</h2>
<p className="Person__partner">Maksym is my husband</p>
</section>

<section className="Person">
<h2 className="Person__name">My name is Alex</h2>
<p className="Person__age">I am 25</p>
<p className="Person__partner">I am not married</p>
</section>
<Person person={misha} />
<Person person={olya} />
<Person person={alex} />
</div>
);
22 changes: 21 additions & 1 deletion src/components/Person/Person.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
// export const Person = ({ person }) => ();
import React from 'react';

export const Person = ({ person }) => {
const partnerRole = person.sex === 'm' ? 'wife' : 'husband';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Violates CHECKLIST ITEM #2 - ternary operands should be on separate lines for readability. Format as:

const partnerRole = person.sex === 'm'
  ? 'wife'
  : 'husband';


return (
<div className="Person">
<h2 className="Person__name">My name is {person.name}</h2>

{person.age && <p className="Person__age">I am {person.age}</p>}

{person.isMarried ? (
<p className="Person__partner">
{person.partnerName} is my {partnerRole}
</p>
) : (
<p className="Person__partner">I am not married</p>
)}
</div>
);
};
1 change: 1 addition & 0 deletions src/components/Person/Person.spec.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/named */
import { mount } from '@cypress/react18';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Import mismatch: App.jsx uses default import import Person from, but Person.jsx exports a named export export const Person. Change App.jsx line 2 to use named import: import { Person } from './components/Person/Person';

import { Person } from './Person';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist item #2 violation: The ternary operator operands should be on separate lines. Format as:

const partnerRole = person.sex === 'm'
  ? 'wife'
  : 'husband';

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 ternary operator matches the BAD EXAMPLE pattern from [CHECKLIST ITEM #2]. Format operands on separate lines:

const partnerRole = person.sex === 'm'
  ? 'wife'
  : 'husband';

Expand Down
Loading