BarneyShi / Team1-VanHouse

CPSC455 course project.
0 stars 1 forks source link

Adding ESLint and Prettier #11

Closed NaithanB closed 3 years ago

NaithanB commented 3 years ago

Heya, I’ve added ESLint and Prettier to the project on the ESLint_Setup branch. Try checking it out and making sure that it runs on your machine. I’m not sure, but I think you may need to do cd vanhouse and then npm install. We should now be able lint our code by running npx eslint src/components/<your-component-here>. We can also check formatting using npx prettier --check src/components/<your-component-here> and auto-format using npx prettier --write src/components/<your-component-here>. I was thinking that we could all update our components to fit the linting rules on this branch and then merge to project_2 once everything works.

Adding the linter causes the project to fail to compile now. There are some changes that we need to make. You can see the problems either by running npm start or running ESLint. I've already made a few of the easy changes that needed to be done in every file. So, you may notice a few small changes to a couple of your components (e.g. import React from ‘react’).

To run the app without using the linter use npm run start-no-lint

Two issues that came up for me when running the linter are…

“Must use destructuring of props assignment”

See this link: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md

The second issue was... “ is missing in props validation”

Let me know if this works for you.

BarneyShi commented 3 years ago

Thanks, Naithan 👍 I think what we can do next is to fix our own component in this branch, so we can create an eslint-ready base branch project_3.