Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f49a875

Browse files
committedFeb 13, 2024
feature/prettier added prettier, updated packages
1 parent cbd96bc commit f49a875

15 files changed

+7628
-8879
lines changed
 

‎.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
/build

‎.prettierrc

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"arrowParens": "avoid",
3+
"singleQuote": true,
4+
"tabWidth": 2,
5+
"trailingComma": "all",
6+
"jsxSingleQuote": false,
7+
"printWidth": 80,
8+
"semi": true,
9+
"bracketSpacing": true,
10+
"bracketSameLine": false
11+
}

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This task is similar to [Static List of TODOs](https://github.com/mate-academy/r
1010
- `Info` components should take one object and render its data.
1111

1212
## Instructions
13-
13+
- Install Prettier Extention and use this [VSCode settings](https://mate-academy.github.io/fe-program/tools/vscode/settings.json) to enable format on save.
1414
- Implement a solution following the [React task guideline](https://github.com/mate-academy/react_task-guideline#react-tasks-guideline).
1515
- Open one more terminal and run tests with `npm test` to ensure your solution is correct.
1616
- Replace `<your_account>` with your Github username in the [DEMO LINK](https://<your_account>.github.io/react_static-list-of-posts-js/) and add it to the PR description.

‎package-lock.json

+7,569-8,832
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"@cypress/react": "^5.12.4",
1010
"bulma": "^0.9.4",
1111
"classnames": "^2.3.2",
12-
"react": "^17.0.2",
13-
"react-dom": "^17.0.2",
14-
"react-scripts": "^4.0.3"
12+
"react": "^18.2.0",
13+
"react-dom": "^18.2.0",
14+
"react-scripts": "5.0.1"
1515
},
1616
"devDependencies": {
1717
"@cypress/webpack-dev-server": "^1.8.4",
1818
"@mate-academy/cypress-tools": "^1.0.4",
19-
"@mate-academy/eslint-config-react": "^0.0.11",
19+
"@mate-academy/eslint-config-react": "^0.0.12",
2020
"@mate-academy/eslint-config-react-typescript": "^1.0.12",
21-
"@mate-academy/scripts": "^1.2.12",
21+
"@mate-academy/scripts": "^1.7.0",
2222
"@mate-academy/students-ts-config": "*",
2323
"@mate-academy/stylelint-config": "^0.0.11",
2424
"@types/node": "^17.0.23",
@@ -31,8 +31,9 @@
3131
"mochawesome": "^7.1.3",
3232
"mochawesome-merge": "^4.2.0",
3333
"mochawesome-report-generator": "^6.2.0",
34-
"node-sass": "^6.0.1",
34+
"node-sass": "^7.0.1",
3535
"postcss": "^8.4.12",
36+
"prettier": "^3.2.5",
3637
"stylelint": "^15.11.0",
3738
"typescript": "^4.6.3"
3839
},
@@ -42,7 +43,8 @@
4243
"test": "mate-scripts test -l",
4344
"lint-js": "mate-scripts lint -j",
4445
"lint-css": "mate-scripts lint -s",
45-
"lint": "npm run lint-js && npm run lint-css",
46+
"format": "prettier --write './src/**/*.{js,jsx}'",
47+
"lint": "npm run format && npm run lint-js && npm run lint-css",
4648
"update": "mate-scripts update",
4749
"postinstall": "npm run update && cypress verify",
4850
"predeploy": "npm run build",

‎src/App.jsx

+4-7
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ export const App = () => (
2323
</div>
2424

2525
<p className="PostInfo__body">
26-
est rerum tempore vitae sequi sint nihil reprehenderit dolor beatae
27-
ea dolores neque fugiat blanditiis voluptate porro vel nihil
28-
molestiae ut reiciendis qui aperiam non debitis possimus qui neque
29-
nisi nulla
26+
est rerum tempore vitae sequi sint nihil reprehenderit dolor beatae ea
27+
dolores neque fugiat blanditiis voluptate porro vel nihil molestiae ut
28+
reiciendis qui aperiam non debitis possimus qui neque nisi nulla
3029
</p>
3130

3231
<hr />
@@ -36,9 +35,7 @@ export const App = () => (
3635

3736
<div className="PostInfo">
3837
<div className="PostInfo__header">
39-
<h3 className="PostInfo__title">
40-
doloremque illum aliquid sunt
41-
</h3>
38+
<h3 className="PostInfo__title">doloremque illum aliquid sunt</h3>
4239

4340
<p>
4441
{' Posted by '}
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const CommentInfo = () => (
2-
<>Put the comment here</>
3-
);
1+
export const CommentInfo = () => <>Put the comment here</>;

‎src/components/CommentInfo/CommentInfo.spec.jsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ describe('CommentInfo component', () => {
1818
});
1919

2020
it('should show a name', () => {
21-
cy.get('.CommentInfo__name')
22-
.should('have.text', 'Comment name');
21+
cy.get('.CommentInfo__name').should('have.text', 'Comment name');
2322
});
2423

2524
it('should show an email', () => {
@@ -29,7 +28,6 @@ describe('CommentInfo component', () => {
2928
});
3029

3130
it('should show a body', () => {
32-
cy.get('.CommentInfo__body')
33-
.should('have.text', 'Some comment text');
31+
cy.get('.CommentInfo__body').should('have.text', 'Some comment text');
3432
});
3533
});
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const CommentList = () => (
2-
<>Put the list here</>
3-
);
1+
export const CommentList = () => <>Put the list here</>;

‎src/components/CommentList/CommentList.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ describe('CommentList component', () => {
4747
});
4848

4949
it('should render comments in correct order', () => {
50-
cy.get('.CommentInfo__name').eq(0)
50+
cy.get('.CommentInfo__name')
51+
.eq(0)
5152
.should('have.text', 'id labore ex et quam laborum');
5253

53-
cy.get('.CommentInfo__name').eq(3)
54-
.should('have.text', 'alias odio sit');
54+
cy.get('.CommentInfo__name').eq(3).should('have.text', 'alias odio sit');
5555
});
5656
});
5757

‎src/components/PostInfo/PostInfo.jsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const PostInfo = () => (
2-
<>Put the post here</>
3-
);
1+
export const PostInfo = () => <>Put the post here</>;

‎src/components/PostInfo/PostInfo.spec.jsx

+20-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ describe('PostInfo', () => {
5252
});
5353

5454
it('should have a correct title', () => {
55-
cy.get('.PostInfo__title').should('have.text', 'et ea vero quia laudantium autem');
55+
cy.get('.PostInfo__title').should(
56+
'have.text',
57+
'et ea vero quia laudantium autem',
58+
);
5659
});
5760

5861
it('should have a user', () => {
@@ -61,8 +64,15 @@ describe('PostInfo', () => {
6164

6265
it('should contain all comments', () => {
6366
cy.get('.CommentInfo').should('have.length', 3);
64-
cy.get('.CommentInfo__name').eq(0).should('have.text', 'esse autem dolorum');
65-
cy.get('.CommentInfo__name').eq(2).should('have.text', 'culpa eius tempora sit consequatur neque iure deserunt');
67+
cy.get('.CommentInfo__name')
68+
.eq(0)
69+
.should('have.text', 'esse autem dolorum');
70+
cy.get('.CommentInfo__name')
71+
.eq(2)
72+
.should(
73+
'have.text',
74+
'culpa eius tempora sit consequatur neque iure deserunt',
75+
);
6676
});
6777

6878
it('should not show NoCommentsMessage', () => {
@@ -130,10 +140,15 @@ describe('PostInfo', () => {
130140

131141
mount(<PostInfo post={otherPost} />);
132142

133-
cy.get('.PostInfo__title').should('have.text', 'ea molestias quasi exercitationem repellat qui ipsa sit aut');
143+
cy.get('.PostInfo__title').should(
144+
'have.text',
145+
'ea molestias quasi exercitationem repellat qui ipsa sit aut',
146+
);
134147
cy.get('.UserInfo').should('contain', 'Leanne Graham');
135148
cy.get('.CommentInfo').should('have.length', 2);
136-
cy.get('.CommentInfo__name').eq(0).should('have.text', 'id labore ex et quam laborum');
149+
cy.get('.CommentInfo__name')
150+
.eq(0)
151+
.should('have.text', 'id labore ex et quam laborum');
137152
});
138153
});
139154
});

‎src/components/PostList/PostList.jsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const PostList = () => (
2-
<>Put the list here</>
3-
);
1+
export const PostList = () => <>Put the list here</>;

‎src/components/UserInfo/UserInfo.jsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const UserInfo = () => (
2-
<>Put the user here</>
3-
);
1+
export const UserInfo = () => <>Put the user here</>;

‎src/index.jsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import ReactDOM from 'react-dom';
1+
import { createRoot } from 'react-dom/client';
22

33
import { App } from './App';
44

5-
ReactDOM.render(
6-
<App />,
7-
document.getElementById('root'),
8-
);
5+
createRoot(document.getElementById('root')).render(<App />);

0 commit comments

Comments
 (0)
Please sign in to comment.